My heater is integrated in HA via BSB-Lan and a climate-template.
So I have 4 states for it: off - cool - heat - auto
(cool is for the reduced temperature at night)
I want to switch it between cool and heat via Alexa.
So my Idea was to make a input_boolean helper which is mapped via emulated hue to Alexa.
This mapping works fine.
The next Idea was to create an automation to switch the climate-mode according to this helper:
alias: Alexa_Heizung
description: ""
trigger:
- platform: state
entity_id:
- input_boolean.alexa_heizung
from: "off"
to: "on"
- platform: state
entity_id:
- input_boolean.alexa_heizung
from: "on"
to: "off"
condition:
- condition: and
conditions:
- condition: template
value_template: >-
{{ as_timestamp(now()) -
as_timestamp(states.sensor.uptime.last_changed) |
int > 30 }}
alias: Vermeide Auslösen bei Neustart
- condition: not
conditions:
- condition: state
entity_id: climate.heizung_bsb_lan_heizungstherme
state: "off"
alias: Heizung ist nicht AUS (Sommerbetrieb)
action:
- if:
- condition: state
entity_id: input_boolean.alexa_heizung
state: "on"
then:
- service: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: heat
target:
entity_id: climate.heizung_bsb_lan_heizungstherme
else:
- if:
- condition: state
entity_id: input_boolean.alexa_heizung
state: "off"
then:
- service: climate.set_hvac_mode
metadata: {}
data:
hvac_mode: cool
target:
entity_id: climate.heizung_bsb_lan_heizungstherme
mode: single
This also does it’s job.
Now I’m thinking about “how to track the helper when the climate-mode is changed via HA-frontend or thermostat?”
My first idea was to make a second automation which is triggered by the change of climate-state-mode and will switch the helper to “on” if “climate.heizung_bsb_lan_heizungstherme” is “heat” and will switch it off, if the state is “cool”.
I’m sure this will work, even it will trigger the first automation and send the corresponding command a second time
e.g.:
- switch the heater to “heat” by thermostat
- heater will change it’s state to “heat”
- helper “input_boolean.alexa_heizung” will be switched to “on”
- the first automation will recognize the change of the helper and will send a second command “heat” to the heater.
not very nice but it will work.
Does anyone have a more elegant idea of how to avoid the second triggering or how to build the whole thing differently?