Hi all!
I created a script to trigger heating water during the cheapest hour of the day.
For this I have a sensor which is on during that hour and use the Bosch SHC integration for changing water heater mode and temperature. I select the water temperature based on electricity costs.
The script is triggered once an hour when the electricity prices change.
Here is the problem:
I can change the heater mode and temperature through the interface (see below) but when the script runs, even if everything seems fine the changes don’t apply. What did I do wrong in my script?
The change of mode setpoint for both the hot water and the cheapest hour sensor:
And the script:
alias: IVT Water
sequence:
- if:
- condition: state
entity_id: binary_sensor.nordpool_cheapest_1_hour
state: "on"
then:
- device_id: 6f41a721c6e275335f9500b095de5db5
domain: water_heater
entity_id: water_heater.ivt_dhw1
type: turn_on
- if:
- type: is_value
condition: device
device_id: a65b055be251df1c1eb16328b07eba02
entity_id: sensor.nordpool_kwh_se4_sek_3_10_025
domain: sensor
below: 0.01
then:
- service: water_heater.set_temperature
data:
temperature: 65
operation_mode: High Demand
target:
entity_id: water_heater.ivt_dhw1
- if:
- type: is_value
condition: device
device_id: a65b055be251df1c1eb16328b07eba02
entity_id: sensor.nordpool_kwh_se4_sek_3_10_025
domain: sensor
below: 0.05
above: 0.01
then:
- service: water_heater.set_temperature
data:
temperature: 60
operation_mode: Performance
target:
entity_id: water_heater.ivt_dhw1
- if:
- type: is_value
condition: device
device_id: a65b055be251df1c1eb16328b07eba02
entity_id: sensor.nordpool_kwh_se4_sek_3_10_025
domain: sensor
below: 0.1
above: 0.05
then:
- service: water_heater.set_temperature
data:
temperature: 55
operation_mode: Eco
target:
entity_id: water_heater.ivt_dhw1
- if:
- type: is_value
condition: device
device_id: a65b055be251df1c1eb16328b07eba02
entity_id: sensor.nordpool_kwh_se4_sek_3_10_025
domain: sensor
below: 0.5
above: 0.1
then:
- service: water_heater.set_temperature
data:
temperature: 50
operation_mode: Eco
target:
entity_id: water_heater.ivt_dhw1
else:
- service: water_heater.set_temperature
data:
temperature: 45
operation_mode: Eco
target:
entity_id: water_heater.ivt_dhw1
else:
- device_id: 6f41a721c6e275335f9500b095de5db5
domain: water_heater
entity_id: water_heater.ivt_dhw1
type: turn_off
- type: turn_off
device_id: 6f41a721c6e275335f9500b095de5db5
entity_id: switch.ivt_charge
domain: switch
- service: water_heater.set_temperature
data:
temperature: 45
operation_mode: "Off"
target:
entity_id: water_heater.ivt_dhw1
icon: mdi:water-boiler
mode: single