Toggling a global state variable from app or dashboard

So, by following tutorials and forum threads i have been able to create a rule that controls electric heating in my house using Netatmo temperature sensors and Wemo insight switches.

The rule goes something like this

If hourofday < 5
turn off heating
else
if temperature < 22.9
turn on heating
else if temperature > 23
turn off heating

So, very baseline stuff.
But, next step for me is to create some sort of HeatingMode state along with a WantedTemperatureOverride so that i can choose to override the temperature lets say if i am going to be away for some days.

My pseudocode would look something like this

HeatingMode = Auto
WantedTemperatureOverride= 16

If HeatingMode = Auto
If hourofday < 5
turn off heating
else
if temperature < 22.9
turn on heating
else if temperature > 23
turn off heating

Else
if temperature < WantedTemperatureOverride - 0.1
turn on heating
else if temperature > WantedTemperatureOverride
turn off heating

So my question is obviously, how could i implement my two global variables and make them possible to manipulate manually so that they work in my rule?

Simple (when you know how :slight_smile: ) - just create a couple of virtual items - i.e. items in your *.items file which have no bindings. Looks like you probably need a couple of Numbers, one for your heating mode and one for the wanted temp override. Then you can add these items to your sitemap and access them in your rules. You can also persist their values and thus ensure they are restored after a restart.

Using virtual items like this is very powerful, I use them a lot for exactly the sort of thing you are describing above.