Remember state of entity to use later in flow

Good afternoon,

I’m trying to create a flow in node-red that checks the state of a current entity and uses that in the initial action. This first step isn’t that difficult, using a current state node for that. The next part is what I can’t figure out.

Situation
I have a wall switch connected to a shelly that triggers the lights in my kitchen. It’s set up as a detached switch to ensure it no matter the position, switches the lights described in my current flow.

My kitchen consists of two groups - the bar and kitchen spots. The bar lights are ‘on’ when the scene ‘zithoek’ is turned on. When I then use the wall switch, the kitchen spots go on but the bar goes off, due to the setup of the shelly, ‘switch’ instead of on/off.

I would like to integrate that state of the bar lights, created the following. When the bar lights are on and the switch is used, turn on the kitchen spots - so all lights are on. When the switch is used again, turn off the kitchen spots but leave on the bar, as these were on before.

Does anybody have a suggestion on how to do this? It must be easy but somehow I can’t figure it out…
Tried google and the forum but can’t seem to find the right example.

found this:

Looking for a similar example or the golden tip! :slight_smile:

I’ve just been through the same process. I wanted to record the scene that was last activated in a room - I have a motion sensor which will set the walk-in scene and a dimmer switch which will set various scenes for more specific use cases. I needed to check the last activated scene to be sure that the motion sensor would not affect the lights once I used the dimmer.

To record the state of an entity I create a helper text:
input_text.steve_s_office_last_scene

Then I can use a node red Call Service node to save the state

To read this back use a Get Entities node
image

Note the output type split - you don’t need a join if there is only one input.

regards
Steve

@stevegroom Thanks will give it a try. Can you share your flow in a private message by any chance? Just to have a example on how it works?

it is done :+1:t2: