I use node-red (add-on) with hass.io. I am truly a beginner so excuse me if I am asking for something that is trivial or for something that has already been solved. I have not been able to fins it.
I want notifications when entity become unavailable. However, sometimes they are unavailable for a very short time and then I do not need to be notified.
I check this with my mediaplayers (sonos).
My flow start with an events: all-node. I first verify that the state of the object has actually changed using an rbe-node. I then check that the state-change refers to a media-player (using a switch-node).
I the check that the new_state is unavailable. If so a notification is sent to me.
Now I would like to delay the message one minute and only send a notification if the state remains unavailable.
I have four different sonos players why I do not know which player that is unavailable unless I check the entity_id in the message.
It seems logical to first insert a wait-node that waits one minute (no other conditions) and then to use a current-state node to verify that it is still unavailable. This poses a problems as I like the idea of not messing up the flow by having different nodes for each entity. Also if I add a new sonos unit I have to amend my flow unless I can solve this problem.
I do not know how to tell the current-state node which entity to check unless I first insert a switch node that checks the entity and then send it on to different current state-nodes depending on which sonos player is unavailable.
I would simply like to refer to the entity in the previous payload (msg.payload.entity_id) and have the current state-node check if the state is still unavailable. Is this possible?