WebThingsIO / api

Web Thing API Specification
http://iot.mozilla.org/wot/
Other
164 stars 24 forks source link

Default on change event for some properties #132

Open sColin16 opened 5 years ago

sColin16 commented 5 years ago

Many smart home devices will give users a notification when the state of some device has changed when that state change has security implications (e.g. when a garage door opens, doors are unlocked, etc.). Many of these "states" would be appropriately defined as properties (since they could be set), but it would also be useful for them to have an event associated with a change to that property, so that (for example), someone could "subscribe" to that event (in the case of a websocket) to send notifications or handle these important state changes correctly.

I'm not exactly sure how this should be implemented, but I think that some properties should have an event associated with them whenever their values change (or perhaps cross some threshold for number properties). The best way I can think to do that is to include an optional field in the property object with a link to the associated event. It may also be useful to include a field for the link to the associated property in the event object. This would make it easy to connect properties and events that are associated. Since multiple agents could change these properties (devices connected to the gateway, a cloud service, or a smart switch/remote control), I think there are a lot of instances where it would be useful to connect properties and events