Am using Node RED with Home Assistant and have several flows all working well.
One issue I am having is whenever I do anything with “device_tracker” entities, I get multiple, seemingly random events of the same kind. The node I use is this one:
In the description, it states:
Outputs ‘state_changed’ event types sent from Home Assistant
But I find that it’s getting ALL events - not just ones where the state actually changes. This is bad for the device_tracker entities, because they will send the same state… for example, I will get random “home” events even though I was and still am, home. I think it has to do with the phone “checking in”, which triggers an event even though the state of the entity has not changed.
My solution to this has been to do something like:
where in the switch node I have:
Which works…
I should point out, that in node-red-contrib-home-assistant
ver 0.3, I have tried using the new “Trigger: State” node:
But it has the same issue… I know I can put “conditions” on the trigger like:
But then I only get a trigger on that specific change. I was hoping to get a true “only pass the event if the state actually changed” node, then depending on the new state, take actions. Am I missing something basic here?