Skip to content

Commit

Permalink
Cosy 6 Support (#1139)
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave authored Dec 26, 2024
2 parents 9294764 + c3a7b8e commit 4e978fc
Show file tree
Hide file tree
Showing 49 changed files with 934 additions and 260 deletions.
14 changes: 14 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Setup dependencies
description: Sets up required dependencies
runs:
using: composite
steps:
- name: Install dependencies
run: sudo apt install libffi-dev libncurses5-dev zlib1g zlib1g-dev libssl-dev libreadline-dev libbz2-dev libsqlite3-dev
shell: bash
- name: asdf_install
uses: asdf-vm/actions/install@v3
- name: Install Python modules
run: |
pip install -r requirements.test.txt
shell: bash
6 changes: 5 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
- 'mkdocs.yml'
- '_docs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -30,7 +34,7 @@ jobs:
restore-keys: |
mkdocs-material-
- run: pip install -r requirements.txt
- run: mkdocs build --strict
- run: mkdocs build

deploy_docs:
if: ${{ github.repository_owner == 'BottlecapDave' && (github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main') }}
Expand Down
27 changes: 10 additions & 17 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ on:
paths-ignore:
- 'mkdocs.yml'
- '_docs/**'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
if: ${{ github.event_name != 'schedule' || github.repository_owner == 'BottlecapDave' }}
name: Validate
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
# - uses: "home-assistant/actions/hassfest@master" # Disabled due to https://github.com/home-assistant/actions/issues/116
- uses: "home-assistant/actions/hassfest@master"
- name: HACS Action
uses: "hacs/action@main"
with:
Expand All @@ -37,14 +42,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: sudo apt install libffi-dev libncurses5-dev zlib1g zlib1g-dev libssl-dev libreadline-dev libbz2-dev libsqlite3-dev
shell: bash
- name: asdf_install
uses: asdf-vm/actions/install@v3
- name: Install Python modules
run: |
pip install -r requirements.test.txt
- name: Setup
uses: ./.github/actions/setup
- name: Run unit tests
run: |
python -m pytest tests/unit
Expand All @@ -58,14 +57,8 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install dependencies
run: sudo apt install libffi-dev libncurses5-dev zlib1g zlib1g-dev libssl-dev libreadline-dev libbz2-dev libsqlite3-dev
shell: bash
- name: asdf_install
uses: asdf-vm/actions/install@v3
- name: Install Python modules
run: |
pip install -r requirements.test.txt
- name: Setup
uses: ./.github/actions/setup
- name: Run integration tests
run: |
python -m pytest tests/integration
Expand Down
24 changes: 7 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
# [13.4.0-beta.1](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/compare/v13.3.0...v13.4.0-beta.1) (2024-12-21)
# [13.4.0](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/compare/v13.3.0...v13.4.0) (2024-12-26)


### Bug Fixes

* Fixed heat pump retrieved at parsing (15 minutes dev time) ([cd47109](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/cd471094811f120a56c6fa4a7498d532ad32a3bc))
* Fixed heat pump retrieved at parsing (15 minutes dev time) ([#1118](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/1118)) ([aeac537](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/aeac537b1624e1b6bbcb4e8d9089ae44d9ee3f09))
* Fixed issue with setting heat pump zone temperature when in boost mode (30 minutes dev time) ([c0cfe69](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/c0cfe69c9e36067e8732bdb5305915f2acfefa02))
* Fixed zone mode interpretations in zone climate control and exposed target temperature in boost service (30 minutes dev time) ([7eb6755](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/7eb67553119773616097b6cc9360e03ed793fb46))
* Fixed state class for current total consumption sensors (5 minutes dev time) ([9af97a5](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/9af97a54b7a9dfb091f4e48f0cd66f758e7e2629))
* Updated total consumption sensors to ignore zero based results reported by home pro (10 minute dev time) ([78748d1](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/78748d169887227de1a2f1f8bc73dfd1bf281190))


### Features

* Added ability to change zone modes and target temperatures (1 hour dev time) ([56aef85](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/56aef85031be5e4b9a5bb5621b042a5616304fc7))
* Added climate control for heat pump zone (3 hours dev time) ([5e72161](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/5e72161a180119110be950322dfafeab6b755b27))
* Added endpoint to get heat pump configuration and status ([1826925](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/1826925513a288bc1b6a4772c305deb7cf3dc6d6))
* Added heat pump humidity sensor (1 hour dev time) ([b479c89](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/b479c8999256a70273077c8c0b5f001decbdbf84))
* Added heat pump information to device diagnostics (30 minutes dev time) ([b8468bc](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/b8468bce31a4dff419b3bfe21392911b88f05f0d))
* Added temperature sensors from heat pumps (2.5 hours dev time) ([c79e5b8](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/c79e5b8bdb50ee974027e2f5d9a7a16360634621))
* Created heat pump boosting action to support custom end time (40 minutes dev time) ([bc047f8](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/bc047f866a2047cd3d2cc059cce362d2f56a2ada))
* Fixed heat pump service calls (30 minutes dev time) ([ff88cd4](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/ff88cd419b626daccb10d236a772b27931a4f08a))
* Updated account to include heat pump ids (5 minutes dev time) ([5c411c8](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/5c411c8efafc41ca323ae4d8415f03cb213da282))
* Updated heat pump zone min/max temperatures based on zone type (5 minutes dev time) ([2ce5fe6](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/2ce5fe64456434552d581aaaa311030fa0cec8f4))
* Updated heat pump zones and sensors to not be included if not enabled (5 minutes dev time) ([f762c4d](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/f762c4d214ba635abc8447536a75e4e1402ffea1))
* Added ability to apply weightings to rates from external sources for use with target rate and rolling target rate sensors (4 hours 30 minutes dev time) ([9350c3f](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/9350c3fbdb46514033a175e1db7e521b2fc07835))
* Added support for INDRA intelligent provider (5 minutes dev time) ([7c3596c](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/7c3596cc920957dfe7ca23e42828aad826e44c43))
* Updated Home Pro config to support custom API being optional if certain features are not required (see docs for more information) (45 minutes dev time) ([8b94c7d](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/8b94c7d15109476acb53f930762c7ee17a4e0ed6))
* Updated Home Pro to contact local API directly instead of via custom API (45 minutes dev time) ([0ace45e](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/0ace45e325bdbb104a24787bc26556e09e3d804e))
* Updated manufacturer of heat pump and heat pump sensors (5 minutes dev time) ([d68e8b6](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/d68e8b6893f8391a20b5d787fb6c6f0dda1fba1a))
* Updated target rates to support additional re-evaluation modes for target times. This is to assist with external weightings changing (30 minutes dev time) ([05db8c2](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/commit/05db8c2ffcbdc39341a6e419c77bf9113a6aebe6))

# [13.3.0](https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/compare/v13.2.1...v13.3.0) (2024-12-16)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Below are the main features of the integration
* [Saving sessions support](https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/octoplus/#saving-sessions)
* [Wheel of fortune support](https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/wheel_of_fortune/)
* [Greener days support](https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/greenness_forecast)
* [Heat Pump support](https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/entities/heat_pump)

## How to install

Expand Down
Binary file added _docs/assets/total_consumption_electricity.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/total_consumption_gas.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions _docs/entities/heat_pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Heat Pump

The following entities are available if you have a heat pump registered against your account. The following heat pumps are known to be compatible

* Cosy 6

## Humidity Sensor

`sensor.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_{{SENSOR_CODE}}_humidity`

This represents the humidity reported by a sensor (e.g. Cosy Pod) that is associated with a heat pump.

## Temperature Sensor

`sensor.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_{{SENSOR_CODE}}_temperature`

This represents the temperature reported by a sensor (e.g. Cosy Pod) that is associated with a heat pump.

## Zone

`climate.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_{{ZONE_CODE}}`

This can be used to control the target temperature and mode for a given zone (e.g. water or zone 1) linked to your heat pump. It will also display the current temperature linked to the primary sensor for the zone.

The following operation modes are available

* `Heat` - This represents as `on` in the app
* `Off` - This represents as `off` in the app
* `Auto` - This represents as `auto` in the app

In addition, there is the preset of `boost`, which activates boost mode for the zone for 1 hour. If you require boost to be on for a different amount of time, then you can use the [available service](../services.md#octopus_energyboost_heat_pump_zone).
6 changes: 5 additions & 1 deletion _docs/entities/home_pro.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ Once configured, the following entities will retrieve data locally from your Oct

`text.octopus_energy_{{ACCOUNT_ID}}_home_pro_screen`

Allows you to set scrolling text for the home pro device. If the text is greater than 3 characters, then it will scroll on the device, otherwise it will be statically displayed.
!!! info

This is only available if you have setup the [Custom API](../setup/account.md#home-pro).

Allows you to set scrolling text on the home pro device. If the text is greater than 3 characters, then it will scroll on the device, otherwise it will be statically displayed.
4 changes: 2 additions & 2 deletions _docs/entities/intelligent.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,5 +127,5 @@ If you're moving to this integration from [megakid/ha_octopus_intelligent](https
* `sensor.octopus_intelligent_offpeak_end` - The default off peak end date/time can be found as an attribute on the [off peak sensor](./electricity.md#off-peak). This can be extracted using a [template sensor](https://www.home-assistant.io/integrations/template/).
* `switch.octopus_intelligent_bump_charge` - Use the [bump charge sensor](#bump-charge)
* `switch.octopus_intelligent_smart_charging` - Use the [smart charge sensor](#smart-charge)
* `select.octopus_intelligent_target_time` - Use the [ready time sensor](#ready-time)
* `select.octopus_intelligent_target_soc` - Use the [charge limit sensor](#charge-limit)
* `select.octopus_intelligent_target_time` - Use the [target time sensor](#target-time)
* `select.octopus_intelligent_target_soc` - Use the [charge target sensor](#charge-target)
56 changes: 0 additions & 56 deletions _docs/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,34 +126,6 @@ This is fired when the [previous consumption's](./entities/electricity.md#previo
New rates available for {{ trigger.event.data.mpan }}. Starting value is {{ trigger.event.data.rates[0]["value_inc_vat"] }}
```

## Electricity Previous Consumption Override Rates

`octopus_energy_electricity_previous_consumption_override_rates`

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

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `array` | 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 |

### Automation Example

```yaml
- trigger:
- platform: event
event_type: octopus_energy_electricity_previous_consumption_override_rates
condition: []
action:
- service: persistent_notification.create
data:
title: "Rates Updated"
message: >
New rates available for {{ trigger.event.data.mpan }}. Starting value is {{ trigger.event.data.rates[0]["value_inc_vat"] }}
```

## Gas Current Day Rates

`octopus_energy_gas_current_day_rates`
Expand Down Expand Up @@ -278,34 +250,6 @@ This is fired when the [previous consumption's](./entities/gas.md#previous-accum
New rates available for {{ trigger.event.data.mprn }}. Starting value is {{ trigger.event.data.rates[0]["value_inc_vat"] }}
```

## Gas Previous Consumption Override Rates

`octopus_energy_gas_previous_consumption_override_rates`

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

| Attribute | Type | Description |
|-----------|------|-------------|
| `rates` | `array` | 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 |

### Automation Example

```yaml
- trigger:
- platform: event
event_type: octopus_energy_gas_previous_consumption_override_rates
condition: []
action:
- service: persistent_notification.create
data:
title: "Rates Updated"
message: >
New rates available for {{ trigger.event.data.mprn }}. Starting value is {{ trigger.event.data.rates[0]["value_inc_vat"] }}
```

## New Saving Session

`octopus_energy_new_octoplus_saving_session`
Expand Down
7 changes: 6 additions & 1 deletion _docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Below are the main features of the integration
* [Saving sessions support](#octoplus)
* [Wheel of fortune support](#wheel-of-fortune)
* [Greener days support](#greenness-forecast)
* [Heat Pump support](#heat-pumps)

## How to install

Expand Down Expand Up @@ -92,7 +93,7 @@ To support the wheel of fortune that is awarded every month to customers. [Full

### Greenness Forecast

To support Octopus Energy's [greener days](https://octopus.energy/smart/greener-days/). [Full list of greenness forecast entites](./entities/greenness_forecast.md).
To support Octopus Energy's [greener days](https://octopus.energy/smart/greener-days/). [Full list of greenness forecast entities](./entities/greenness_forecast.md).

## Target Rate Sensors

Expand All @@ -114,6 +115,10 @@ These sensors compare the cost of the previous consumption to another tariff to

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

### Heat Pumps

To support heat pumps connected to Octopus Energy, like the [Cosy 6](https://octopus.energy/cosy-heat-pump/). [Full list of heat pump entities](./entities/heat_pump.md).

## 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).
Expand Down
45 changes: 44 additions & 1 deletion _docs/services.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,47 @@ Allows you to adjust the consumption for any given period recorded by a [cost tr
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `target.entity_id` | `no` | The name of the cost tracker sensor(s) that should be updated (e.g. `sensor.octopus_energy_cost_tracker_{{COST_TRACKER_NAME}}`). |
| `data.date` | `no` | The date of the data within the cost tracker to be adjusted. |
| `data.consumption` | `no` | The new consumption recorded against the specified date. |
| `data.consumption` | `no` | The new consumption recorded against the specified date. |

## octopus_energy.register_rate_weightings

Allows you to configure weightings against rates at given times using factors external to the integration. These are applied when calculating [target rates](./setup/target_rate.md#external-rate-weightings) or [rolling target rates](./setup/rolling_target_rate.md#external-rate-weightings).

Rate weightings are added to any existing rate weightings that have been previously configured. Any rate weightings that are more than 24 hours old are removed. Any rate weightings for periods that have been previously configured are overridden.

| Attribute | Optional | Description |
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `target.entity_id` | `no` | The name of the electricity current rate sensor for the rates the weighting should be applied to (e.g. `sensor.octopus_energy_electricity_{{METER_SERIAL_NUMBER}}_{{MPAN_NUMBER}}_current_rate`). |
| `data.weightings` | `no` | The collection of weightings to add. Each item in the array should represent a given 30 minute period. Example array is `[{ "start": "2025-01-01T00:00:00Z", "end": "2025-01-01T00:30:00Z", "weighting": 0.1 }]` |

### Automation Example

This automation adds weightings based on the national grids carbon intensity, as provided by [Carbon Intensity](https://github.com/BottlecapDave/HomeAssistant-CarbonIntensity).

```yaml
- alias: Carbon Intensity Rate Weightings
triggers:
- platform: state
entity_id: event.carbon_intensity_national_current_day_rates
actions:
- action: octopus_energy.register_rate_weightings
target:
entity_id: sensor.octopus_energy_electricity_xxx_xxx_current_rate
data:
weightings: >
{% set forecast = state_attr('event.carbon_intensity_national_current_day_rates', 'rates') + state_attr('event.carbon_intensity_national_next_day_rates', 'rates') %}
{% set ns = namespace(list = []) %} {%- for a in forecast -%}
{%- set ns.list = ns.list + [{ "start": a.from.strftime('%Y-%m-%dT%H:%M:%SZ'), "end": a.to.strftime('%Y-%m-%dT%H:%M:%SZ'), "weighting": a.intensity_forecast | float }] -%}
{%- endfor -%} {{ ns.list }}
```

## octopus_energy.boost_heat_pump_zone

Allows you to boost a given heat pump zone for a set amount of time.

| Attribute | Optional | Description |
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------------------- |
| `target.entity_id` | `no` | The name of the heat pump zone boost mode should be applied to (e.g. `climate.octopus_energy_heat_pump_{{HEAT_PUMP_ID}}_{{ZONE_CODE}}`). |
| `data.hours` | `no` | The number of hours to turn boost mode on for. This can be between 0 and 12. |
| `data.minutes` | `no` | The number of minutes to turn boost mode on for. This can be 0, 15, or 45. |
| `data.target_temperature` | `yes` | The optional target temperature to boost to. If not supplied, then the current target temperature will be used. |
Loading

0 comments on commit 4e978fc

Please sign in to comment.