Skip to content

A Home Assistant integration to provide real-time and cumulative energy cost tracking, optimized for dynamic electricity prices like Nord Pool.

License

Notifications You must be signed in to change notification settings

martinarva/dynamic_energy_cost

Repository files navigation


Dynamic Energy Cost

HACS integration for Home Assistant
GitHub GitHub release (latest by date) Static Badge

This Home Assistant custom integration provides a sophisticated real-time and cumulative energy cost tracking solution, ideal for monitoring electricity expenses related to fluctuating prices and varying energy consumption levels. It's specifically crafted to handle dynamic electricity prices such as those from Nord Pool, Amber, Tibber, ...

Features

  • Real-Time Cost Sensor (only Power Based): Calculates energy costs in real-time based on current power usage in watts (W) and electricity prices.
  • Hourly, Daily, Weekly, Monthly and Yearly Cost (Energy and Power Based): Automatically generates daily, monthly, and yearly accumulations of costs, facilitating detailed and segmented analysis of energy expenses. These are based on actual energy usage in kilowatt-hours (kWh), providing precision aligned with the Home Assistant Energy Dashboard.
  • Sensor without reset interval (Energy and Power Based) Similar to the above, but does not reset automatically. It resets only when the service dynamic_energy_cost.reset_cost is called. Making it perfect for calculating specific costs, such as the expenses for individual charging sessions of an electric car.
  • Enhanced Sensor Attributes: Energy Based Sensors include attributes for total energy used (kWh) and the average energy price, aiding in energy usage optimization during cheaper hours.

Best Practices

Calculating energy cost from an energy (kWh) sensor is the more precise and recommended method. If an energy sensor is available, it is advisable to use this option for accuracy comparable to the Home Assistant Energy Dashboard. If no kWh sensor is available, the integration can alternatively use a power (W) sensor.

Note: It is important that only one type of sensor (either power or energy) is configured for this integration. Both cannot be used simultaneously.

Installation

Install using HACS (recommended)

If you do not have HACS installed yet visit https://hacs.xyz for installation instructions.

To add the this repository to HACS in your Home Assistant instance, use this My button:

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

After installation, please restart Home Assistant. To add Dynamic Energy Cost to your Home Assistant instance, use this My button:

Open your Home Assistant instance and start setting up a new integration.

Manual configuration steps

Semi-Manual Installation with HACS

  1. In Home Assistant go to HACS integrations section.
  2. Click on the 3 dots in the top right corner.
  3. Select "Custom repositories".
  4. Add the URL (https://github.com/martinarva/dynamic_energy_cost) to the repository.
  5. Select the integration category.
  6. Click the "ADD" button.
  7. Now you are able to download the integration.

Manual Installation

  1. Download the latest release of Dynamic Energy Cost and extract its contents.
  2. Copy the dynamic_energy_cost folder into the custom_components directory located typically at /config/custom_components/ in your Home Assistant directory.
  3. Restart Home Assistant to recognize the newly added custom component.
    Open your Home Assistant instance and show your service developer tools with a specific action selected.

Add Integration

  1. Navigate to Settings > Devices & Services.
  2. Click Add Integration and search for "Dynamic Energy Cost".
  3. Select the Dynamic Energy Cost integration to initiate setup.

Configure Sensors

When setting up the integration, you will be prompted to provide the following:

  • Input the entity IDs
    • Electricity Price Sensor: Sensor that provides the current electricity price (for example Nordpool, Ember, ... fixed price, day/night).
    • Power/Energy Usage Sensor: Ensure the sensor measures in Watts (W) for power or kilowatt-hours (kWh) for energy.
  • Submit to complete the integration setup.

Updating

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Update manually

To update the integration to a newer version:

  1. Download the latest release of Dynamic Energy Cost and extract its contents.
  2. Go to your'e Home Assistant instance.
  3. Make sure to make a back up first.
    Open your Home Assistant instance and show an overview of your backups.
  4. Overwrite the dynamic_energy_cost folder into the custom_components directory located typically at /config/custom_components/.
  5. Reboot Home Assistant.
    Open your Home Assistant instance and show your service developer tools with a specific action selected.

Resetting the cost sensors

Dynamic Energy Cost provides a service dynamic_energy_cost.reset_cost which you can call to reset energy sensors to 0. You can call this service from the GUI (Developer tools -> Services) or use this in automations.

service: dynamic_energy_cost.reset_cost
target:
  entity_id: sensor.your_sensor_entity_id

Calibrating the cost sensors

Dynamic Energy Cost provides a service dynamic_energy_cost.calibrate which you can call to change the value of a given sensor. You can call this service from the GUI (Developer tools -> Actions) or use this in automations.

action: dynamic_energy_cost.calibrate
target:
  entity_id: sensor.your_sensor_entity_id
data:
  value: "100"

Prerequisites

  • Electricity Price Sensor: A sensor that provides the current electricity price in EUR/kWh.
  • Power Usage Sensor (optional): A sensor that monitors power usage in Watts (W).
  • Energy Usage Sensor (optional): A sensor that monitors energy consumption in kilowatt-hours (kWh).
  • Virtual Energy Usage Sensor (optional): Use a virtual energy sensor such as e.g. Powercalc.

Beta testing

  1. Download the latest develop ZIP file of Dynamic Energy Cost and extract its contents.
  2. Go to your'e Home Assistant instance.
  3. Make sure to make a back up first.
    Open your Home Assistant instance and show an overview of your backups.
  4. Overwrite the dynamic_energy_cost folder into the custom_components directory located typically at /config/custom_components/.
  5. Reboot Home Assistant.
    Open your Home Assistant instance and show your service developer tools with a specific action selected.

Contribute

If you want, you can help with the translation via GitLocalize.

Support

For support, additional instructions visit Home Assitant Community forum topic: Dynamic Energy Cost
To report issues, please visit the GitHub issues page associated with this repository.

About

A Home Assistant integration to provide real-time and cumulative energy cost tracking, optimized for dynamic electricity prices like Nord Pool.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 18

Languages