Skip to content

kotope/aio_energy_management

Repository files navigation

All in One Energy Management for Home Assistant

Purpose of this component is to provide easily configurable energy management for Home Assistant automations.

  • Supports finding Nord Pool / Entso-E / Strømligning cheapest hours (or most expensive) per day and automatic calendar creation.
  • Supports excess solar energy routing to selected device(s)

Read more detailed information at the creatingsmarthome.com blog

Installation

Option 1: HACS

  • Follow Open your Home Assistant instance and open a repository inside the Home Assistant Community Store. and install it

  • Restart Home Assistant

    or

  • Go to HACS -> Integrations,

  • Select ... from upper right corner,

  • Select Custom repositories

  • Add https://github.com/kotope/aio_energy_management and select Type as Integration

  • Search for AIO Energy Management and select it

  • Press Download

  • Restart Home Assistant

Option 2: Manual

SSH into Home Assistant and write the following:

cd /config/custom_components
wget -O - https://raw.githubusercontent.com/kotope/aio_energy_management/master/install_to_home_assistant.sh | bash

Features

  • Cheapest Hours (or most expensive) - Nord Pool, Entso-E and Strømligning integration support
  • Excess Solar
  • Event Calendar
  • Service utility

Cheapest hours sensor (supports Nord Pool, Entso-E and Strømligning integrations)

The cheapest hours configuration will create a binary_sensor type entity that will provide timeframe(s) containing percentually the cheapest hours per day.
Binary sensor will have the state 'on' when cheapest hours is active.
Automations can then be set to follow this sensor 'on' state. The feature supports failsafe to ensure critical devices to run if for some reason Nord Pool price fetch has failed!

Nord Pool Prerequisites (if using Nord Pool custom integration)

Installed and configured Nord Pool integration

Entso-E Prerequisites (if using Entso-E)

Installed and configured Entso-E integration

Nord Pool Official integration Prerequisites (if using Nord Pool official integration)

Installed and configured Nord Pool official integration

Strømligning Prerequisites (if using Strømligning)

Installed and configured Strømligning integration

Getting configuration entry id (not needed for UI configuration)

  1. Go to Developer Tools > Actions.
  2. In the “Service” dropdown, select Nord Pool: Get prices.
  3. Choose your newly created config entry from the UI.
  4. Switch to YAML mode.
  5. Voila! The config_entry ID will be displayed. Copy this value for the next steps. (configuration id is something like '01JPHC0B39ST11081WFZQCKMVC')

Configuration

🎉 New in Version 0.8.0: UI Configuration Flow! AIO Energy Management now supports UI-based configuration through Home Assistant's interface! You can now:

  • ✨ Configure entities through the UI (Settings → Devices & Services)
  • 🔧 Modify existing entities without editing YAML
  • 📋 Use a step-by-step wizard for easy setup
  • 🔄 Keep using YAML configuration if you prefer (fully backward compatible)

Quick Start: See QUICK_START_UI.md for a 5-minute setup guide!

Full Guide: See CONFIG_FLOW_GUIDE.md for detailed UI configuration instructions.

🆕 UI Configuration (Recommended): Configure through Settings → Devices & Services → Add Integration → AIO Energy Management. See CONFIG_FLOW_GUIDE.md for details.

Legacy YAML Configuration: Configuration can also be done through configuration.yaml (still fully supported).

Either nordpool_entity, entsoe_entity, or stromligning_entity must be set, depending on which integration you want to use.

Configuration parameters are shown below:

Configuration Mandatory Description
nordpool_entity no Entity id of the Nord Pool integration
entsoe_entity no Entity id of the Entso-E integration. This is Entso-E average_price sensor that provides all extra attributes
nordpool_official_config_entry no Configuration entry id of Nord Pool official integration
stromligning_entity no Entity id of the Strømligning integration (today's prices sensor)
stromligning_tomorrow_entity no Entity id of the Strømligning integration (tomorrow's prices sensor)
unique_id yes Unique id to identify newly created entity
name yes Friendly name of the created entity
number_of_hours no Number of hours required to get. Can contain entity_id of dynamic entity to get value from e.g. input_number deprecated: use number_of_slots instead
number_of_slots yes Number of slots required to get. Can contain entity_id of dynamic entity to get value from e.g. input_number. This configuration will match the selected MTU
first_hour yes Starting hour used by cheapest hours calculation. If used 'starting_today' as true, must be AFTER Nord Pool price publishing.
last_hour yes Last hour used by cheapest hours calculation
starting_today no First_hour should be already on the same day. False if next day calculations only (depreceted determined automatically since 0.9.0)
sequential yes True if trying to calculate sequential cheapest hours timeframe. False if multiple values are acceptable.
failsafe_starting_hour no If for some reason Nord Pool prices can't be fetched before first_hour, use failsafe time to turn the sensor on. If failsafe_starting_hour is not given, the failsafe is disabled for the sensor.
inversed no Want to find expensive hours to avoid? Set to True! default: false
trigger_time no Earliest time to create next cheapest hours. Format: "HH:mm". Useful when waiting for other data to arrive before triggering event creation. Example: 'trigger_time: "19:00"' ! Deprecated: use trigger_hour instead !
price_limit no Only accept prices less than given float value or more than given float value if inversed is used. Note: given hours might be less than requested if not enough values can be found with given parameters. Can contain entity_id of dynamic entity to get value from e.g. input_number. On sequential cheapest hours mean price is compared and all-or-nothing is returned
trigger_hour no Earliest hour to create next cheapest hours. "HH:mm". Useful when waiting for other data to arrive before triggering event creation. Example: 'trigger_hour: 19'. Can contain entity_id of dynamic entity to get value from e.g. input_number
calendar no Should the entity be added to the calendar. Defaults to true.
offset no Possible start and end offset. On non-sequential the start offset is only added to first item and end offset to last item. Avg/min/max prices does not take the offset into account. See example below.
mtu no Requested MTU (15 or 60min). Default 60. If data provider uses 15 mtu and 60 is request by user, the component will calculate mean price for the hour
price_modifications no Adds price modifications to the prices, e.g. tariffs and/or taxes. Jinja2 template with values 'price' and 'time' available. 'time' is the start datetime of entry, 'price' is the price of entry. Example available in its own section below.
 retention_days no  Number of days the calendar will show previous markings. Defaults to one if omitted.
 area  no Market area used for price date. Only effective when using Nord Pool official integration. Default area of your official Nord Pool integration configuration will be used if omitted.

Restrictions:

  • Total timespan needs to be less or equal to 24 hours - this is to prevent overlapping items.
  • last_hour is always tomorrow

Example configuration

The example configuration presents creation of four sensors: one for Nord Pool cheapest three hours, one for Nord Pool most expensive prices, one for Entso-E cheapest hours, one for Strømligning cheapest hours and final one for Nord Pool cheapest hours with offset

aio_energy_management:
    cheapest_hours:
      - nordpool_entity: sensor.nordpool
        unique_id: my_cheapest_hours
        name: My Cheapest Hours
        first_hour: 21
        last_hour: 12
        starting_today: true
        number_of_slots: 3
        sequential: false
        failsafe_starting_hour: 1
      - nordpool_entity: sensor.nordpool
        unique_id: my_expensive_hours
        name: Expensive Hours
        first_hour: 0
        last_hour: 22
        starting_today: false
        number_of_slots: 4
        sequential: false
        failsafe_starting_hour: 1
        inversed: true
      - entsoe_entity: sensor.entsoe_average_price
        unique_id: my_entsoe_cheapest_hours
        name: My Entso-E Cheapest Hours
        first_hour: 21
        last_hour: 10
        starting_today: true
        number_of_slots: 5
        sequential: false
      - stromligning_entity: sensor.stromligning_electricity_price_today
        stromligning_tomorrow_entity: sensor.stromligning_electricity_price_tomorrow
        unique_id: my_stromligning_cheapest_hours
        name: My Strømligning Cheapest Hours
        first_hour: 21
        last_hour: 10
        starting_today: true
        number_of_slots: 5
        sequential: false
      - nordpool_entity: sensor.nordpool
        unique_id: my_cheapest_hours_offset
        name: My Cheapest Hours With Offset
        first_hour: 21
        last_hour: 10
        starting_today: true
        number_of_slots: 5
        sequential: True
        offset:
          start:
            hours: 0
            minutes: 30
          end:
            hours: 1
            minutes: 15

Price modifications

Price modifications can be used to add additional costs, like tariffs and/or taxes, or modify existing prices. Currently official nord pool provides prices EUR/mWh rather than snt/kWh (at least in Finland), this option can be used to convert data points to snt/kWh.

Please note that price limit and other calculations are done after price modifications.

price_modifications requires Jinja2 template with pre-defined parameters price and time used.

Example below contains official nord pool price modification with night tariff (22-07), conversion to snt/kWh and added electricity tax 25.5%

aio_energy_management:
    cheapest_hours:
      - nordpool_official_config_entry: 01K07FX4QRHEZW8GHSK3KT1ESY
        unique_id: my_cheapest_hours
        name: My Cheapest Hours
        first_hour: 21
        last_hour: 12
        starting_today: true
        number_of_slots: 3
        sequential: false
        failsafe_starting_hour: 1
        price_modifications: >
          {%- set as_snt = price / 10.0 %}
          {%- set with_taxes = (as_snt * 1.255) | float %}
          {%- if time.hour >= 22 or time.hour <= 7 %}
            {{ with_taxes + 3.1 }}
          {%- else %}
            {{ with_taxes + 5.0 }}
          {%- endif %}

Excess Solar

Excess solar feature will try to 'route' your solar energy to your own devices that can be used to store energy - like hot water heater, electric floor heating and such. This can be very useful when there's no batteries and electricity price is so cheap that it's not effective to sell it back to network.

Requirements for this feature are: Solar panels (no measurement support needed), grid sensor entity to read grid energy and controllabled devices (as many as you want).

Configuration

Quick Start: See QUICK_START_UI.md for a 5-minute setup guide!

Full Guide: See CONFIG_FLOW_GUIDE.md for detailed UI configuration instructions.

🆕 UI Configuration (Recommended): Configure through Settings → Devices & Services → Add Integration → AIO Energy Management. See CONFIG_FLOW_GUIDE.md for details.

Legacy YAML Configuration: Configuration can also be done through configuration.yaml (still fully supported).

Configuration parameters are shown below:

Configuration Mandatory Description
sensor yes The required grid in/out sensor
buffer yes Hystersis to prevent rapid on/off cycles
power_devices  yes  list of controllable devices (see below for details)

Power device configurations

Configuration Mandatory Description
name yes  Name of the device
consumption  yes Consumption amount of the device in watts. Used to determine when the device should be turned on / off
consumption_entity no Entity of devices live consumption data
 priority  yes   default priority value of the devices. Lower priority will get turned on first
 minumum_on_time  yes  How long the device must be on (minutes) before it can be turned off again
 minumum_off_time  no  How long the device must be off (minutes) before it can be turned on again
 is_on_schedule  no When the device is on schedule, it won't be intererfered by the Excess Solar. (e.g. AIO Energy Management cheapest hours sensor)
aio_energy_management:
    excess_solar:
      sensor: input_number.grid_power
      buffer: 100
      power_devices:
        - name: Water Heater
          consumption: 3000
          consumption_entity: sensor.water_heather_power_consumption
          priority: 1
          minimum_on_time: 5
          is_on_schedule: binary_sensor.cheapest_hours
        - name: EV Charger
          consumption: 1000
          priority: 2
          minimum_on_time: 10
          minumum_off_time: 1

Calendar

Calendar feature will create a new calendar entity to display all upcoming scheduled energy management events. Also please note that the events can't be modified through the calendar, it's for displaying and automation purposes (for now at least).

Configuration

Configuration required for energy management calendar:

Configuration Mandatory Description
unique_id yes Unique id to identify newly created entity
name yes Friendly name of the created entity

Example configuration

aio_energy_management:
  calendar:
    name: Energy Management
    unique_id: energy_management_calendar

Service utility

AIO Energy Management integration provides a service utility to be used alongside with other components. It supports to clear cached cheapest hours data and reloading integration confguration.

Service utility is provided automatically with the integration and does not need separate configuration.

Action: Clear cached data (aio_energy_management.clear_data)

Will clear stored data for specified cheapest hours configuration. Changes will take effect in next 30s when Home Assistant event loop is run. This is especially useful when trying different parameters for cheapest hours: No longer need to wait until next day for changes to effect.

Parameter Description
unique_id unique_id of the item to be cleared. Unique_id should be the same as defined in cheapest_hours configuration entry.

Action: Reload integration (aio_energy_management.reload_data)

Will reload whole configuration without needing to restart the whole Home Assistant. Remember to call aio_energy_management.clear_data after changes if needed.

Example service call

service: aio_energy_management.clear_data
data:
  unique_id: my_cheapest_hours

Full example with Nord Pool cheapest hours, expensive hours and a calendar

aio_energy_management:
    cheapest_hours:
      - nordpool_entity: sensor.nordpool
        unique_id: my_cheapest_hours
        name: My Cheapest Hours
        first_hour: 21
        last_hour: 12
        starting_today: true
        number_of_slots: 3
        sequential: false
        failsafe_starting_hour: 1
      - nordpool_entity: sensor.nordpool
        unique_id: my_expensive_hours
        name: Expensive Hours
        first_hour: 0
        last_hour: 22
        starting_today: false
        number_of_slots: 4
        sequential: false
        failsafe_starting_hour: 1
        inversed: true
  calendar:
    name: Energy Management
    unique_id: energy_management_calendar

Support the developer?

"Buy Me A Coffee"

About

Home Assistant All-In-One Energy Management integration

Resources

Stars

Watchers

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages