So I apologize if this has already been discussed and beaten to a dead horse but just trying to figure this out. Since we just had our first cold snap hit CO, I noticed today that my thermostat is running in away mode. Not a big deal because I have a wood stove but I still like to have the furnace take over just in case I forget to stoke the fire or I over sleep.
My script was working great last year but now its just floping over to my away settings.
Here is my info from the apps.yaml
thermostat_control_home_weekday:
module: thermostat_control
class: thermostat_control
ACTempID: 72
HeatTempID: 68
constrain_start_time: "08:30:00"
constrain_end_time: "22:00:00"
constrain_presence: anyone
constrain_days: "mon,tue,wed,thu,fri"
thermostat_control_home_weekend:
module: thermostat_control
class: thermostat_control
ACTempID: 72
HeatTempID: 68
constrain_start_time: "08:30:00"
constrain_end_time: "22:00:00"
constrain_presence: anyone
constrain_days: "sat,sun"
thermostat_control_night_time_weekday:
module: thermostat_control
class: thermostat_control
ACTempID: 72
HeatTempID: 62
constrain_start_time: "00:00:00"
constrain_end_time: "08:30:00"
constrain_presence: anyone
constrain_days: "mon,tue,wed,thu,fri"
thermostat_control_night_time_weekend:
module: thermostat_control
class: thermostat_control
ACTempID: 72
HeatTempID: 62
constrain_start_time: "00:00:00"
constrain_end_time: "08:30:00"
constrain_presence: anyone
constrain_days: "sat,sun"
thermostat_control_away:
module: thermostat_control
class: thermostat_control
ACTempID: 72
HeatTempID: 62
constrain_presence: noone
Far as I can tell I’m following the docs properly and what not.
What did you change in your system when it stopped working? Did you update HA or AppDaemon? Do you see any errors in the log?
I haven’t changed anything, I just noticed in the logs today that its running in away mode as you can see from my splunk of the log
Thanks for the help
When was the last time it worked? Can you please post the thermostat_control app code?
I’d say the last time it worked would’ve been in April or May when we had our last cold snap.
Behold the code. Its simple but gets the job done.
import appdaemon.plugins.hass.hassapi as hass
import datetime
import time
class thermostat_control(hass.Hass):
def initialize(self):
self.thermostat_cool = 'climate.honeywell_unknown_type_0011_id_0003_cooling_1'
self.thermostat_heat = 'climate.honeywell_unknown_type_0011_id_0003_heating_1'
self.outside_temp = 'sensor.dark_sky_temperature'
self.presence = 'group.all_persons'
self.run_every(self.whole_house_thermost_control_cb, datetime.datetime.now(), 15*60)
self.listen_state(self.set_fan_state_auto_low, "climate.honeywell_unknown_type_0011_id_0003_cooling_1", attribute = "fan_mode", new = "Circulate")
def whole_house_thermost_control_cb(self, kwargs):
outside_temp_float=float(self.get_state(self.outside_temp))
self.log("Checking the thermostat state")
self.log("The current outside temp is {}".format(outside_temp_float))
currentMonth = datetime.datetime.now().month
if outside_temp_float >= 70 and 4 <= currentMonth <= 9:
if self.get_state(self.thermostat_cool) != "cool":
self.log("Turning on the AC")
self.call_service("climate/set_hvac_mode", entity_id=self.thermostat_cool, hvac_mode = "cool")
if self.get_state(self.thermostat_cool, attribute="temperature") != self.args["ACTempID"]:
self.log("The thermostat temp is not equal to the set point so we're going to adjust it")
self.call_service("climate/set_temperature", entity_id = self.thermostat_cool, temperature = (self.args["ACTempID"]))
elif outside_temp_float >= 75 and (1 <= currentMonth <= 3 or 10 <= currentMonth <= 12):
if self.get_state(self.thermostat_cool) != "cool":
self.log("Turning on the AC")
self.call_service("climate/set_hvac_mode", entity_id=self.thermostat_cool, hvac_mode = "cool")
if self.get_state(self.thermostat_cool, attribute="temperature") != self.args["ACTempID"]:
self.log("The thermostat temp is not equal to the set point so we're going to adjust it")
self.call_service("climate/set_temperature", entity_id = self.thermostat_cool, temperature = (self.args["ACTempID"]))
elif outside_temp_float <= 35:
if self.get_state(self.thermostat_heat) != "heat":
self.log("Turning on the heat")
self.call_service("climate/set_hvac_mode", entity_id = self.thermostat_heat, hvac_mode = "heat")
if self.get_state(self.thermostat_heat, attribute="temperature") != self.args["HeatTempID"]:
self.log("The thermostat temp is not equal to the set point so we're going to adjust it")
self.call_service("climate/set_temperature", entity_id = self.thermostat_heat, temperature = (self.args["HeatTempID"]))
else:
if self.get_state(self.thermostat_cool) != "off":
self.log("Turning off the thermostat AC")
self.call_service("climate/set_hvac_mode", entity_id = self.thermostat_cool, hvac_mode = "off")
if self.get_state(self.thermostat_heat) != "off":
self.log("Turning off the thermostat Heat")
self.call_service("climate/set_hvac_mode", entity_id = self.thermostat_heat, hvac_mode = "off")
def set_fan_state_auto_low(self, kwargs):
self.log("The fan mode on the thermostat was set to Circulate so we're going to fix that.")
self.call_service("climate/set_fan_mode", entity_id = self.thermostat_cool, fan_mode = "Auto Low")
And you didn’t update your system since April? What version of AppDaemon and Home Assistant are you using?
Oh yes I am on HA 99.3 and the latest appdaemon as I have watchtower running and it pulls down the new versions. Yeah its dangerous but I like to live on the edge a little.
Correction I am now on 0.100.1
Phuu but then there changed a lot since the last time you know it worked.
I will take a look at the code and probably come back with some questions.
1 Like
How many device trackers do you have? What is the state of these device trackers?
Figured it out, turns out I had an issue with my device tracker configurations. I had to remove the unifi stuff from my configuration.yaml (Honestly I thought I had done this already, and migrated to integrations) well its done now and viloa everything is working as it should. Good HA. Thanks @Burningstone for your assistance with this.
To answer your question I have 2 persons with 4 device trackers (wifi and gmaps per person)
Glad that I was able to help you to help yourself
1 Like
Hahaha I’ll mark that as my solution any day.