Write event to persistence switch

Hi,

On my flow I want to check if a switch in my home is on.
The switch send event ON or OFF once its triggered.

How should I do that ? write that even to variable and check the variable ? will this variable reset on each deployment ?

What i'm trying to do is check if lights needed with sun elevation, if dark enough, check if lights already on manually by wall switch, if not, turn them on.
So I need to be able to determine if lights are on already, I can't check them becuase they report on MQTT once and do not keep state.

You could definitely store it in a context variable:


If you want the variable to be persisted across restarts of nodered you will need to add file system based context storage which is also described in the link above further down.

Johannes

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.