I’m trying to make a flow to read the last motion or door sensor and then send that to Home Assistant so I can display that in Lovelace. is this some thing that is possible in Node Red?
Entirely possible with or without Node Red.
With Node Red, you’re going to need to trigger on all of your door/motion sensors and then publish the entity_id or friendly name of the trigger to either an MQTT Topic or a HASS State.
Without Node Red, an Automation that calls a python_script to set the state will likely work best (or, optionally, you could do the MQTT round trip from the Automation).
So i come up with this. Just testing some inputs for now. Must be a cleaner way to do it.
Also i notice that when the trigger state changes it sends the MQTT Topic. Say like when the motion PIR goes from “off” to “on” and also “on” to “off”. Is there a way to only send the MQTT Topic if the state changes to “on” only. I tried on the events node to send if “on”. Maybe it don’t work that way.
You can use ‘substring’ or ‘regex’ as the match type so you only have one event state node. Read the info panel about
If State, if it’s true it goes to the second output.
and if you don’t mind me asking what browser are you using so I can fix the alignment issue in the UI?
Giving ‘regex’ a try this morning. Seems to be working fairly well.
I’m using Firefox as my browser. Where are you seeing the alignment issue? I must be use to it. lol.
Even without the RegEx, it’s been a while since I’ve used NodeRed, but, I’m pretty sure you can use the same Switch Node (to check for “on”) and Change Node (to get the entity ID) for all of the triggers. You don’t need that part to be duplicated for each potential trigger.