I’ve been trying with home assistant for a time, on a Rpi 3 with hassio.
I’m testing Generic Thermostat (climate) component for myself.
It works fine. The base hardware is a Wemos D1 mini with Espeasy 2.0 firmware, sensor is SHT30 and there is a relay atached to its GPIO. The communication between HA and the esp8266 module is MQTT (I use mosquito).
All the things works stable (except when I try new things )
In the next phase I would like to attach an oled display to the esp to show the target temperature and the sensors temp and humidity readings. I think it will be easy when the display arrives from china
And here comes my question:
I would like to add two phisical buttons to esp8266 to increase and decrease the target temperature.
I already have these buttons, and I can see the changes in HA.
But how can I incude the increase/decrease in HA?
In climate services there is the climate.set_temperature but it can be used only with exact temperatuse.
I just don’t know what to write to the script to increase/decrease.
Now this is a srcipt I’m trying:
Yes, I tought that this is the solution.
The problem is that I’m too dumb to do this.
I’ve read the templating page on home assistan page, but it’s not for beginners
You’re certainly on the right lines. There is a similar action at the bottom of this documentation page:
Have you tried putting {{ states.climate.halo.attributes.temperature | float + 1 }} into the Template page in HA to ensure a valid value is returned?
Also, it may be worth trying int instead of float as the component appears to be expecting whole numbers. I don’t think this will fix the issue raised, but it may well prevent another one.
If you have done everything right you have a thermostat where you read the temperature from a sensor wired to the d1 mini, and you can control an output on the mini with it.
If you want to use hardwired buttons at the d1 mini to increase/decrease the temperature you can use sime lines like these:
automations
- alias: "Target temp +1"
trigger:
platform: state
entity_id: binary_sensor.esp_up <- this is the increase buttons mqtt sensor entity name so change it to yours
from: 'off'
to: 'on'
action:
service: climate.set_temperature
data_template:
entity_id: climate.halo
temperature: '{{ states.climate.halo.attributes.temperature | float + 1 }}'
- alias: "Háló termosztát -1°C"
trigger:
platform: state
entity_id: binary_sensor.esp_down <- this is the decrease buttons mqtt sensor entity name so change it to yours
from: 'off'
to: 'on'
action:
service: climate.set_temperature
data_template:
entity_id: climate.halo
temperature: '{{ states.climate.halo.attributes.temperature | float - 1 }}'
Where you read climate.halo there you have to write your thermostat entity name.
After this if you push increase/decrease button, the terget temperature will change.
I found one tiny problem with this setup. If you pressing buttuns too fast when the HASS sends the d1 mini command to “turn ON” the output, the d1 mini can freeze. But after a warm boot it will be in the wanted state. It can be avoided if you press the buttons slow.