Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added _docs/assets/target_timeframes_data_source.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added _docs/assets/target_timeframes_sub_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 19 additions & 5 deletions _docs/blueprints/octopus_energy_manual_intelligent_refresh.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,41 @@ blueprint:
action: {}

variables:
intelligent_dispatches_data_last_retrieved_sensor: !input intelligent_dispatches_data_last_retrieved_sensor
intelligent_dispatches_sensor: !input intelligent_dispatches_sensor
car_plugged_in_sensor: !input car_plugged_in_sensor
millisecond_jitter: >
{{ range(1, 1000) | random }}

mode: queued
max: 4
trigger_variables:
intelligent_dispatches_data_last_retrieved_sensor: !input intelligent_dispatches_data_last_retrieved_sensor
triggers:
- trigger: state
id: car_plugged_in
entity_id: !input car_plugged_in_sensor
to: !input car_plugged_in_sensor_state
- trigger: template
value_template: >
{{ state_attr(intelligent_dispatches_data_last_retrieved_sensor, 'next_refresh') | as_datetime | as_local < now() }}
- trigger: time_pattern
minutes: "/1"
conditions:
- condition: state
entity_id: !input car_plugged_in_sensor
state: !input car_plugged_in_sensor_state
# Make sure that our dispatches are either due to be updated or our automation was triggered due to the vehicle being plugged in
- condition: or
conditions:
- condition: template
value_template: >
{{ trigger.id == "car_plugged_in" }}
- condition: template
value_template: >
{{ state_attr(intelligent_dispatches_data_last_retrieved_sensor, 'next_refresh') | as_datetime | as_local < now() }}
actions:
# Wait 30 seconds to give OE a chance to update the dispatches
- delay: 00:00:30
# Add a bit of jitter so the API isn't hit at once
- delay:
milliseconds: >
{{ millisecond_jitter }}
- action: octopus_energy.refresh_intelligent_dispatches
target:
entity_id: !input intelligent_dispatches_sensor
Expand Down
12 changes: 12 additions & 0 deletions _docs/entities/electricity.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,10 @@ The total consumption reported by the meter for the previous available full day

This is [disabled by default](../faq.md#there-are-entities-that-are-disabled-why-are-they-disabled-and-how-do-i-enable-them).

!!! warning

If you are on intelligent and are using a provider where [planned_dispatches](./intelligent.md#is-dispatching) are not supported, then charges outside of your normal off peak periods will be counted at peak. This is because Octopus Energy doesn't provide enough information to determine if a completed dispatch was a bump charge or a planned charge.

##### Standard

`sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption_standard`
Expand Down Expand Up @@ -320,6 +324,10 @@ The total cost reported by the meter for the previous available full day during

This is [disabled by default](../faq.md#there-are-entities-that-are-disabled-why-are-they-disabled-and-how-do-i-enable-them).

!!! warning

If you are on intelligent and are using a provider where [planned_dispatches](./intelligent.md#is-dispatching) are not supported, then charges outside of your normal off peak periods will be counted at peak. This is because Octopus Energy doesn't provide enough information to determine if a completed dispatch was a bump charge or a planned charge.

##### Standard

`sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_cost_standard`
Expand Down Expand Up @@ -522,6 +530,10 @@ The total cost reported by the meter for the current day during off peak hours (
!!! warning
This will only be available if you have specified you have a [Octopus Home Mini](../setup/account.md#home-mini) or have configured an [Octopus Home Pro](../setup//account.md#home-pro). Do not set unless you have one.

!!! warning

If you are on intelligent and are using a provider where [planned_dispatches](./intelligent.md#is-dispatching) are not supported, then charges outside of your normal off peak periods will be counted at peak. This is because Octopus Energy doesn't provide enough information to determine if a completed dispatch was a bump charge or a planned charge.

!!! info
An export equivalent of this sensor does not exist because the data is not available

Expand Down
4 changes: 4 additions & 0 deletions _docs/entities/heat_pump.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ This represents the instantaneous efficiency of the heat pump.
!!! note
As this integration uses cloud polling this will inherently have a delay.

!!! info

This sensor will report zero when the heat pump is not reporting input power, otherwise the reported COP can be inaccurate.

## Live Power Input

`sensor.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_live_power_input`
Expand Down
2 changes: 1 addition & 1 deletion _docs/entities/intelligent.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This sensor is used to determine if you're currently in a planned dispatch perio

* OHME

If you are supplied by one of the above providers, `planned_dispatches` will always return an empty collection and this entity will only turn on when within the standard off peak period.
If you are supplied by one of the above providers, `planned_dispatches` will always return an empty collection and this entity will only turn on when within the standard off peak period.

| Attribute | Type | Description |
|-----------|------|-------------|
Expand Down
51 changes: 51 additions & 0 deletions _docs/migrations/target_timeframes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Migrating Target Rate Sensors To Target Timeframes

It has been [proposed](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions/1305) that the target rate feature of the integration be deprecated and removed in favour of a new external integration, [Target Timeframes](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/). The full reasoning can be found in the proposal.

This guide explains how to migrate your target rate sensors to the new integration.

## Installing the integration

The first thing you need to do is install the new integration. Full instructions can be found on [the website](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/#how-to-install).

## Setting up data sources

Once installed, you'll need to setup a data source that represents data coming from this integration. This can be done by [following the link](https://my.home-assistant.io/redirect/config_flow_start/?domain=target_timeframes) or searching for the integration in your integrations view. You'll need a data source for each of your meters (e.g. one for import and one for export)

The recommended name is `Octopus Energy Import` and the recommended source id is `octopus_energy_import`, but you can pick whatever you want as long as it's unique within the integration.

![Data Source window](../assets/target_timeframes_data_source.png)

## Configuring Octopus Energy data

Next, we'll need to get data from the Octopus Energy integration into the Target Timeframes integration. The recommended approach is an automation based on the [available blueprint](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/blueprints/#octopus-energy). This will track when the rate entities within the Octopus Energy integration update. Upon updating, it will then transform the rate data into the shape required by Target Timeframes and use the available service to add the rate data with the data source we just created. Each `value` in Target Timeframes will represent our rate in pounds/pence.

## Setting up Target Rate sensors

Now we have our data source representing Octopus Energy and data coming from this integration into Target Timeframes, it's time to now port across our target rate and rolling target rate sensors. Each type of sensor are added as a sub entry to our data source. You can see below what the menu looks like.

![Integration sub menu](../assets/target_timeframes_sub_menu.png)

For porting a [target rate sensor](../setup/target_rate.md), you would select [target timeframe](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/setup/target_timeframe/) and for porting a [rolling target rate sensor](../setup/rolling_target_rate.md), you would select [rolling target timeframe](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/setup/rolling_target_timeframe/).

All options within the sensors should feel familiar, as they represent what's available within this integration. Below are some noticeable differences

* `Invert targeted rates` in the Octopus Energy integration is represented by `Find highest values`. If `Invert targeted rates` is checked, for sensors using data sources targeting import meters, `Find highest values` should be checked. If `Invert targeted rates` is checked, for sensors using data sources targeting export meters, `Find highest values` should be checked.

!!! info

If you are wanting to minimise updates of automations, once the target timeframe sensor has been created and you delete the old sensor from the Octopus Energy integration, you can rename the entity id to have the name of the old sensor. For example, if you have a target sensor with the entity id of `sensor.target_timeframe_octopus_energy_import_dishwasher`, your could rename it to `sensor.octopus_energy_target_dishwasher`.

!!! warning

There is currently a bug in HA where you'll need to reload the data source when a target rate sensor is added/updated in order to see the target rate sensor.

## Available services

The following list of related services and their counterparts.

| OE Service | Target Timeframes Service |
|-|-|
| [octopus_energy.update_target_config](../services.md#octopus_energyupdate_target_config) | [target_timeframes.update_target_timeframe_config](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/services/#target_timeframesupdate_target_timeframe_config) |
| [octopus_energy.update_rolling_target_config](../services.md#octopus_energyupdate_rolling_target_config) | [target_timeframes.update_rolling_target_timeframe_config](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/services/#target_timeframesupdate_rolling_target_timeframe_config) |
| [octopus_energy.register_rate_weightings](../services.md#octopus_energyregister_rate_weightings) | Data is now loaded as part of [target_timeframes.update_target_timeframe_data_source](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/services/#target_timeframesupdate_target_timeframe_data_source). Therefore data can be manipulated before this service is called. A [blueprint](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/blueprints/#octopus-energy-and-carbon-intensity) is available as an example. |
2 changes: 1 addition & 1 deletion _docs/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ This service is only available for the following sensors

Due to limitations with Home Assistant entities, this service will only refresh data for the associated statistic ids used for the recommended approach in the [energy dashboard](./setup/energy_dashboard.md#previous-day-consumption). This will not update the history of the entities themselves.

!!! warn
!!! warning

If you are on intelligent, the cost data will not be correct for charges outside of the normal off peak times. This is because this data isn't available.

Expand Down
12 changes: 12 additions & 0 deletions _docs/setup/cost_tracker.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ This is the total cost of the tracked entity for the current day during off peak

This is [disabled by default](../faq.md#there-are-entities-that-are-disabled-why-are-they-disabled-and-how-do-i-enable-them).

!!! warning

If you are on intelligent and are using a provider where [planned_dispatches](../entities/intelligent.md#is-dispatching) are not supported, then charges outside of your normal off peak periods will be counted at peak. This is because Octopus Energy doesn't provide enough information to determine if a completed dispatch was a bump charge or a planned charge.

##### Standard

`sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}_standard`
Expand Down Expand Up @@ -184,6 +188,10 @@ This is the total cost of the tracked entity for the current week during off pea

This is [disabled by default](../faq.md#there-are-entities-that-are-disabled-why-are-they-disabled-and-how-do-i-enable-them).

!!! warning

If you are on intelligent and are using a provider where [planned_dispatches](../entities/intelligent.md#is-dispatching) are not supported, then charges outside of your normal off peak periods will be counted at peak. This is because Octopus Energy doesn't provide enough information to determine if a completed dispatch was a bump charge or a planned charge.

##### Standard

`sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}_week_standard`
Expand Down Expand Up @@ -260,6 +268,10 @@ This is the total cost of the tracked entity for the current month during off pe

This is [disabled by default](../faq.md#there-are-entities-that-are-disabled-why-are-they-disabled-and-how-do-i-enable-them).

!!! warning

If you are on intelligent and are using a provider where [planned_dispatches](../entities/intelligent.md#is-dispatching) are not supported, then charges outside of your normal off peak periods will be counted at peak. This is because Octopus Energy doesn't provide enough information to determine if a completed dispatch was a bump charge or a planned charge.

##### Standard

`sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}_month_standard`
Expand Down
6 changes: 6 additions & 0 deletions _docs/setup/rolling_target_rate.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Rolling Target Rate Sensor(s)

!!! warning

It has been [proposed](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions/1305) that the rolling target rate feature of the integration be deprecated and removed in favour of a new external integration, [Target Timeframes](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/). The full reasoning can be found in the proposal.

A [migration guide](../migrations/target_timeframes.md) is available for migrating rolling target rate sensors to the new integration.

After you've configured your [account](./account.md), you'll be able to configure rolling target rate sensors. These are configured by adding subsequent instances of the integration going through the [normal flow](https://my.home-assistant.io/redirect/config_flow_start/?domain=octopus_energy), and selecting `Rolling Target Rate` in the provided menu.

These sensors calculate the lowest continuous or intermittent rates within the next available `x` hours, where `x` is configurable via the sensor, and turn on when these periods are active. If you are targeting an export meter, then the sensors will calculate the highest continuous or intermittent rates within the next available `x` hours and turn on when these periods are active. If you are wanting to evaluate on a fixed basis (e.g. every 24 hours), you might be interested in the [standard target rate sensors](./target_rate.md)
Expand Down
6 changes: 6 additions & 0 deletions _docs/setup/target_rate.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Target Rate Sensor(s)

!!! warning

It has been [proposed](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions/1305) that the target rate feature of the integration be deprecated and removed in favour of a new external integration, [Target Timeframes](https://bottlecapdave.github.io/HomeAssistant-TargetTimeframes/). The full reasoning can be found in the proposal.

A [migration guide](../migrations/target_timeframes.md) is available for migrating target rate sensors to the new integration.

After you've configured your [account](./account.md), you'll be able to configure target rate sensors. These are configured by adding subsequent instances of the integration going through the [normal flow](https://my.home-assistant.io/redirect/config_flow_start/?domain=octopus_energy), and selecting `Target Rate` in the provided menu.

These sensors calculate the lowest continuous or intermittent rates **within a 24 hour period** and turn on when these periods are active. If you are targeting an export meter, then the sensors will calculate the highest continuous or intermittent rates **within a 24 hour period** and turn on when these periods are active. If you are wanting to evaluate on a rolling basis, you might be interested in the [rolling target rate sensors](./rolling_target_rate.md)
Expand Down
5 changes: 2 additions & 3 deletions custom_components/octopus_energy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,14 +496,12 @@ async def async_setup_dependencies(hass, config):
is_smart_meter = meter["is_smart_meter"]
override = await async_get_meter_debug_override(hass, mpan, serial_number)
tariff_override = override.tariff if override is not None else None
planned_dispatches_supported = intelligent_features.planned_dispatches_supported if intelligent_features is not None else True
await async_setup_electricity_rates_coordinator(hass,
account_id,
mpan,
serial_number,
is_smart_meter,
is_export_meter,
planned_dispatches_supported,
config[CONFIG_MAIN_INTELLIGENT_RATE_MODE] if CONFIG_MAIN_INTELLIGENT_RATE_MODE in config else CONFIG_MAIN_INTELLIGENT_RATE_MODE_PENDING_AND_STARTED_DISPATCHES,
tariff_override)

Expand Down Expand Up @@ -535,7 +533,8 @@ async def async_setup_dependencies(hass, config):
hass,
account_id,
account_debug_override.mock_intelligent_controls if account_debug_override is not None else False,
config[CONFIG_MAIN_INTELLIGENT_MANUAL_DISPATCHES] == True if CONFIG_MAIN_INTELLIGENT_MANUAL_DISPATCHES in config else False
config[CONFIG_MAIN_INTELLIGENT_MANUAL_DISPATCHES] == True if CONFIG_MAIN_INTELLIGENT_MANUAL_DISPATCHES in config else False,
intelligent_features.planned_dispatches_supported if intelligent_features is not None else True
)

await async_setup_intelligent_settings_coordinator(hass, account_id, intelligent_device.id if intelligent_device is not None else None, account_debug_override.mock_intelligent_controls if account_debug_override is not None else False)
Expand Down
3 changes: 1 addition & 2 deletions custom_components/octopus_energy/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,9 @@ async def async_setup_main_sensors(hass, entry, async_add_entities):
"async_refresh_dispatches"
)

intelligent_features = get_intelligent_features(intelligent_device.provider)
coordinator = hass.data[DOMAIN][account_id][DATA_INTELLIGENT_DISPATCHES_COORDINATOR]
electricity_rate_coordinator = hass.data[DOMAIN][account_id][DATA_ELECTRICITY_RATES_COORDINATOR_KEY.format(intelligent_mpan, intelligent_serial_number)]
entities.append(OctopusEnergyIntelligentDispatching(hass, coordinator, electricity_rate_coordinator, intelligent_mpan, intelligent_device, account_id, intelligent_features.planned_dispatches_supported))
entities.append(OctopusEnergyIntelligentDispatching(hass, coordinator, electricity_rate_coordinator, intelligent_mpan, intelligent_device, account_id))

if len(entities) > 0:
async_add_entities(entities)
Expand Down
2 changes: 1 addition & 1 deletion custom_components/octopus_energy/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ async def __async_setup_main_schema__(self, config, errors):
selector.SelectSelectorConfig(
options=[
selector.SelectOptionDict(value=CONFIG_MAIN_INTELLIGENT_RATE_MODE_PENDING_AND_STARTED_DISPATCHES, label="Planned and started dispatches will turn into off peak rates"),
selector.SelectOptionDict(value=CONFIG_MAIN_INTELLIGENT_RATE_MODE_STARTED_DISPATCHES_ONLY, label="Only stared dispatches will turn into off peak rates"),
selector.SelectOptionDict(value=CONFIG_MAIN_INTELLIGENT_RATE_MODE_STARTED_DISPATCHES_ONLY, label="Only started dispatches will turn into off peak rates"),
],
mode=selector.SelectSelectorMode.DROPDOWN,
)
Expand Down
Loading