Hi all there,
I have a rule where my Danfoss Living Connect Z-Wave radiator thermostat is set to a certain value (23 degrees Celsius) at morning between 5AM and 9AM depending on the weather temperature outside.
When the temperature is above 12 degrees Celsius the thermostat is set to 14 degrees Celsius.
That is all working fine, but I’m struggling to manually override this temperature if I want to have a different temperature.
I tried a variable which is set to true or false, but my programming skills are not sophisticated enough to make it work.
I found some posts with examples for manually overriding certain values but cannot adapt those to my rule …
Here is my original rule without the variable:
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
rule "heating"
when
Item Temperature_FIO received update
then
if (((((new LocalTime().getLocalMillis()) >= (new LocalTime(5, 0, 0, 0).getLocalMillis())) && ((new LocalTime().getLocalMillis()) <= (new LocalTime(9, 0, 0, 0).getLocalMillis()))) && (Temperature_FIO.state <= 12))) {
sendCommand(DanLivConnZSet1, 23)
}
else {
sendCommand(DanLivConnZSet1, 14)
}
end
Then I tried to manual override that rule with a variable, but that doesn’t work:
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
var boolean TemperatureOverride = false
rule "heating"
when
Item Temperature_FIO received update
then
if (((((new LocalTime().getLocalMillis()) >= (new LocalTime(5, 0, 0, 0).getLocalMillis())) && ((new LocalTime().getLocalMillis()) <= (new LocalTime(9, 0, 0, 0).getLocalMillis()))) && (Temperature_FIO.state <= 12) && !TemperatureOverride)) {
sendCommand(DanLivConnZSet1, 23)
TemperatureOverride = false
}
else {
sendCommand(DanLivConnZSet1, 14)
TemperatureOverride = true
}
end
My items are:
Number DanLivConnZSet1 "Heizung Bad [%.1f °C]" <heating> (gTest) { zwave="8:command=thermostat_setpoint,setpoint_type=1,setpoint_scale=0" }
Number Temperature_FIO "Temperatur [%.0f °C]" <temperature> (gTest) { weather="locationId=home_fio, type=temperature, property=current" }
sitemap setpoint for manually set the temperature:
Setpoint item=DanLivConnZSet1 minValue=4 maxValue=30 step=1
Any hints in the right direction?
Thx in advance