Abort if turned on/off in ST new app


#1

I have a piston which controls the heating in my house. It is very simple as it checks the heat from thermostat and compares it to a configured ideal temperature. If the reported temperature is below that configured temperature it will turn on a Sonoff switch connected to the heat actuator.

What I want to do additionally is to have the option of turning on/off the heating manually by switching the Sonoff switch on/off from within the ST app.

As my piston checks every 5 minutes what the temperature is, it will override my ST override.

So is there a way for me to know in Webcore if a Sonoff switch was turned on or off manually and not by the piston?

Please note that I am not a programmer, but have basic understanding of programming - with focus on basic :smiley:


#2

If I’ve understood your requirements, I think this can be achieved as follows.
I’m not fully aware of the sonoff capabilities, but from what I know, I’m assuming webcore can not receive an event when the sonoff is operated manually?

Create a virtual switch to turn the heating on/off
Within your existing piston add code to turn on the sonoff switch when the VS is turned on. Also set a variable e.g manualOverride =true
Write similar code for the VS being turned off.
Your existing code can then be ignored using an if statement if the manualOverride is true


#3

Thank you Paul, this sounds logical.