button pressed vs script activating

Moderator: leecollings

Post Reply
fireport
Posts: 27
Joined: Friday 03 January 2020 21:14
Target OS: Linux
Domoticz version:
Contact:

button pressed vs script activating

Post 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
Attachments
Cattura.PNG
Cattura.PNG (17.83 KiB) Viewed 470 times
wouterlet
Posts: 109
Joined: Tuesday 02 October 2018 20:52
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: button pressed vs script activating

Post 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
fireport
Posts: 27
Joined: Friday 03 January 2020 21:14
Target OS: Linux
Domoticz version:
Contact:

Re: button pressed vs script activating

Post by fireport »

How can I set a user variable when i push the button on sonoff?
Thanks
fireport
Posts: 27
Joined: Friday 03 January 2020 21:14
Target OS: Linux
Domoticz version:
Contact:

button pressed vs script activated [SOLVED]

Post by fireport »

I solved with this script
Cattura.PNG
Cattura.PNG (25.57 KiB) Viewed 406 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest