I am hoping to find some ways to improve the automation I wrote for my home heating pump system. I would really appreciate any tips on how I could improve these. Some background (forgive me if I give too much info, I’m sure you could gather most of what I say below by looking through the YAML):
Last fall I switched to a time-based electric contract last fall and pay the market price for each kWh I use. I have been using Home Assistant to shift as much of the electric usage from my heat pump (IVT 402) to those times when it is the least expensive. IVT has its own app which can be used to supposedly accomplish this but it appears to reduce the temperature up to 1 degree and I think more advantages could be achieved by taking advantage of my home’s relatively good insulation and the built-in hot water tank to act as heat batteries when the price is low. The heat pump also has an outdoor temperature sensor which can be accessed through the Bosch component.
Instead, I have created some automation using the Bosch thermostats component (home-assistant-bosch-custom-component) to talk to the heat pump, the Tibber integration to receive hourly price values (published daily at 1300l for the following day) and levels (see PriceLevel), and the Sector Alarm integration to pull room temperature data from the motion sensors installed around my house.
The automation is split into 5 separate automations in HA which adjust the temperature based on the price levels provided by the Tibber integration plus 1 to avoid high room temperature.
The full reference for the Tibber Api can be seen here but below are the definitions of each PriceLevel.
PriceLevel
Price level based on trailing price average (3 days for hourly values and 30 days for daily values)
Value | Description |
---|---|
NORMAL | The price is greater than 90 % and smaller than 115 % compared to average price. |
CHEAP | The price is greater than 60 % and smaller or equal to 90 % compared to average price. |
VERY_CHEAP | The price is smaller or equal to 60 % compared to average price. |
EXPENSIVE | The price is greater or equal to 115 % and smaller than 140 % compared to average price. |
VERY_EXPENSIVE | The price is greater or equal to 140 % compared to average price. |
Here are the automations starting with the Very_Expensive price level (I have changed the sensor IDs for my security):
alias: Price Level - VERY_EXPENSIVE
description: ''
trigger:
- platform: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
to: VERY_EXPENSIVE
condition:
- condition: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
above: '19.5'
action:
- service: climate.set_temperature
data:
temperature: 19
target:
device_id: 123456a1234
- service: water_heater.set_operation_mode
data:
operation_mode: eco
target:
entity_id: water_heater.dhw1
mode: queued
alias: Price Level - EXPENSIVE
description: ''
trigger:
- platform: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
to: EXPENSIVE
condition:
- condition: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
above: '19.5'
action:
- service: climate.set_temperature
data:
temperature: 20
target:
device_id: 123456a1234
- service: water_heater.set_operation_mode
data:
operation_mode: eco
target:
entity_id: water_heater.dhw1
mode: queued
alias: Price Level - NORMAL
description: ''
trigger:
- platform: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
to: NORMAL
- platform: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
below: '19.5'
condition:
- condition: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
below: '22'
- condition: not
conditions:
- condition: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
state: CHEAP
- condition: not
conditions:
- condition: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
state: VERY_CHEAP
action:
- service: climate.set_temperature
data:
temperature: 20.5
target:
device_id: 123456a1234
- service: water_heater.set_operation_mode
data:
operation_mode: eco
target:
entity_id: water_heater.dhw1
mode: queued
alias: Price Level - CHEAP
description: ''
trigger:
- platform: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
to: CHEAP
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id: sensor.electricity_price_streetname_123
below: '.5'
for:
hours: 0
minutes: 0
seconds: 0
- platform: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
below: '19.5'
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
below: '22'
- condition: numeric_state
entity_id: sensor.electricity_price_streetname_123
below: '.4'
- condition: or
conditions:
- condition: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
state: CHEAP
- condition: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
state: VERY_CHEAP
action:
- service: climate.set_temperature
data:
temperature: 21
target:
device_id: 123456a1234
- service: water_heater.set_operation_mode
data:
operation_mode: eco
target:
entity_id: water_heater.dhw1
mode: queued
alias: Price Level - VERY_CHEAP
description: ''
trigger:
- platform: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
to: VERY_CHEAP
- platform: numeric_state
entity_id: sensor.electricity_price_streetname_123
below: '.25'
condition:
- condition: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
below: '22'
- condition: state
entity_id: sensor.electricity_price_streetname_123
attribute: price_level
state: VERY_CHEAP
- condition: numeric_state
entity_id: sensor.electricity_price_streetname_123
below: '.25'
action:
- service: climate.set_temperature
data:
temperature: 22
target:
device_id: 123456a1234
- service: water_heater.set_operation_mode
data:
operation_mode: 'on'
target:
entity_id: water_heater.dhw1
mode: queued
alias: Avoid high room temp
description: ''
trigger:
- platform: numeric_state
entity_id: sensor.sector_living_room_motion_sensor_123456a1234
above: '23'
condition:
- condition: numeric_state
entity_id: sensor.hc1_current_room_setpoint
above: '20'
action:
- service: climate.set_temperature
data:
temperature: 20
target:
device_id: 123456a1234
- service: water_heater.set_operation_mode
data:
operation_mode: eco
target:
entity_id: water_heater.dhw1
mode: single