Page 1 of 1

button pressed vs script activating

Posted: Friday 08 May 2020 13:43
by fireport
I have a blocky script than activate/deactivate a venting fan based on humidity value. The script works ok but I would like to override this behavior pushing the sonoff basic button that controls the fan. So, if I will press the button the fan should stay on until I will press the button again despite humidity level.
Sonoff is connected to a Mosquitto server
Any idea ?
Many thanks in advance

Image

Re: button pressed vs script activating

Posted: Friday 08 May 2020 22:32
by wouterlet
You could use a user variable:

If you push the burron the fan goed on and sets the user variable to 1. Of you push it to go off then make the variable 0.
In your existing scripts you add user variable = 0 to the if and elseif

Re: button pressed vs script activating

Posted: Saturday 09 May 2020 17:21
by fireport
How can I set a user variable when i push the button on sonoff?
Thanks

button pressed vs script activated [SOLVED]

Posted: Wednesday 13 May 2020 15:31
by fireport
I solved with this script
Cattura.PNG
Cattura.PNG (25.57 KiB) Viewed 411 times
and this rule in tasmota
rule1 on Button1#state=2 do backlog publish domoticz/in {"command":"setuservariable","idx":4,"value":"2"}; POWER TOGGLE ENDON
where idx 4 is ID of variable stato_cappa