fsadak
(Fikret Sadak)
November 18, 2022, 1:47am
1
This is my boiler control automation. The codes works well but if i add +/-3 math it doesnt work. No compile error but relay doesnt work. I want to add extra tolerance for set temperature.
alias: Boiler
trigger:
- platform: state
entity_id: input_number.settemp
action:
- service_template: >
{% if states("sensor.livingroom_temperature") >=
states("input_number.settemp") + 3 %}
switch.turn_on
{% endif %} {% if states("sensor.livingroom_temperature") <=
states("input_number.settemp") - 3 %}
switch.turn_off
{% endif %}
entity_id: switch.kombi_relay
States are always strings. To use them in mathematical expressions you need to use a filter to make them into a number. Usually either float
or int
So for example your first if statement needs to be this:
{% if states("sensor.livingroom_temperature") | float >=
states("input_number.settemp") | float + 3 %}
1 Like
finity
November 18, 2022, 5:16am
3
and you don’t use “service_template” anymore. just use “service”.
fsadak
(Fikret Sadak)
November 18, 2022, 10:55am
4
Thank you very much. Problem solved…
123
(Taras)
November 18, 2022, 12:40pm
5
Why not use the Generic Thermostat integration?
Set the hot_tolerance
and cold_tolerance
options to 3
and it will satisfy your requirements for a +/-3 degree deadband.
1 Like
fsadak
(Fikret Sadak)
November 18, 2022, 12:45pm
6
Thank you for your reply. I am very new with HomeAssistant and trying to discover it’s functions. I’ll try your advice as soon as possible…
fsadak
(Fikret Sadak)
November 18, 2022, 12:49pm
7
I got this message. How can i start for adding the Generic Theremostat?
Thanks…
123
(Taras)
November 18, 2022, 12:51pm
8
The instructions are in the displayed message: "add this device by adding it to your configuration.yaml
". Refer to the documentation link I posted above for more information.
For your case, the configuration of the Generic Thermostat will look something like this:
climate:
- platform: generic_thermostat
name: Living Room
heater: switch.kombi_relay
target_sensor: sensor.livingroom_temperature
min_temp: 15
max_temp: 25
ac_mode: false
target_temp: 21
cold_tolerance: 3
hot_tolerance: 3
min_cycle_duration:
seconds: 60
keep_alive:
minutes: 3
initial_hvac_mode: "off"
away_temp: 16
fsadak
(Fikret Sadak)
November 18, 2022, 2:23pm
9
Ok i added the codes to the configuration.yaml file but now? There is no card about Generic Thermostat for adding to the dashboard. Sorry for my dumb question but i really new in this system…
123
(Taras)
November 18, 2022, 3:11pm
10
Just to confirm, did you restart Home Assistant after you made the changes to the configuration.yaml
file?
123
(Taras)
November 18, 2022, 5:49pm
12
Then you should have a new entity called climate.living_room
which you can add to a Dashboard using a Thermostat card.
fsadak
(Fikret Sadak)
November 18, 2022, 8:42pm
13
Thank you for your help. I did it…