Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next Release 2023-10 #440

Merged
merged 17 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
cd4d7c4
chore: Merged main into develop
github-actions[bot] Sep 23, 2023
0faccaa
chore: Updated sensors to inherit from RestoreSensor (as recommended …
BottlecapDave Sep 24, 2023
a84a91d
feat: Added service to support manually refreshing previous consumpti…
BottlecapDave Sep 25, 2023
ba41e73
fix: Added additional checks in cost override sensors
BottlecapDave Sep 27, 2023
1e0315e
feat: Added new sensors and events to expose various rate information
BottlecapDave Sep 29, 2023
a764036
refactor: Split up background data coordinators to focus on a single …
BottlecapDave Oct 3, 2023
82fecf1
fix: Removed tracker tariff potentially looking at wrong API for stan…
BottlecapDave Oct 3, 2023
526715e
chore: Added more checks when retrieving checks
BottlecapDave Oct 5, 2023
e621af1
fix: Fixed previous consumption to run calls in parallel
BottlecapDave Oct 5, 2023
3345eab
chore: Fixed intelligent settings coordinator
BottlecapDave Oct 5, 2023
d5461e0
chore: Increased minimum version of HA
BottlecapDave Oct 5, 2023
6be5ea6
fix: Fixed entry already configured error
BottlecapDave Oct 6, 2023
b1abf06
chore: Updated documentation link
BottlecapDave Oct 6, 2023
030f68f
test: Added tests to cover 441
BottlecapDave Oct 7, 2023
df74d13
fix: Fixed issue where export rates were adjusted during intelligent …
BottlecapDave Oct 7, 2023
bbf7082
docs: Updated community graphs to use new event entities
BottlecapDave Oct 7, 2023
5e75d01
chore: Added serial number to raised events
BottlecapDave Oct 7, 2023
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
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [Manual](#manual)
- [How to setup](#how-to-setup)
- [Target Rate Sensors](#target-rate-sensors)
- [Events](#events)
- [Energy Dashboard](#energy-dashboard)
- [Community Contributions](#community-contributions)
- [FAQ](#faq)
Expand Down Expand Up @@ -39,7 +40,7 @@ To install, place the contents of `custom_components` into the `<config director

## How to setup

Please follow the [setup guide](./_docs/setup_account.md) to setup your initial account. This will include a few sensors be default depending on your account.
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

Expand All @@ -49,6 +50,10 @@ These sensors can then be used in automations to turn on/off devices that save y

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.
Expand Down
52 changes: 43 additions & 9 deletions _docs/community.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type: custom:apexcharts-card
decimals: 1
series:
- entity: >-
sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_rate
event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_day_rates
type: column
name: ''
color: yellow
Expand All @@ -45,7 +45,23 @@ type: custom:apexcharts-card
in_header: false
legend_value: false
data_generator: |
return entity.attributes.all_rates.map((entry) => {
return entity.attributes.rates.map((entry) => {
return [new Date(entry.valid_from), entry.value_inc_vat];
});
offset: '-15min'
- entity: >-
event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_next_day_rates
type: column
name: ''
color: yellow
opacity: 1
stroke_width: 0
unit: W
show:
in_header: false
legend_value: false
data_generator: |
return entity.attributes.rates.map((entry) => {
return [new Date(entry.valid_from), entry.value_inc_vat];
});
offset: '-15min'
Expand Down Expand Up @@ -138,9 +154,12 @@ If you're looking to combine import and export rates then create a card with the
```yaml
type: custom:config-template-card
entities:
- sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_rate
- event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_day_rates
- event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_next_day_rates
- >-
event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_export_current_day_rates
- >-
sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_export_current_rate
event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_export_next_day_rates
card:
card_mod:
style: |
Expand Down Expand Up @@ -169,19 +188,34 @@ card:
stroke_width: 2
fill_raw: 'null'
series:
- entity: sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_rate
name: Import
- entity: event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_day_rates
name: Import today
curve: stepline
data_generator: |
return entity.attributes.rates.map((entry) => {
return [new Date(entry.valid_from), entry.value_inc_vat/100];
});
- entity: event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_next_day_rates
name: Import tomorrow
curve: stepline
data_generator: |
return entity.attributes.rates.map((entry) => {
return [new Date(entry.valid_from), entry.value_inc_vat/100];
});
- entity: >-
event.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_export_current_day_rates
name: Export
curve: stepline
data_generator: |
return entity.attributes.all_rates.map((entry) => {
return entity.attributes.rates.map((entry) => {
return [new Date(entry.valid_from), entry.value_inc_vat/100];
});
- entity: >-
sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_export_current_rate
sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_export_next_day_rates
name: Export
curve: stepline
data_generator: |
return entity.attributes.all_rates.map((entry) => {
return entity.attributes.rates.map((entry) => {
return [new Date(entry.valid_from), entry.value_inc_vat/100];
});
apex_config:
Expand Down
162 changes: 162 additions & 0 deletions _docs/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# Events

- [Events](#events)
- [Electricity Current Day Rates](#electricity-current-day-rates)
- [Electricity Previous Day Rates](#electricity-previous-day-rates)
- [Electricity Next Day Rates](#electricity-next-day-rates)
- [Electricity Previous Consumption Rates](#electricity-previous-consumption-rates)
- [Electricity Previous Consumption Override Rates](#electricity-previous-consumption-override-rates)
- [Gas Current Day Rates](#gas-current-day-rates)
- [Gas Previous Day Rates](#gas-previous-day-rates)
- [Gas Next Day Rates](#gas-next-day-rates)
- [Gas Previous Consumption Rates](#gas-previous-consumption-rates)
- [Gas Previous Consumption Override Rates](#gas-previous-consumption-override-rates)

The following events are raised by the integration. These events power various sensors mentioned above. They can also be used to trigger automations. An example automation might look like the following

```yaml
- alias: OE rates change
trigger:
- platform: event
event_type: octopus_energy_electricity_next_day_rates
condition: []
action:
- event: notify_channels
event_data_template:
mode: message
title: OE price changes
message: >
New rates available for {{ trigger.event.data.mpan }}. Starting value is {{ trigger.event.data.rates[0]["value_inc_vat"] }}
target: <@ULU7111GU>
length_hint: 00:00:04
```

## Electricity Current Day Rates

`octopus_energy_electricity_current_day_rates`

This is fired when the current day rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the current day |
| `tariff_code` | `string` | The tariff code associated with current day's rates |
| `mpan` | `string` | The mpan of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Electricity Previous Day Rates

`octopus_energy_electricity_previous_day_rates`

This is fired when the previous day rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the previous day |
| `tariff_code` | `string` | The tariff code associated with previous day's rates |
| `mpan` | `string` | The mpan of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Electricity Next Day Rates

`octopus_energy_electricity_next_day_rates`

This is fired when the next day rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the next day |
| `tariff_code` | `string` | The tariff code associated with next day's rates |
| `mpan` | `string` | The mpan of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Electricity Previous Consumption Rates

`octopus_energy_electricity_previous_consumption_rates`

This is fired when the [previous consumption's](./sensors/electricity.md#previous-accumulative-consumption) rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the previous consumption |
| `tariff_code` | `string` | The tariff code associated with previous consumption's rates |
| `mpan` | `string` | The mpan of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Electricity Previous Consumption Override Rates

`octopus_energy_electricity_previous_consumption_override_rates`

This is fired when the [previous consumption override's](./sensors/electricity.md#tariff-overrides) rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the previous consumption override |
| `tariff_code` | `string` | The tariff code associated with previous consumption override's rates |
| `mpan` | `string` | The mpan of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Gas Current Day Rates

`octopus_energy_gas_current_day_rates`

This is fired when the current day rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the current day |
| `tariff_code` | `string` | The tariff code associated with current day's rates |
| `mprn` | `string` | The mprn of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Gas Previous Day Rates

`octopus_energy_gas_previous_day_rates`

This is fired when the previous day rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the previous day |
| `tariff_code` | `string` | The tariff code associated with previous day's rates |
| `mprn` | `string` | The mprn of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Gas Next Day Rates

`octopus_energy_gas_next_day_rates`

This is fired when the next day rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the next day |
| `tariff_code` | `string` | The tariff code associated with next day's rates |
| `mprn` | `string` | The mprn of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Gas Previous Consumption Rates

`octopus_energy_gas_previous_consumption_rates`

This is fired when the [previous consumption's](./sensors/gas.md#previous-accumulative-consumption) rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the previous consumption |
| `tariff_code` | `string` | The tariff code associated with previous consumption's rates |
| `mprn` | `string` | The mprn of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |

## Gas Previous Consumption Override Rates

`octopus_energy_gas_previous_consumption_override_rates`

This is fired when the [previous consumption override's](./sensors/gas.md#tariff-overrides) rates are updated.

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `list` | The list of rates applicable for the previous consumption override |
| `tariff_code` | `string` | The tariff code associated with previous consumption override's rates |
| `mprn` | `string` | The mprn of the meter associated with these rates |
| `serial_number` | `string` | The serial number of the meter associated with these rates |
Loading
Loading