I have a question about the subscribe( ) API. The documentation states that we can subscribe the event values. Basically, I’m trying to understand the way that we can subscribe the device attributes. Particularly, it is stated that
The handler method must accept an Event parameter.
Refer to the Event API documentation for more information about the Event object.
You can find the possible Events to subscribe to by referring to the Attributes column for a capability in the Capabilities Reference. The general form we use is “.”. If the attribute does not have any possible values (for example, “battery”), you would just use the attribute name.
In the example above, the switch capability has the attribute “switch”, with possible values “on” and “off”. Putting these together, we use “switch.on”
My question is, there are devices that have attributes different than ENUM like switch example has only values on and off. For instance, battery: NUMBER and heatingSetpoint: NUMBER is one of the many examples. Can I subscribe these events?, for instance, subscribe(my_battery, “battery.50”, battery_50_handler)
subscribe(my_battery, “battery.currentState(“battery”)”, battery_50_handler).