Skip to content

Commit

Permalink
2023.10 bug fix (#447)
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave authored Oct 7, 2023
2 parents c5ab188 + 0799002 commit 24867e1
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 137 deletions.
27 changes: 4 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
- [HACS](#hacs)
- [Manual](#manual)
- [How to setup](#how-to-setup)
- [Target Rate Sensors](#target-rate-sensors)
- [Events](#events)
- [Energy Dashboard](#energy-dashboard)
- [Community Contributions](#community-contributions)
- [Docs](#docs)
- [FAQ](#faq)
- [Sponsorship](#sponsorship)

Expand Down Expand Up @@ -42,29 +39,13 @@ To install, place the contents of `custom_components` into the `<config director

Please follow the [setup guide](./_docs/setup_account.md) to setup your initial account. This guide details the configuration, along with the sensors that will be available to you.

## Target Rate Sensors
## Docs

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.

These sensors can then be used in automations to turn on/off devices that save you (and the planet) energy and money. You can go through this flow as many times as you need target rate sensors.

Please follow the [setup guide](./_docs/setup_target_rate.md) to setup.

## Events

This integration raises several events, which can be used for various tasks like automations. For more information, please see the [events docs](./_docs/events.md).

## Energy Dashboard

The core sensors have been designed to work with the energy dashboard. Please see the [guide](./_docs/energy_dashboard.md) for instructions on how to set this up.

## Community Contributions

A collection of community contributions can be found [here](./_docs/community.md).
To get full use of the integration, please visit the [docs](./_docs/readme.md).

## FAQ

Before raising anything, please read through the [faq](./_docs/faq.md). If you have questions, then you can raise a [discussion](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions). If you have found a bug or have a feature request please [raise it](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues) using the appropriate report template.
Before raising anything, please read through the [faq](./faq.md). If you have questions, then you can raise a [discussion](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions). If you have found a bug or have a feature request please [raise it](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues) using the appropriate report template.

## Sponsorship

Expand Down
76 changes: 76 additions & 0 deletions _docs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Home Assistant Octopus Energy Docs

- [Home Assistant Octopus Energy Docs](#home-assistant-octopus-energy-docs)
- [How to setup](#how-to-setup)
- [Sensors](#sensors)
- [Electricity Sensors](#electricity-sensors)
- [Gas Sensors](#gas-sensors)
- [Home Mini](#home-mini)
- [Intelligent](#intelligent)
- [Saving Sessions](#saving-sessions)
- [Target Rate Sensors](#target-rate-sensors)
- [Events](#events)
- [Energy Dashboard](#energy-dashboard)
- [Community Contributions](#community-contributions)
- [FAQ](#faq)


## How to setup

Please follow the [setup guide](./setup_account.md) to setup your initial account. This guide details the configuration, along with the sensors that will be available to you.

## Sensors

### Electricity Sensors

A full list of electricity sensors can be found [here](./sensors/electricity.md).

### Gas Sensors

A full list of gas sensors can be found [here](./sensors/gas.md).

### Home Mini

If you are lucky enough to own an [Octopus Home Mini](https://octopus.energy/blog/octopus-home-mini/), you can now receive this data within Home Assistant. When setting up (or editing) your account within Home Assistant, you will need to check the box next to `I have a Home Mini`. This will gain the following sensors which can be added to the [energy dashboard](https://www.home-assistant.io/blog/2021/08/04/home-energy-management/):

> Please note, you will only have the same data exposed in the integration that is available within the app. There has been reports of gas not appearing within the app (and integration) straight away, so you might have to wait a few days for this to appear. Once it's available within the app, if you reload the integration (or restart Home Assistant) then the sensors should become available.
For electricity sensors, see [here](./sensors/electricity.md#home-mini-sensors).

For gas sensors, see [here](./sensors/gas.md#home-mini-sensors)

### Intelligent

If you are on the [intelligent tariff](https://octopus.energy/smart/intelligent-octopus/), then you'll get a few additional sensors when you install the integration.

A full list of intelligent sensors can be found [here](./sensors/intelligent.md)

> Please note: If you switch to the intelligent tariff after you have installed the integration, you will need to reload the integration or restart your Home Assistant instance.
### Saving Sessions

To support Octopus Energy's [saving sessions](https://octopus.energy/saving-sessions/). A full list of sensors can be found [here](./sensors/saving_sessions.md).

## Target Rate Sensors

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.

These sensors can then be used in automations to turn on/off devices that save you (and the planet) energy and money. You can go through this flow as many times as you need target rate sensors.

Please follow the [setup guide](./setup_target_rate.md) to setup.

## Events

This integration raises several events, which can be used for various tasks like automations. For more information, please see the [events docs](./events.md).

## Energy Dashboard

The core sensors have been designed to work with the energy dashboard. Please see the [guide](./energy_dashboard.md) for instructions on how to set this up.

## Community Contributions

A collection of community contributions can be found [here](./community.md).

## FAQ

Before raising anything, please read through the [faq](./faq.md). If you have questions, then you can raise a [discussion](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/discussions). If you have found a bug or have a feature request please [raise it](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues) using the appropriate report template.
4 changes: 2 additions & 2 deletions _docs/sensors/electricity.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You'll get the following sensors for each electricity meter with an active agree
- [Previous Accumulative Cost Override Tariff](#previous-accumulative-cost-override-tariff)
- [How To Use](#how-to-use)
- [Previous Accumulative Cost Override](#previous-accumulative-cost-override)
- [Previous Consumption Override Day Rates](#previous-consumption-override-day-rates)
- [Previous Consumption Override Day Rates](#previous-consumption-override-day-rates)

## Current Rate

Expand Down Expand Up @@ -387,7 +387,7 @@ This is the cost of the previous electricity accumulation based on the specified

For attributes, see [Previous Accumulative Cost](#previous-accumulative-cost).

## Previous Consumption Override Day Rates
### Previous Consumption Override Day Rates

`event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_consumption_override_rates`

Expand Down
4 changes: 2 additions & 2 deletions _docs/sensors/gas.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ You'll get the following sensors for each gas meter with an active agreement:
- [Previous Accumulative Cost Override Tariff](#previous-accumulative-cost-override-tariff)
- [How To Use](#how-to-use)
- [Previous Accumulative Cost Override](#previous-accumulative-cost-override)
- [Previous Consumption Override Day Rates](#previous-consumption-override-day-rates)
- [Previous Consumption Override Day Rates](#previous-consumption-override-day-rates)

## Current Rate

Expand Down Expand Up @@ -263,7 +263,7 @@ This is the cost of the previous gas accumulation based on the specified tariff

For attributes, see [Previous Accumulative Cost](#previous-accumulative-cost).

## Previous Consumption Override Day Rates
### Previous Consumption Override Day Rates

`event.octopus_energy_gas_{{METER_SERIAL_NUMBER}}_{{MPRN_NUMBER}}_previous_consumption_override_rates`

Expand Down
82 changes: 82 additions & 0 deletions _docs/services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Services

- [Services](#services)

There are a few services available within this integration, which are detailed here.

## Service octopus_energy.purge_invalid_external_statistic_ids

Service for removing all external statistics that are associated with meters that don't have an active tariff. This is useful if you've been using the integration and obtained new smart meters.

## Service octopus_energy.refresh_previous_consumption_data

Service for refreshing the consumption/cost information for a given previous consumption entity. This is useful when you've just installed the integration and want old data brought in or a previous consumption sensor fails to import (e.g. data becomes available outside of the configured offset). The service will raise a notification when the refreshing starts and finishes.

This service is only available for the following sensors

- `sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption`
- `sensor.octopus_energy_gas_{{METER_SERIAL_NUMBER}}_{{MPRN_NUMBER}}_previous_accumulative_consumption`

## Service octopus_energy.update_target_config

Service for updating a given [target rate's](./setup_target_rate.md) config. This allows you to change target rates sensors dynamically based on other outside criteria (e.g. you need to adjust the target hours to top up home batteries).

> Please note this is temporary and will not persist between restarts.
| Attribute | Optional | Description |
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `target.entity_id` | `no` | The name of the target sensor whose configuration is to be updated |
| `data.target_hours` | `yes` | The optional number of hours the target rate sensor should come on during a 24 hour period. Must be divisible by 0.5. |
| `data.target_start_time` | `yes` | The optional time the evaluation period should start. Must be in the format of `HH:MM`. |
| `data.target_end_time` | `yes` | The optional time the evaluation period should end. Must be in the format of `HH:MM`. |
| `data.target_offset` | `yes` | The optional offset to apply to the target rate when it starts. Must be in the format `(+/-)HH:MM:SS` |

This can be used via automations in the following way. Assuming we have the following inputs.

```yaml
input_number:
octopus_energy_target_hours:
name: Octopus Energy Target Hours
min: 0
max: 24

input_text:
# From/to would ideally use input_datetime, but we need the time in a different format
octopus_energy_target_from:
name: Octopus Energy Target From
initial: "00:00"
octopus_energy_target_to:
name: Octopus Energy Target To
initial: "00:00"
octopus_energy_target_offset:
name: Octopus Energy Target Offset
initial: "-00:00:00"
```
Then an automation might look like the following
```yaml
automations:
- alias: Update target rate config
trigger:
- platform: state
entity_id:
- input_number.octopus_energy_target_hours
- input_text.octopus_energy_target_from
- input_text.octopus_energy_target_to
- input_text.octopus_energy_target_offset
condition: []
action:
- service: octopus_energy.update_target_config
data:
target_hours: >
"{{ states('input_number.octopus_energy_target_hours') | string }}"
target_start_time: >
{{ states('input_text.octopus_energy_target_from') }}
target_end_time: >
{{ states('input_text.octopus_energy_target_to') }}
target_offset: >
{{ states('input_text.octopus_energy_target_offset') }}
target:
entity_id: binary_sensor.octopus_energy_target_example
```
46 changes: 1 addition & 45 deletions _docs/setup_account.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,15 @@
# Setup Account

- [Setup Account](#setup-account)
- [Electricity Sensors](#electricity-sensors)
- [Gas Sensors](#gas-sensors)
- [Saving Sessions](#saving-sessions)
- [Home Mini](#home-mini)
- [Refresh Rate In Minutes](#refresh-rate-in-minutes)
- [Intelligent Tariff](#intelligent-tariff)
- [Previous Consumption Days Offset](#previous-consumption-days-offset)
- [Calorific Value](#calorific-value)
- [Government Pricing Caps](#government-pricing-caps)
- [Services](#services)
- [Service octopus\_energy.purge\_invalid\_external\_statistic\_ids](#service-octopus_energypurge_invalid_external_statistic_ids)
- [Service octopus\_energy.refresh\_previous\_consumption\_data](#service-octopus_energyrefresh_previous_consumption_data)


Setup is done entirely via the [integration UI](https://my.home-assistant.io/redirect/config_flow_start/?domain=octopus_energy).

When you setup your account, you will get a few sensors.

## Electricity Sensors

A full list of electricity sensors can be found [here](./sensors/electricity.md).

## Gas Sensors

A full list of gas sensors can be found [here](./sensors/gas.md).

## Saving Sessions

To support Octopus Energy's [saving sessions](https://octopus.energy/saving-sessions/). A full list of sensors can be found [here](./sensors/saving_sessions.md).

## Home Mini

If you are lucky enough to own an [Octopus Home Mini](https://octopus.energy/blog/octopus-home-mini/), you can now receive this data within Home Assistant. When setting up (or editing) your account within Home Assistant, you will need to check the box next to `I have a Home Mini`. This will gain the following sensors which can be added to the [energy dashboard](https://www.home-assistant.io/blog/2021/08/04/home-energy-management/):
Expand All @@ -47,14 +26,6 @@ This determines how often data related to your Home Mini is retrieved from Octop

You can adjust these independently between gas and electricity.

## Intelligent Tariff

If you are on the [intelligent tariff](https://octopus.energy/smart/intelligent-octopus/), then you'll get a few additional sensors when you install the integration.

A full list of intelligent sensors can be found [here](./sensors/intelligent.md)

> Please note: If you switch to the intelligent tariff after you have installed the integration, you will need to reload the integration or restart your Home Assistant instance.
## Previous Consumption Days Offset

By default, the previous consumptions sensors are set up to pull and record the last days worth of data, to be as up-to-date as possible via the default available data. However, some people may find that Octopus Energy are delayed in being able to retrieve data from their smart meters, typically their gas smart meters. Therefore you can adjust the number of days the previous consumption sensors pull data from. This defaults to the previous day, but increasing to `2` would look at 48 hours behind, and so on. You can adjust this independently between gas and electricity.
Expand All @@ -65,19 +36,4 @@ When calculating gas costs, a calorific value is included in the calculation. Un

## Government Pricing Caps

There has been inconsistencies across tariffs on whether government pricing caps are included or not. Therefore the ability to configure pricing caps has been added within you account. Please note that while rates are reflected straight away, consumption based sensors may take up to 24 hours to reflect. This is due to how they look at data and cannot be changed.

## Services

### Service octopus_energy.purge_invalid_external_statistic_ids

Service for removing all external statistics that are associated with meters that don't have an active tariff. This is useful if you've been using the integration and obtained new smart meters.

### Service octopus_energy.refresh_previous_consumption_data

Service for refreshing the consumption/cost information for a given previous consumption entity. This is useful when you've just installed the integration and want old data brought in or a previous consumption sensor fails to import (e.g. data becomes available outside of the configured offset). The service will raise a notification when the refreshing starts and finishes.

This service is only available for the following sensors

- `sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_previous_accumulative_consumption`
- `sensor.octopus_energy_gas_{{METER_SERIAL_NUMBER}}_{{MPRN_NUMBER}}_previous_accumulative_consumption`
There has been inconsistencies across tariffs on whether government pricing caps are included or not. Therefore the ability to configure pricing caps has been added within you account. Please note that while rates are reflected straight away, consumption based sensors may take up to 24 hours to reflect. This is due to how they look at data and cannot be changed.
Loading

0 comments on commit 24867e1

Please sign in to comment.