Bitfocus Companion Control

Nothing against the solution provided, awesome that its going to happen soon.

But just had this thought, I dont know enough about JSON to know if this would also blow everything up, but maybe this would work to be backward compatible and solve the problem? Making it easier to traverse directly to a specific attribute without looping through everything?

Basically, instead of moving the attribute name up, you keep it in the original location and also add it as the name of the group.

"attributes": {
     "switch": {
         "name": "switch",
         "currentValue": "on",
         "dataType": "ENUM",
         "values": [
            "on",
            "off"
         ]
      },
      "energy": {
         "currentValue": 4,
         "dataType": "NUMBER"
      },
      "power": {
         "name": "power",
         "name": "energy",
         "currentValue": 346,
         "dataType": "NUMBER"
     }
},

I'm not touching any endpoint currently in Maker API. Those endpoints will continue to return exactly what they do now. As I said above, I don't have the time to dive deep into these issues. Adding a new endpoint is easy, so I've done that. That was in response to this comment and further discussion about it:

2 Likes

And it is greatly appreciated, Bruce!

Being able to request current value on a device attribute is something that couldn't be done before without parsing the entire attribute list/structure on the client side.

There are use cases where the new endpoint will directly address that desire - so thanks!

1 Like