I am housing all of my Smarthome logic in Node-Red. I control devices connected to Z2M, Homebridge, and Hubitat there.
A simple example of something I am looking to do is as follows:
- When a button is pushed toggle a bulb between off and on.
I know how to do this when everything is connected to the Hubitat. Basically the logic is as follows:
- Receive the button push event
- Check current state of bulb
- If on send off command
- If off send on command
All of these have very clear analogies on how to accomplish them if the button and bulb are connected to Z2M, with 1 exception. That is step 2.
Is there a method via MQTT to retrieve the current state?
I don’t think there is.I think what I need to do is capture the state when it is sent by Z2M on a change and store it in Node-Red and then reference that stored value for step 2. I just wanted confirmation that I wasn’t missing something obvious.