Extend 'pulse' to allow OFF when current below threshold#2159
Conversation
|
I realise that I have not extended the "reboot" persistence/restoration for the current setting - behaviour may be unexpected I suspect as the ON/OFF state may be persisted and restored, but not the limit or the "state". This should be done too |
|
Nice idea. I think there were some issues mentioning this use-case for this sort of thing, but other way around - when values are too high turn relay off. Not sure there was any issues regarding turning relay off when consumption drops. For persistence, take a look at the relay module methods at the top of the file. Rtcmem is a basic struct that is mapped to a specific region of RAM that is never erased on reboots. getSetting / setSetting are self-explanatory. As mentioned in gitter, to use rpn here we would need variable to store the counter, so some kind of variable manipulation needs to happen first (as there is none atm, push, pop, peek at the very least) e.g. Operator registration is very straightforward. But, I need to remember to implement this. |
|
"I do not think pulse is a way to go though, but it is a creative approach :)" <- It is the lazy approach! As I said I started with something that would work for me only .. this was simplest: though abusing the "pulse" command in particular changing the meaning of its parameter is decidedly suspect .... |
Speculative PR: this may or may not be acceptable, looking for comment really.
If the principle is accepted then I would be pleased to make any necessary changes for merge; if not, that's fine - I did it for me in the first place!