Trying to restore previous switch state after Node-RED restart.

Home Assistant automation projects, questions, etc. go here.
Post Reply
SargeOG
LED-Curious
LED-Curious
Reactions:
Posts: 6
Joined: Tue Feb 02, 2021 1:05 pm

Everytime I restart HA or Node-red the switch for the light goes to OFF, even if before restart it was on. This is an issue many of you fine people I believe have resolved.

I added this to the node-red settings.js:

Code: Select all

contextStorage: {
   default: "memoryOnly",
   memoryOnly: { module: 'memory' },
   file: { module: 'localfilesystem' }
}
But from here I'm kinda lost... I don't really know how to integrate it to my flow.

Attached is my current flow for the light schedule, It's in romanian btw.


If anyone can point me in the right direction, that would be awesome!

Thanks!
Attachments
Capture.JPG
User avatar
LEDG
Site Admin
Reactions:
Posts: 1599
Joined: Sun Jun 04, 2017 8:15 pm

Is it just the feedback for the switch that's showing off, or is the light actually turning off?
Want to Support the Site?

Use this Amazon referral link and any purchase you make within 24 hrs will earn LEDgardener a commission at no cost to you!
SargeOG
LED-Curious
LED-Curious
Reactions:
Posts: 6
Joined: Tue Feb 02, 2021 1:05 pm

@LEDG The actual light is turning off. But I must clarify, this happens when I hard reset Home assistant, meaning when I unplug the raspberry and plug it back in, and also whenever I deploy Node-RED. So not when I restart the server.

I want to resolve this in case I ever get an electricity shortage, as when it gets back in, the light is ON by itself as I may not be at home or something to start it... It's really bugging me out.
Post Reply