Hello,
I think I missed something important to understand the concept.
I read Generic_Thermostat, Climate and other doc, I looked some topics and another websites explaining how they configured their Home Assistant, but I still can’t success in making my automation work. (maybe I have my old Domoticz habit since I switched to Home Assistant 2 days ago).
My server : HomeAssistant core on Raspberry pi
Main hardware : RFXCom
Main devices for my issues : switch on/off on the heater that switch the mode of the heater between eco (7°C celsius) and main mode (19°C celsius).
I added the switches and sensors with success into my configuration.yaml :
rfxtrx:
device: /dev/ttyUSB0
automatic_add: false
debug: true
devices:
# Sensor room
[HIDDEN]:
# Switch room
[HIDDEN]:
My switch being inverted, I made a template :
switch:
- platform: template
switches:
switch_room_inverted:
friendly_name: "Switch Room not inverted"
value_template: "{{ is_state('[HIDDEN]', 'off') }}"
turn_on:
service: switch.turn_off
data:
entity_id: [HIDDEN]
turn_off:
service: switch.turn_on
data:
entity_id: [HIDDEN]
At this time, manually, I used the switch to turn off and off the heater and it works fine.
Then, I discovered the concept of generic thermostat and loved it, so I create one :
- platform: generic_thermostat
name: "Thermostat room"
heater: switch_room_inverted
target_sensor: sensor.room_temperature
min_temp: 18
max_temp: 20
ac_mode: false
target_temp: 19
cold_tolerance: 0.3
hot_tolerance: 0
min_cycle_duration:
seconds: 5
keep_alive:
minutes: 3
initial_hvac_mode: "off"
away_temp: 7
precision: 0.1
So I wanted to automate the turn on during the “night” and turn off during the “day”. I tried many things without success (turn on/off the switch, turn on/off the climate thermostat, set hvac_mode or finally, set_preset_mode), but it never works.
This is my latest attempt :
- id: '[HIDDEN]'
alias: Turn on heater room
description: ''
trigger:
- platform: state
entity_id: climate.thermostat_room
attribute: current_temperature
from: '7'
to: '18'
condition: []
action:
- service: climate.set_preset_mode
data:
preset_mode: none
entity_id: climate.thermostat_room
mode: single
- id: '[HIDDEN]'
alias: Turn off heater room
description: ''
trigger:
- platform: state
entity_id: climate.thermostat_room
attribute: current_temperature
from: '18'
to: '30'
condition: []
action:
- service: climate.set_preset_mode
entity_id: climate.thermostat_room
data:
preset_mode: away
As you can see, I even remove time conditions in order to understand what’s wrong.
What I don’t understand is that, during most of my tests, when I clicked on “Execute” on my automations, it does exactly what I want. This last configuration I show you works great when I click on “Execute” (when I clicked on the “Turn off heater”, the Thermostat goes in “Away mode” and turn off the switch) but it’s never executed automatically.
What do I miss, please ?
Thank you in advance for your help ! Have a good evening