In Norway we have had a tough winter with 3 times or more of normal electricity prices.
As part of this we have tried to move the consumption to the periods with cheaper electricity.
The component used for electricity price is the following Nordpool component.
I have several other automations helping to cut costs, will post these later on in the same post since they use the same sensor inputs.
See following posts:
Home Assistant adaptive heating automation
Binary sensor:
- platform: template sensors: cheap_electricity_periode_00_04: friendly_name: "Cheap electricity periode 00-04" value_template: >- {{ (((states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[0].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[1].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[2].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[3].value)) /4) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') * 0.9) }} - platform: template sensors: cheap_electricity_periode_04_08: friendly_name: "Cheap electricity periode 04-08" value_template: >- {{ (((states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[4].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[5].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[6].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[7].value)) /4) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') * 0.9) }} - platform: template sensors: cheap_electricity_periode_08_12: friendly_name: "Cheap electricity periode 08-12" value_template: >- {{ (((states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[8].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[9].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[10].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[11].value)) /4) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') * 0.9) }} - platform: template sensors: cheap_electricity_periode_12_16: friendly_name: "Cheap electricity periode 12-16" value_template: >- {{ (((states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[12].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[13].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[14].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[15].value)) /4) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') * 0.9) }} - platform: template sensors: cheap_electricity_periode_16_20: friendly_name: "Cheap electricity periode 16-20" value_template: >- {{ (((states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[16].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[17].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[18].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[19].value)) /4) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') * 0.9) }} - platform: template sensors: cheap_electricity_periode_20_24: friendly_name: "Cheap electricity periode 20-24" value_template: >- {{ (((states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[20].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[21].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[22].value) + (states.sensor.nordpool_kwh_oslo_nok_3_10_025.attributes.raw_today[23].value)) /4) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') * 0.9) }} - platform: template sensors: cheap_electricity_calculated: friendly_name: "Cheap electricity calculated" value_template: >- {{ (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'current_price') | float) < (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') | float * 0.9) }} - platform: template sensors: cheap_electricity_value: friendly_name: "Cheap electricity over set value" value_template: >- {{ (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'current_price') < (0.8)) }} - platform: template sensors: cheap_electricity: friendly_name: "Cheap electricity" value_template: >- {{ is_state('binary_sensor.cheap_electricity_calculated', 'on') and is_state('binary_sensor.cheap_electricity_value', 'on') and is_state('input_boolean.fixed_price_electricity', 'off') and is_state('binary_sensor.average_electricity', 'off') and is_state('binary_sensor.expensive_electricity_calculated', 'off') and is_state('input_boolean.fixed_price_electricity', 'off') and is_state('binary_sensor.expensive_electricity_value', 'off') }} - platform: template sensors: average_electricity: friendly_name: "Average electricity" value_template: >- {{ is_state('binary_sensor.cheap_electricity', 'off') and is_state('binary_sensor.expensive_electricity', 'off') }} - platform: template sensors: expensive_electricity_calculated: friendly_name: "Expensive electricity calculated" value_template: >- {{ (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'current_price') | float) > (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'average') | float * 1.2) }} - platform: template sensors: expensive_electricity_value: friendly_name: "Expensive electricity over set value" value_template: >- {{ (state_attr('sensor.nordpool_kwh_oslo_nok_3_10_025', 'current_price') > (1.5)) }} - platform: template sensors: expensive_electricity: friendly_name: "Expensive electricity" value_template: >- {{ is_state('binary_sensor.cheap_electricity', 'off') and is_state('binary_sensor.cheap_electricity_value', 'off') and is_state('input_boolean.fixed_price_electricity', 'off') and is_state('binary_sensor.average_electricity', 'off') and is_state('binary_sensor.expensive_electricity_calculated', 'on') or is_state('input_boolean.fixed_price_electricity', 'off') and is_state('binary_sensor.expensive_electricity_value', 'on') }}
Automation:
# Cheap electricity - alias: Cheap electricity_notification id: cheap_electricity_notification trigger: platform: state entity_id: binary_sensor.cheap_electricity to: "on" condition: condition: time after: '08:00:00' before: '23:00:00' action: - choose: # Tv off - conditions: - condition: and conditions: - condition: state entity_id: remote.living_room_hub state: 'off' sequence: - service_template: notify.pushover data_template: title: "Cheap electricity - good time to laundry." message: "The price for electricity is now {{states('sensor.current_electricity_prices_inc_vat_grid_nordpool')}} kroner." data: priority: 0 sound: "pianobar" - service: rest_command.rhasspy_speak data_template: payload_data: "Cheap electricity good time to laundry." # User home and tv on - conditions: - condition: and conditions: - condition: state entity_id: group.all_people state: 'home' - condition: state entity_id: remote.living_room_hub state: 'on' sequence: - service: notify.living_room_media_center data_template: title: "Cheap electricity - good time to laundry." message: "The price for electricity is now {{states('sensor.current_electricity_prices_inc_vat_grid_nordpool')}} kroner." data: duration: 15 font-size: max transparency: 50% position: bottom-right - service_template: notify.pushover data_template: title: "Cheap electricity - good time to laundry." message: "The price for electricity is now {{states('sensor.current_electricity_prices_inc_vat_grid_nordpool')}} kroner." data: priority: 0 sound: "pianobar" - service: rest_command.rhasspy_speak data_template: payload_data: "Cheap electricity good time to laundry."