Octopus Energy Home Assistant Integration

repository·develop·Indexed 21 days ago

https://github.com/bottlecapdave/homeassistant-octopusenergy

A custom Home Assistant integration for Octopus Energy UK that provides meter consumption data, tariff information, and support for Intelligent tariffs, Octoplus, and Heat Pumps. It includes features for tracking costs, managing Octoplus saving sessions, and provides various blueprints for automating rate alerts, gas anomaly detection, and point redemption.

Tokens
47K
Snippets
108
Records
178
Agent score
76%

What's inside homeassistant-octopusenergy

  1. Overview of Octopus Energy integration features

    develop

    This custom component brings Octopus Energy UK data into Home Assistant. Key features include:

    • Meter Support: Electricity and gas meter consumption data and rate information.
    • Custom Sensors: Support for tracking costs of other entities and comparing costs to other tariffs.
    • Octopus Specific Features:
      • Octopus Home mini support
      • Intelligent tariff settings support
      • Octoplus saving sessions support
      • Wheel of fortune support
    • Hardware Support: Heat Pump support.
  2. Configure Intelligent Tariff Settings

    develop

    Manually Refresh Intelligent Dispatches

    By default, intelligent dispatches are retrieved periodically. If you want to trigger updates based on other events (e.g., a charger changing state), enable Manually refresh intelligent dispatches. This disables periodic refreshing and exposes the octopus_energy.refresh_intelligent_dispatches service.

    Warning: If enabled, you must call the service/action manually, otherwise rate and intelligent-related sensors will stop updating correctly.

    Intelligent Rates Mode

    This setting determines how the integration adjusts rate information for intelligent tariffs using planned/completed dispatch data. There are two modes:

    1. Planned and started dispatches will turn into off peak rates (Default): All planned dispatches are assumed to be successful off-peak charges. This is useful for planning future device usage. Rates will have the is_intelligent_adjusted property set to true.

      • Side effect: If a planned dispatch is removed, cost sensors may increase in value.
    2. Only started dispatches will turn into off peak rates: Only dispatches that have actually started are treated as off-peak. This prevents future planning based on unconfirmed dispatches. Rates will have the is_intelligent_adjusted property set to true.

      • Side effect: When a started dispatch arrives, the cost sensor may decrease in value.

    Minimum Required Minutes for Planned Dispatches

    Set a threshold for the minimum length (in minutes) a planned dispatch must be to be considered valid. If a dispatch is shorter than this value, the is_dispatching sensor, off-peak sensor, and current-rate sensors will not trigger or adjust. This helps prevent small, unreactive dispatch windows from triggering home automation tasks. The default is 0 (includes all dispatches).

  3. Configure Off Peak, Standard, and Peak consumption variants

    develop

    If you are on a tariff with 2 or 3 unique rates, you can use specific variants of the consumption sensor. These are disabled by default.

    Variants:

    • ..._previous_accumulative_consumption_off_peak (Lowest rate)
    • ..._previous_accumulative_consumption_standard (Middle rate)
    • ..._previous_accumulative_consumption_peak (Highest rate)

    Important Notes:

    • Enabling: You must manually enable these entities. If you switch to a tariff that supports these rates, you must reload the integration to access them. If you switch to a tariff that no longer supports them, the entities will be removed.
    • Intelligent Tariffs: If using an intelligent tariff with a provider that does not support planned_dispatches, charges outside normal off-peak periods will be counted as peak because Octopus Energy cannot distinguish between bump charges and planned charges.
    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption_off_peak
    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption_standard
    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption_peak
  4. Understand Previous Accumulative Consumption sensors

    develop

    The previous_accumulative_consumption sensor reports the total energy consumption reported by the meter for the previous available full day.

    Key Characteristics:

    • Data Source: It uses data reported directly by the meter (used for billing). It does not include data from devices like the Octopus Home Mini to ensure consistency with your Octopus Energy bill.
    • Update Frequency: Data is updated as a single record once a day. It is not broken down into hourly chunks in the sensor history; for hourly breakdowns, use the statistic entities for the Energy Dashboard.
    • Availability: Data is subject to Octopus Energy's availability and may not appear exactly at midnight. If data takes longer than 24 hours to populate, the sensor will not update immediately. You can check the data_last_retrieved sensor to see when the last update occurred.

    Entity Pattern: sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption

    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption
  5. What are started dispatches and how are they calculated?

    develop

    A started dispatch is an internal concept used to handle intelligent tariff rates accurately.

    Octopus Energy provides standard rate information, but ad-hoc off-peak periods (dispatches) must be manually adjusted. Because planned dispatches can be removed at the last minute and completed dispatches don't distinguish between 'smart' charges and 'boost' charges, the integration creates 'started dispatches'.

    Calculation Logic: Once data is refreshed, any active planned dispatch is converted into a started dispatch in 30-minute increments. This 30-minute granularity accounts for the fact that a smart charge is billed at the off-peak rate for the entire period, even if the actual charge lasts only a few minutes. This is particularly important if the intelligent state is SMART_CONTROL_IN_PROGRESS, as Octopus may stop a dispatch early.

    Note: This concept does not apply to OHME providers, as they do not provide planned dispatch information.

  6. Understand Previous Accumulative Cost sensors

    develop

    The previous_accumulative_cost sensor reports the total cost (including standing charges) for the previous available full day.

    Key Characteristics:

    • Data Source: Uses direct meter data to match your bill. It does not include Octopus Home Mini data.
    • Currency Format: All cost values are in pounds and pence (e.g., 1.01 represents £1.01).
    • Update Frequency: Updates once a day as a single record. Use statistic entities for hourly cost breakdowns in the Energy Dashboard.
    • Intelligent Tariffs: On certain intelligent tariffs, this sensor might not include charges occurring outside normal off-peak hours in specific scenarios. See the FAQ for details.

    Entity Pattern: sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_cost

    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_cost
  7. Configure Previous Accumulative Cost variants (Off Peak, Standard, Peak)

    develop

    If you are on a tariff with 2 or 3 unique rates, you can use specific cost variants. These are disabled by default.

    Variants:

    • ..._previous_accumulative_cost_off_peak (Lowest rate)
    • ..._previous_accumulative_cost_standard (Middle rate)
    • ..._previous_accumulative_cost_peak (Highest rate)

    Important Notes:

    • Enabling: You must manually enable these entities. If you switch to a tariff that supports these rates, you must reload the integration to access them. If you switch to a tariff that no longer supports them, the entities will be removed.
    • Intelligent Tariffs: If using an intelligent tariff with a provider that does not support planned_dispatches, charges outside normal off-peak periods will be counted as peak because Octopus Energy cannot distinguish between bump charges and planned charges.
    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_cost_off_peak
    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_cost_standard
    sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_cost_peak
  8. Understand cost sensor calculation and rounding

    develop

    Cost sensors are calculated by multiplying consumption by the rate for each half-hour block and summing them.

    Rounding Logic:

    • Each half-hour block's consumption is rounded to the nearest 0.01kWh.
    • The rate is rounded to the nearest penny.
    • The integration uses rounding half to even (banker's rounding): numbers ending in 5 are rounded to the nearest even hundredth. For example, 0.015 rounds to 0.02, but 0.025 rounds to 0.02.
  9. Use Cost Tracker Rate Variants (Off Peak, Standard, Peak)

    develop

    If your tariff has 2 or 3 unique rates per day, you can access specific cost sensors for different time periods. These are disabled by default and must be enabled in Home Assistant.

    Available Variants (Daily, Weekly, and Monthly):

    • Off Peak: _{{COST_TRACKER_NAME}}_off_peak (lowest rate)
    • Standard: _{{COST_TRACKER_NAME}}_standard (middle rate)
    • Peak: _{{COST_TRACKER_NAME}}_peak (highest rate)

    Important Notes:

    • Availability: These entities only appear if your tariff meets the rate criteria. If you switch tariffs, you may need to reload the integration to see new variants or lose access to old ones.
    • Intelligent Tariffs: If using an intelligent provider where planned_dispatches are not supported, charges outside normal off-peak periods may be counted as peak because Octopus Energy cannot distinguish between a bump charge and a planned charge.
    sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}_off_peak
    sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}_standard
    sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}_peak
  10. Understand the difference between Saving Sessions and Free Electricity sensors

    develop

    The integration provides sensors for two distinct Octopus programs that may be confused due to Octopus messaging:

    1. Saving Sessions: Related to Octopus Saving Sessions. These reward you for using less energy than normal (typically during winter).
    2. Free Electricity Sessions: Related to Octopus Free Electricity. These reward you for using more energy than normal (typically when renewable supply is high).

    If a sensor does not trigger as expected, verify which program you are participating in.