I have had a long working DIY thermostat using the Thermostat Climate Controller. Initially I built this with a local Dallas sensor but realised it was impossible to calibrate. Instead I used an external temperature sensor which I am presenting to the esphome device. This has been working fine however if there is an issue with Home Assistant or MQTT then Esphome does not get the sensor data and consequently I am unable to physically control the heating.
I have been trying to add some additional logic that will check the value of the Home Assistant sensor is greater than 5, if not then instead use the local Dallas sensor within the thermostat. The reason why I am not using the Dallas sensor is it suffers from heat creep and is often 7 degrees higher than what the temperature is, unfortunately the difference isnt linear either, I originally tried to calibrate using various filters in esphome but using an external sensor was much easier and more reliable.
This is my HA sensor presented to Esphome:
- platform: homeassistant
entity_id: sensor.hallway_temperature
id: thermostat_temp
This is my local Dallas sensor on the climate device:
- platform: dallas_temp
update_interval: 3s
id: internal_temperature
name: Climate_Internal
address: 0x333c01d6075d6028
Currently I have something like this as a template sensor, but it isnt doing what I was expecting. It should in my head be assessing whether the thermostat_temp data sent from HA is greater than 5, if it is return that sensor state, else return the internal Dallas sensor state. Is this correct?
- platform: template
name: "Hallway Temperature"
id: testtemp
lambda: |-
if (id(thermostat_temp).state > 5 ) {
return id(thermostat_temp).state;
} else {
return id(internal_temperature).state;
}:
Any help with this would be greatly appreciated of there is a simpler way to do this that would be great. All I want to do is be able to control the device when there is no comms from Home Assistant.