Weird crap! with my HVAC and Openhab

I don’t think you can do it like that. If you define an item in a .items file you must link the item to the channel in the .items file, not through PaperUI.

So what I think is happening is that the links are not complete or not working correctly. So when you sendCommand with the new setpoint that value never goes out to the device and when the Zwave binding has it’s next poll of the device states the Item gets set back to the value on the device.

So first remove the link you made through PaperUI and add the link in the .items file.

https://docs.openhab.org/configuration/items.html#text-file-linking

Even if this isn’t the problem, doing this will eliminate it as a possibility.

Now for the rules over all.

I recommend applying Design Pattern: Time Of Day as a start and also applying Generic Presence Detection.

These two will let you collapse your rules down by at least half.

I’m just typing this in so there will likely be errors. I’m not going to reproduce the code you will find in the links above. Look at those write-ups for the code and details.

rule "Set target temps"
when
    Item TimeOfDay changed
then
    if(Present.state != ON) return; // do nothing if no one is present

    var heatSP = 55
    var coolSP = 80
    switch TimeOfDay.state.toString {
        case "BEDTIME":   { heatSP = 65; coolSP = 73 }
        case "WAKEUP":    { heatSP = 70; coolSP = 74 }
        case "AWAY":      { heatSP = 66; coolSP = 76 }
        case "AFTERNOON": { heatSP = 66; coolSP = 76 } 
    }

    if(HVAC_HeatSetPoint.state != heatSP) HVAC_HeatSetPoint.sendCommand(heatSP)
    if(HVAC_CoolSetPoint.state != coolSP) HVAC_CoolSetPoint.sendCommand(coolSP)
end

rule "Home/Away Temp"
when
    Item Present changed from OFF to ON or
    Item Present changed from ON to OFF
then
    var heatSP = if(Present.state == OFF) 55 else 66
    var coolSP = if(Present.state == OFF) 80 else 76

    if(HVAC_HeatSetPoint.state != heatSP) HVAC_HeatSetPoint.sendCommand(heatSP)
    if(HVAC_CoolSetPoint.state != coolSP) HVAC_CoolSetPoint.sendCommand(coolSP)
end

// Sunset rule is not needed, see Time of Day DP

rule "Turn On Lights"
when
    Item Chase_iPhone_Home changed from OFF to ON or
    Item Tracy_iPhone_Home changed from OFF to ON or
    Item Cale_iPhone_Home changed from OFF to ON
then
    if(TimeOfDay.state != "BEDTIME") {
        PorchLight.sendCommand(ON)
        LED_Power.sendCommand(ON)
        Light_Color.sendCommand("1,0,100") // white
    }
end

rule "Bedtime Lights"
when
    Item TimeOfDay changed
then
    if(TimeOfDay.state != "BEDTIME") return;

    if(LED_Power.state == OFF) LED_Power.sendCommand(ON)
    Light_Color.sendCommand("1,100,5") // Red 5% 
end

rule "Sunrise Lights"
when
    Item TimeOfDay changed
then
    LED_Power.sendCommand(OFF)
end
1 Like