Weird crap! with my HVAC and Openhab


(Chase Mixon) #1

So I have this rule setup and it seems to work but then when I look at the logs, I see this?
it is setting the temp correctly but then putting it right back to the original temp??? can anyone help with why this is happening?

2018-04-12 08:53:00.695 [ome.event.ItemCommandEvent] - Item ‘HVAC_HeatSetPoint’ received command 55
2018-04-12 08:53:00.696 [ome.event.ItemCommandEvent] - Item ‘HVAC_CoolSetPoint’ received command 80
2018-04-12 08:53:00.699 [vent.ItemStateChangedEvent] - HVAC_CoolSetPoint changed from 74 to 80
2018-04-12 08:53:02.151 [vent.ItemStateChangedEvent] - HVAC_CoolSetPoint changed from 80 to 74

rule "Away Temp"
when
        Time cron "0 53 8 ? * * *"
then
        if (Chase_iPhone_Home.state==ON || Tracy_iPhone_Home.state==ON || Cale_iPhone_Home.state==ON)
        {
        sendCommand(HVAC_HeatSetPoint,66)
        sendCommand(HVAC_CoolSetPoint,76)
        logInfo("HVAC Settings", "Someone is Home-Away Rule "+ HVAC_HeatSetPoint + " " + HVAC_CoolSetPoint)
        }
        else
        {
        sendCommand(HVAC_HeatSetPoint,55)
        sendCommand(HVAC_CoolSetPoint,80)
        logInfo("HVAC Settings", "Someone is NOT Home-Away Rule "+ HVAC_HeatSetPoint + " " + HVAC_CoolSetPoint)
        }
end


(hr2) #2

Please post the item-definition for HVAC_CoolSetPoint.
Do you use this item in other rules?


(hr2) #3

I think, to see the loginfo in the log you should change

logInfo("HVAC Settings", "Someone is Home-Away Rule "+ HVAC_HeatSetPoint.state.toString + " " + HVAC_CoolSetPoint.state.toString)
logInfo("HVAC Settings", "Someone is NOT Home-Away Rule "+ HVAC_HeatSetPoint.state.toString + " " + HVAC_CoolSetPoint.state.toString)

or

then
    var tmp = ""
    if (Chase_iPhone_Home.state==ON || Tracy_iPhone_Home.state==ON || Cale_iPhone_Home.state==ON) {
        HVAC_HeatSetPoint.sendCommand(66)
        HVAC_CoolSetPoint.sendCommand(76)
    } else {
        HVAC_HeatSetPoint.sendCommand(55)
        HVAC_CoolSetPoint.sendCommand(80)
        tmp = "NOT "
    }
    logInfo("HVAC Settings", "Someone is " + tmp + "Home-Away Rule "+ HVAC_HeatSetPoint.state.toString + " " + HVAC_CoolSetPoint.state.toString)
end

(Rich Koshak) #4

Indeed, we need to see the Item definition and perhaps more information about what binding is connected to this Item. To me from the logs it looks like the binding might be setting the Item back after your rule runs.


(Thomas Binder) #5

@chasemixon: I also think you have to post your item - but please can you change the thread name to something more specific?


(Chase Mixon) #6

Ok here is is the items file

and pretty much all my rules, I did change the gps location of my house…lol but other than that this is most of it. I really appreciate you guys helping like this! @rlkoshak I see you on a lot of threads lending your wisdom! and I must say you are an inspiration sir! Sorry @binderth I changed the name hope that’s ok… :slight_smile:

//Thermostat
Number HVAC_HeatSetPoint        "Heat Set [%.1f F]"                            <thermostat>    (ALL,HVAC)
Number HVAC_CoolSetPoint        "Cool Set [%.1f F]"                            <thermostat>    (ALL,HVAC)
Number HVAC_Temperature         "Thermostat temperature [%.1f °F]"             <temperature>   (ALL,HVAC,ff)
Number HVAC_Mode                "Mode [MAP(thermostatMode.map):%s]"            <climate>       (ALL,HVAC)
Number HVAC_Fan_Mode            "Fan Mode [MAP(thermostatFanMode.map):%s]"                     (ALL,HVAC)
Number HVAC_Operating_State     "Operation State [MAP(thermostatOpState.map):%s]"              (ALL,HVAC)
Number HVAC_Fan_State           "Fan State [MAP(thermostatFanState.map):%s]"                   (ALL,HVAC)
Number HVAC_Battery             "Thermostat battery [%d %%]"                   <battery>       (ALL,HVAC,battery)

rule "Bedtime Temp"
when
        Time cron "0 0 21 ? * * *"
then
	if (Chase_iPhone_Home.state==ON || Tracy_iPhone_Home.state==ON || Cale_iPhone_Home.state==ON)
	{
	sendCommand(HVAC_HeatSetPoint,65)
	sendCommand(HVAC_CoolSetPoint,73)
	logInfo("HVAC Settings", "Someone is Home-Bedtime Rule "+ HVAC_HeatSetPoint.state + " " + HVAC_CoolSetPoint.state)
	}
	else
	{
	sendCommand(HVAC_HeatSetPoint,55)
	sendCommand(HVAC_CoolSetPoint,80)
	logInfo("HVAC Settings", "Someone is NOT Home-Bedtime Rule "+ HVAC_HeatSetPoint.state + " " + HVAC_CoolSetPoint.state)
	}
end

rule "Wakeup Temp"
when
        Time cron "0 20 5 ? * * *"
then
	if (Chase_iPhone_Home.state==ON || Tracy_iPhone_Home.state==ON ||Cale_iPhone_Home.state==ON)
	{
	sendCommand(HVAC_HeatSetPoint,70)
	sendCommand(HVAC_CoolSetPoint,74)
        logInfo("HVAC Settings", "Someone is Home-Wakeup Rule "+ HVAC_HeatSetPoint.state + " " + HVAC_CoolSetPoint.state)
	}
	else
	{
	sendCommand(HVAC_HeatSetPoint,55)
	sendCommand(HVAC_CoolSetPoint,80)
        logInfo("HVAC Settings", "Someone is NOT Home-Wakeup Rule "+ HVAC_HeatSetPoint.state + " " + HVAC_CoolSetPoint.state)
	}
end


rule "Away Temp"
when
	Time cron "0 53 8 ? * * *"
then
	if (Chase_iPhone_Home.state==ON || Tracy_iPhone_Home.state==ON || Cale_iPhone_Home.state==ON)
	{
	sendCommand(HVAC_HeatSetPoint,66)
	sendCommand(HVAC_CoolSetPoint,76)
        logInfo("HVAC Settings", "Someone is Home-Away Rule "+ HVAC_HeatSetPoint + " " + HVAC_CoolSetPoint)
	}
	else
	{
	sendCommand(HVAC_HeatSetPoint,55)
	sendCommand(HVAC_CoolSetPoint,80)
        logInfo("HVAC Settings", "Someone is NOT Home-Away Rule "+ HVAC_HeatSetPoint + " " + HVAC_CoolSetPoint)
	}
end

rule "Afternoon Temp"
when
        Time cron "0 0 17 ? * * *"
then
	if (Chase_iPhone_Home==ON || Tracy_iPhone_Home==ON || Cale_iPhone_Home==ON)
	{
	sendCommand(HVAC_HeatSetPoint,66)
	sendCommand(HVAC_CoolSetPoint,76)
        logInfo("HVAC Settings", "Someone is Home-Afternoon "+ HVAC_HeatSetPoint + " " + HVAC_CoolSetPoint)
	}
	else
	{
	sendCommand(HVAC_HeatSetPoint,55)
	sendCommand(HVAC_CoolSetPoint,80)
        logInfo("HVAC Settings", "Someone is NOT Home-Afternoon "+ HVAC_HeatSetPoint + " " + HVAC_CoolSetPoint)
	}
end

rule "Returning Home"
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
        sendCommand(HVAC_HeatSetPoint,66)
        sendCommand(HVAC_CoolSetPoint,76)
        logInfo("HVAC Settings", "Someone is Home-Returning "+ HVAC_HeatSetPoint.state + " " + HVAC_CoolSetPoint.state)
end


rule "Sunset rule"
when
	Channel 'astro:sun:local:set#event' triggered START
then
	sunset.postUpdate(ON)
end

rule "Turn On lights-Chase"
when
	Item Chase_iPhone_Home changed from OFF to ON
then
	if (sunset.state==ON)
	{
	sendCommand(PorchLight, ON)
	sendCommand(LED_Power,ON)
	Light_Color.sendCommand("1,0,100") // White
	}
end


rule "Turn On lights-Tracy"
when
        Item Tracy_iPhone_Home changed from OFF to ON
then
        if (sunset.state==ON)
        {
        sendCommand(PorchLight, ON)
        sendCommand(LED_Power,ON)
        Light_Color.sendCommand("1,0,100") // White
        }
end


rule "Turn On lights-Cale"
when
        Item Cale_iPhone_Home changed from OFF to ON
then
        if (sunset.state==ON)
        {
        sendCommand(PorchLight, ON)
        sendCommand(LED_Power,ON)
        Light_Color.sendCommand("1,0,100") // White
        }
end


rule "Bedtime rule"
when
	Time cron "0 1 21 ? * *"
then
	if (LED_Power.state==OFF)
	{
	sendCommand(LED_Power,ON)
	Light_Color.sendCommand("1,100,5") //Red 5%   Color,Saturation,Brightness
	logInfo("LED_Power", "LED_Power if " + LED_Power.state)
	}
	Light_Color.sendCommand("1,100,5") //Red 5%   Color,Saturation,Brightness
	logInfo("LED_Power", "LED_Power " + LED_Power.state)
end


rule "Sunrise rule"
when
    Channel 'astro:sun:local:rise#event' triggered START
then
	sunset.postUpdate(OFF)
	sendCommand(LED_Power, OFF)
//	Light_Color.sendCommand("1,0,100") 
// White
end


rule "Chase_iPhone Home"
when
    Item Chase_iPhone_Location changed
then
	val PointType home_location  = new PointType(new DecimalType(1.0000000000), new DecimalType(2.000000000))
	val PointType phone_location = Chase_iPhone_Location.state as PointType
	val int distance = phone_location.distanceFrom(home_location).intValue()
	// specify your preferred radius (in meters)
	if ( distance < 8500)
	{
		Chase_iPhone_Home.postUpdate(ON)
//		logInfo("Chase Distace", "Chase Distace " + distance)
	}
	else
	{
		Chase_iPhone_Home.postUpdate(OFF)
//		logInfo("Chase Distace", "Chase Distace " + distance)
	}
end


(Vincent Regaud) #7

What binding are you using for your HVAC items?


(Rich Koshak) #8

Can you How to use code fences

Are those the complete Item definitions? What binding do you use to control your HVAC?


(Chase Mixon) #9

zwave binding, sorry about that…
and yes, I think that is the complete Item definitions… not sure what you are asking…


(Chase Mixon) #10

I guess the code fences don’t like to many line spaces… I promise I tried to put them in there… edited and it should be good now… #FacePalm


(Rich Koshak) #11

Ok, it doesn’t explain the behavior your are seeing but I would expect to see a {channel=“zwave:device: something: nodeN: something”} for the items connected to your zwave device.

I don’t see anything obvious in your rules that would cause the bailee to be reset so the lead suspect is still the device itself. What is the device?


(Chase Mixon) #12

I’m not sure I understand what you are asking… are you asking what make/model of thermostat?
Remotec zts-110
or are you asking for thing part of it?
maybe I didn’t set it up right, here’s what I did
created items based on google search for that device
after I searched for z-wave devices it found this thermostat, made a thing
inside the thing, I linked each of the properties to my items that I had created in the items file
sensor(temp)
mode(a/c,heat,off,auto)
state(heating, cooling)
setpoint(cool)
setpoint(heat)
fanmode(auto,on)
fanstate(idle,running)
battery


(Rich Koshak) #13

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

(Chase Mixon) #14

well, after finally finding out how to get to the channel stuff to map the items in the items file I thought I had it licked, but it seems it’s back. everything works except the rules. I can adjust the temp with the openhab app, but when a rule sets the temp, it goes back to the previous temp… only for the cool side best I can tell… Odd isn’t it? oh well, I have troubled you people enough. Thanks so much for helping me. Probably just a crappy thermostat.