Skip to content

Commit 32bc109

Browse files
committed
chore: Added repair notice around sensors and updated docs (45 minutes dev time)
1 parent f895b64 commit 32bc109

File tree

5 files changed

+103
-1
lines changed

5 files changed

+103
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# 0003 - Move to calendar entities for Octoplus events
2+
3+
## Status
4+
Accepted
5+
6+
## Context
7+
8+
Currently binary sensors are provided to indicate when a saving or free electricity session is active for the current account. This also provides attributes for current and next start/end times.
9+
10+
Since the introduction of the saving session binary sensor, calendar entities have received more love within Home Assistant and become the preferred way of showing events. These are better supports in UI automations as you can offset calendar events easily (e.g. reminder 10 minutes before) without having to do template gymnastics. The calendar view of Home Assistant is also used by house hold members who are not as involved as other members in things like wall tablets. A few users move the data from the sensor data into a local calendar to produce this.
11+
12+
This request has been made on a few occasions, below are some samples
13+
14+
* https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/561#issuecomment-1826830172
15+
* https://github.com/BottlecapDave/HomeAssistant-OctopusEnergy/issues/1397
16+
17+
## Decision
18+
19+
With more people coming on board to Home Assistant who don't necessarily come from a technological background, the automation UI becoming the preferred way of creating automations and the calendar entity getting more love, it has been decided to convert the saving session and free electricity sessions into calendar entities.
20+
21+
The old sensors will continue to be available until **May 2026** when they will be removed, to ease with the transition.
22+
23+
## Consequences
24+
25+
### Positive
26+
- Automations around sessions will be easier via the calendar trigger
27+
- Past and present sessions will be easily viewable in the Home Assistant Calendar view
28+
- Standard approach for people used to calendar entities.
29+
30+
### Negative
31+
- Users using effected entities will need to update all references
32+
- Some short-term disruption may occur as users adapt to the new entity behaviour.
33+
- Event duration (e.g. 60 minutes) will require templating still

_docs/entities/octoplus.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Determines the current Octoplus points balance. This sensor will only be availab
1818

1919
## Saving Sessions
2020

21+
!!! warning
22+
23+
This sensor has been deprecated in favour of [Saving Session Calendar](#saving-sessions-calendar) and will be removed around **May 2026**
24+
2125
`binary_sensor.octopus_energy_{{ACCOUNT_ID}}_octoplus_saving_sessions`
2226

2327
Binary sensor to indicate if a saving session that the account has joined is active.
@@ -35,6 +39,20 @@ Binary sensor to indicate if a saving session that the account has joined is act
3539

3640
You can use the [data_last_retrieved sensor](./diagnostics.md#saving-sessions-data-last-retrieved) to determine when the underlying data was last retrieved from the OE servers.
3741

42+
## Saving Sessions Calendar
43+
44+
`calendar.octopus_energy_{{ACCOUNT_ID}}_octoplus_saving_sessions`
45+
46+
Calendar sensor to record saving sessions. Will be `on` when a saving session that the account has joined is active. Standard calendar attributes will indicate the current/next saving session.
47+
48+
!!! info
49+
50+
You can use the [data_last_retrieved sensor](./diagnostics.md#saving-sessions-data-last-retrieved) to determine when the underlying data was last retrieved from the OE servers.
51+
52+
!!! note
53+
54+
The events are supplied by OE API and does not store past events indefinitely. Past events could be removed without notice.
55+
3856
## Saving Session Events
3957

4058
`event.octopus_energy_{{ACCOUNT_ID}}_octoplus_saving_session_events`
@@ -121,6 +139,10 @@ Each item within `baselines` consists of the following attributes
121139

122140
## Free Electricity Sessions
123141

142+
!!! warning
143+
144+
This sensor has been deprecated in favour of [Free Electricity Sessions Calendar](#free-electricity-sessions-calendar) and will be removed around **May 2026**
145+
124146
`binary_sensor.octopus_energy_{{ACCOUNT_ID}}_octoplus_free_electricity_session`
125147

126148
Binary sensor to indicate if a free electricity session is active.
@@ -140,6 +162,22 @@ Binary sensor to indicate if a free electricity session is active.
140162
| `next_event_end` | `datetime` | The datetime the next free electricity session will end |
141163
| `next_event_duration_in_minutes` | `float` | The duration in minutes of the next free electricity session |
142164

165+
!!! info
166+
167+
You can use the [data_last_retrieved sensor](./diagnostics.md#free-electricity-sessions-data-last-retrieved) to determine when the underlying data was last retrieved from the OE servers.
168+
169+
## Free Electricity Sessions Calendar
170+
171+
`calendar.octopus_energy_{{ACCOUNT_ID}}_octoplus_free_electricity_session`
172+
173+
Calendar sensor to record free electricity sessions. Will be `on` when a free electricity session is active. Standard calendar attributes will indicate the current/next saving session.
174+
175+
!!! note
176+
This will only be available if you have enrolled into Octoplus. Once enrolled, reload the integration to gain access to this sensor. This is only applicable if you have signed up to [free electricity sessions](https://octopus.energy/free-electricity/). This sensor uses public information supplied by https://github.com/BottlecapDave/OctopusEnergyApi.
177+
178+
!!! note
179+
This is [disabled by default](../faq.md#there-are-entities-that-are-disabled-why-are-they-disabled-and-how-do-i-enable-them).
180+
143181
!!! info
144182

145183
You can use the [data_last_retrieved sensor](./diagnostics.md#free-electricity-sessions-data-last-retrieved) to determine when the underlying data was last retrieved from the OE servers.

custom_components/octopus_energy/binary_sensor.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
DATA_ELECTRICITY_RATES_COORDINATOR_KEY,
4646
DATA_SAVING_SESSIONS_COORDINATOR,
4747
DATA_ACCOUNT,
48+
REPAIR_FREE_ELECTRICITY_SESSION_BINARY_SENSOR_DEPRECATED,
49+
REPAIR_SAVING_SESSION_BINARY_SENSOR_DEPRECATED,
4850
REPAIR_TARGET_RATE_REMOVAL_PROPOSAL
4951
)
5052

@@ -137,8 +139,27 @@ async def async_setup_main_sensors(hass, entry, async_add_entities):
137139
OctopusEnergyGreennessForecastHighlighted(hass, greenness_forecast_coordinator, account_id)
138140
]
139141

142+
ir.async_create_issue(
143+
hass,
144+
DOMAIN,
145+
REPAIR_SAVING_SESSION_BINARY_SENSOR_DEPRECATED,
146+
is_fixable=False,
147+
severity=ir.IssueSeverity.WARNING,
148+
learn_more_url="https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/architecture_decision_records/0003_move_to_calendar_entities_for_octoplus_events",
149+
translation_key="saving_session_binary_sensor_deprecated",
150+
)
151+
140152
if octoplus_enrolled:
141-
entities.append(OctopusEnergyFreeElectricitySessions(hass, free_electricity_session_coordinator, account_id))
153+
entities.append(OctopusEnergyFreeElectricitySessions(hass, free_electricity_session_coordinator, account_id))
154+
ir.async_create_issue(
155+
hass,
156+
DOMAIN,
157+
REPAIR_FREE_ELECTRICITY_SESSION_BINARY_SENSOR_DEPRECATED,
158+
is_fixable=False,
159+
severity=ir.IssueSeverity.WARNING,
160+
learn_more_url="https://bottlecapdave.github.io/HomeAssistant-OctopusEnergy/architecture_decision_records/0003_move_to_calendar_entities_for_octoplus_events",
161+
translation_key="free_electricity_session_binary_sensor_deprecated",
162+
)
142163

143164
if len(account_info["electricity_meter_points"]) > 0:
144165

custom_components/octopus_energy/const.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@
214214
REPAIR_INTELLIGENT_DEVICE_NOT_FOUND = "intelligent_device_not_found_{}"
215215
REPAIR_INTELLIGENT_DEVICE_CHANGED = "intelligent_device_changed_{}"
216216
REPAIR_TARIFF_RATES_EMPTY = "tariff_rates_empty_{}_{}"
217+
REPAIR_SAVING_SESSION_BINARY_SENSOR_DEPRECATED = "saving_session_binary_sensor_deprecated"
218+
REPAIR_FREE_ELECTRICITY_SESSION_BINARY_SENSOR_DEPRECATED = "saving_session_binary_sensor_deprecated"
217219

218220
# During BST, two records are returned before the rest of the data is available
219221
MINIMUM_CONSUMPTION_DATA_LENGTH = 3

custom_components/octopus_energy/translations/en.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,14 @@
411411
"tariff_rates_empty": {
412412
"title": "{meter_type} {tariff_code} rates are empty for {account_id} ({mprn_mpan}/{serial_number})",
413413
"description": "One of your meters ({mprn_mpan}/{serial_number}) is associated with tariff \"{tariff_code}\" for product \"{product_code}\", but no longer seems to be returning new rates. Please click \"Learn More\" with details on how to rectify this."
414+
},
415+
"saving_session_binary_sensor_deprecated": {
416+
"title": "Saving session binary sensor deprecated",
417+
"description": "The saving session binary sensor has been deprecated in favour of using calendar entities. This will allow for better integration with automations and the calendar view. Please click \"Learn More\" for more information on this change."
418+
},
419+
"free_electricity_session_binary_sensor_deprecated": {
420+
"title": "Free electricity session binary sensor deprecated",
421+
"description": "The free electricity session binary sensor has been deprecated in favour of using calendar entities. This will allow for better integration with automations and the calendar view. Please click \"Learn More\" for more information on this change."
414422
}
415423
}
416424
}

0 commit comments

Comments
 (0)