Power up condition

I hope this is new and I’m not going over old ground

If you turn a light on - on the ESP8266 - say port 0…and maybe set a PWM output… and lose power = when the device powers back up - it has no idea what state it was in???

That is correct. Currently that is just the way it is. I believe there are plans to save the state of things, but it requires a big amount of developing and code to make that happen.

If you want that I believe for now the only way is by storing the stuff in EEPROM yourself.

Yes, @Lichtsignaal is right. We want it as bad as you all. It seems to be a pretty straightforward thing, but it really requires a lot of work.

But once we implement it, it will open huge opportunities for interface update in general. Imagine hardware can change a graph color, or change icon on the button (when we will have icons on buttons :slight_smile: of course ) It won’t happen in a day, but it’s gonna be cool

Can’t wait to make it happen.

Hi Lichsignaal

Firstly - your reply came in an email to me… with a link which simply does not work and I’m on a normal PC… something wrong with that.

To your reply - yes - understand. Already I’m considering passing all traffic through Node-Red (already have that in operation having figured out how the node-red nodes work) in which case I can store and recall states…

Controlling stuff via your code directly (over which we have no control) will NOT let us store the info in EEPROM - which means using Virtual pins for everything - in which case we can store the state - then control the port - not sure if you give us hooks for that (for example on the ESP8266 you have PWM on a number of pins - if we used Virtual pins clearly our callback routines can store the state of play in EEPROM - but do we then have calls to start the PWM (for example) ourselves?

HI guys, please don’t do that. Embedded systems can’t just resume work after power fail - and i believe it would be bad practice to even allow it. For begginers it would lead to much more problems then it would help to resolve and advanced users would use virtual pins and their own power fail backup anyway.

But What would be really nice if there would be widget serving as external storage.
For beggining FIFO with Vpin for writing and two Vpins for getting amount of data inside and reading.
Or widget for storing exactly one message(e.g serialized state of program)

1 Like

I’m not sure I understand that Chobotnatec… “Embedded systems can’t just resume work after a power fail” - in some cases they can and certainly should. If my Raspberry Pi which runs MQTT server and Node-Red to control my stuff gets a power failure - I expect it to start up and continue to control stuff with as little fuss as possible, If a power glitch hits one of my ESP8266 lighting controllers and it resets - I expect it to restore the lights to their previous condition as soon as possible and continue on as if nothing had happened.

If my NAS drive gets a power failure - long enough to exhaust it’s backup (happens here in rural Spain) - I expect it to start back up - same with the PC - other wise within weeks of me leaving here for a spell in the UK the whole lot would be dead and vice-versa. I have an embedded Arduino controlling the heating at our rental place back in the UK - it has to run and act as normal 24-7-365 otherwise people would freeze. When I remote into it with my phone - I expect the dials on the phone to reflect the actual state of the controller - not what they were last time I used them… and this indeed does happen.

Of course, I could have utterly missed the point here.

Pete.

Leading me to something I commented elsewhere… Advanced users would do their own power fail recovery - as will I - but as far as I can tell there’s no way that I (being the ESP8266 or Node-Red) can tell the APP to change the state of it’s buttons… to reflect the actual state of a powered up unit… I might be wrong.

@scargill saving and restoring states is where i have a problem with node red. it kind of looks like it alls needs saving through a function node in globals. are you using a better way to achieve this?
i really need to have a ‘freeze frame’ of states on node red because that s the only way i can see in which i could be able to use all protocols and devices independent of each other, while also having some nice dashboards and remote controllers.

Right now- saving stuff in Node-Red can be done by sending to a database or using global variables or both. I do talk to the Node-Red guys a lot and have suggested we need better ways to store state - having said that - global vars work just fine - I have dozens of them in my setup. I have an init page which uses a trigger when node-red starts up that goes off an populates initial state of variables - I use it for a touch display to control temperature - - on and off times etc etc… I would clearly like to extend this to use this app to allow me to remotely setup and temperature settings - hence the need for multiple pages and MORE VIRTUAL NUMBERS… the other thing we should request are simple up-down buttons - now you can do that with the existing buttons but they are WAY too big for that. I’ll put a request in.

it s like you are reading my mind :)) i could sure do with some up/down buttons

What i meant is that Android side can’t assume anything about state of the device after reset so any device reset should be handled exactly same on the side of the Android/server as normal startup. I would even prefer that widgets connected to non virtual pins would reset itself when device is reconnected (at least when connecting by “default” method).

I have in my mind kids who download sketch for controlling two pwms, connects Arduino to two servos and will control model cars by it. Imagine you turn on your car after one month and it starts to run intermediately because you forget to stop it when you played with app two weeks ago.

Otherwise it is of course good to have system who is able to recover from power fail :wink: