Subscribe to a location?


#1

Can you still subscribe to all events by location? Looking at this documentation it is possible: void subscribe(Location location, handlerMethod) but I fear this may be old documentation and the functionality has been deprecated, anyone know?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

That doesn’t subscribe to all Things at a Location!

It subscribes to “Location” Events (like Mode changed).


#3

Thanks for the reply. Yes it would seem I misunderstood the documentation, thanks for clarifying. Do you know if there is a “best practise” approach to subscribe to all events, or at least all events that the user has given permission to view?


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

In the current API (i.e., not the “new” Beta API), you must have the user select from lists of Devices (Things) and then you automatically get access to all the Attributes and Commands of the those Things. (This changes in the new API, but not worth thinking about it yet).

There is no “select all Things” (except in SmartThings’s internal APIs usable by Alexa, etc.).

There is also no “list all Things” for the input() statement: You must use a Capability filter. The most common approach is to have inputs for several high-coverage common Capabilities like “Sensor”, “Actuator” - everything is supposed to be tagged with one or both of these, but many DTHs are improperly written and not certified.