Emit a message when power state command is issued (even when there's no power state change)
hepcat72 opened this issue · 4 comments
I'm not entirely sure whether this is a bug report or an enhancement request - or whether what I'm trying to achieve is even possible, but, here's what I've got...
- I have a leviton dimmer switch (for my back yard flood light) successfully set up in homebridge using your node
- I have a hb-events node in node red set up using
node-red-contrib-homebridge-automation
that is set to emit events for the switch - I want the switch to be able to also control other switches (e.g. my driveway flood light) as well
- Those other switches have their own switches, so the states (e.g. between the driveway flood and back yard flood) are not always identical. In fact, the driveway flood gets turned on my motion sensing and a geofence I set up.
- When I get home, I'd like to be able to turn off the driveway flood manually using the leviton switch, because it's right by the back door and the driveway flood switch is upstairs, but if the backyard flood is off, hitting the off "button" on the leviton toggle emits no event from the hb-events node for the leviton switch. It only emits events when the back yard flood light power state (or brightness) changes. (Note, I have a polling mechanism set up with an hb-status node, which is what prompts the hb-events node to emit messages on state changes.)
So essentially, I need an event emitted when an onSetPower
event occurs...
One thing I noticed however is that my leviton dimmer switch is labeled by the homebride-automation node as a "LightBulb", so it makes sense in that context that it would not emit an event.
Is this an issue WRT node-red-contrib-homebridge-automation
or homebridge-leviton
? Which one is identifying my switch as a lightbulb, and if it was identified as a switch, would onSetPower
events happen if the powerstate of the switch is not changing?
Would it not be easier to set up automations directly in your Home app?
The point is to make the physical switch work in the following cases:
- Leviton light is
on
and the physicalon
button is pressed. I would like my pi to know that the on button was pressed in this case so that I can turnon
other lights in addition to the directly-wired leviton light - Leviton light is
off
and the physicaloff
button is pressed. I would like my pi to know that the on button was pressed in this case so that I can turnoff
other lights in addition to the directly-wired leviton light
There is no way to create an automation in the home app that would enable the switch to work.
That said, I suspect that the Leviton API does not support those cases. If that's true, then feel free to close this issue.
And incidentally, the motivation here is that my wife demands a physical switch. She's not into automation and refuses to use an app to turn on/off lights. But since I have automations that turn lights on/off individually, we run into this case where the switch doesn't control other lights that happen to be in the opposite state as the Leviton light.
Given how the API works, I'm not sure how you would achieve this. I see no update/change events either in the API or websocket when the light is on and the switch on is pressed. It seems this is filtered out at the hardware level, or upstream from Leviton. Sorry :-/