I struggling with myself - I am trying to create a rule for the heater in the bedroom. So If I open the balcony door in the morning to get fresh air I want to reduce the targetTemperature of the heater thermostat.
In myRules I created a global variable so that I can save the value if I open the door
var Number heaterTemp = null
The code of the two rules open and close look like this:
rule "lower heater in bedroom if door is open" when Item Balkonture_OpenClose changed from CLOSED to OPEN then logInfo("DoorOpenRule", Balkonture_OpenClose.state.toString) heaterTemp = HeizkorperSchlafzimmer_ActualTemperature logInfo("DoorOpenRule", heaterTemp.state.toString) sendCommand(HeizkorperSchlafzimmer_SetTemperature,5) end rule "reactivate heater in bedroom when door is closed" when Item Balkonture_OpenClose changed from OPEN to CLOSED then logInfo("DoorCloseRule",Balkonture_OpenClose.state.toString) sendCommand(HeizkorperSchlafzimmer_SetTemperature,heaterTemp) end
I am not able to see the logInfo because the state.toString is not working
If I comment out all the logInfo the rule is running into an issue if I set the temperature back to the one of the var heaterTemp