-
Notifications
You must be signed in to change notification settings - Fork 330
Description
I'm attempting to modify the gateway so that when an internal message is sent from a rule to change a value (or an action) it will also send an 'origin' attribute.
That way, my Zigbee addon will be able to discern between a user-initiated value change and an automation-initiated value change.
Why is this useful?
Well, currently when the brightness property of a light is changed, it also turns on the light.
But I'd like to have actions that change the brightness of a light throughout the day, independent of whether it's on or not.
That way, if I turn on a light at night, the zigbee addon can then apply the brightness value, but not while it was off.
User story:
I want to be able to create automations that adjust properties like brightness and color, without that change also triggering the light to turn on.
In the Zigbee addon:
A. user changes brightness -> brightness is applied and light switches on if it wasn't on already.
B . automation changes brightness -> If the light is off, the Zigbee addon remembers the desired brightness, but doesn't apply it, so that the light doesn't turn on. Then, when the light's state property is turned on, only then does the addon also apply the remembered brightness.
I thought I would share this, as there might be a better way to implement this? Perhaps even outside of the addon? I'm not even sure where the logic to also turn on a light if its brightness changes is located. I'm guessing it's in the capability code.
Even then, I think knowing what the origin of any event is is useful. For example, Voco keeps track of origins such as voice input, chat window input, remote mobile phone input, etc. If it's a voice origin, then the response will be a generated voice. If it's a chat origin, then the response is sent to that 'destination'. Sometimes it needs to be sent to all possible outputs, or any output that is text-based. And so forth.
So thinking ahead, maybe a destination array might also be useful? Maybe both could be inside a meta(data) key?
Similar code in the Gateway might be the importance level that notifiers use?
Curious as to your thoughts.