v0.7.0
π· EP Cube Integration v0.7.0 β Per-Tier Rate Entry on TOU Card
Phase 4.1++ closes the TOU editor's last functional gap: per-tier prices are now editable from the card, not just preserved server-side. The cube's internal tier prices are cosmetic for Predbat users (Predbat optimises against your real Octopus tariff), but for fixed-tariff and non-Predbat users they're load-bearing β and previously the only way to set them was via the EP Cube mobile app.
β¨ What's new
-
Per-tier rate inputs in the editor card β three p/kWh inputs per tab (Peak / Mid-peak / Off-peak Γ Workday / Weekend), inline with each tier's "Add slot" button. Hydrates on first load from a new
tou_pricesextra-state-attribute onselect.ep_cube_operating_mode. Type a value to override; leave blank to keep the cube's existing per-tier price. Placeholder shows the cube's factory default for empty tiers (40/25/5p/kWh for peak / mid-peak / off-peak). -
Optional
pricesarg onep_cube.set_tou_scheduleβ pass a dict with up to 6 keys (peak_workday,mid_peak_workday,off_peak_workday,peak_weekend,mid_peak_weekend,off_peak_weekend) to override per-tier prices in p/kWh. Range 0-999. Tiers omitted from the dict fall through to preserve-from-cube semantics (existing behaviour). Backwards-compatible β pre-v0.7 callers withoutpricessee no behaviour change. -
parse_tou_prices()helper +tou_pricesattribute β sibling toparse_tou_schedule/tou_schedule. Returns the price of the first non-shim slot in each tier, orNoneif the tier is empty (so the card can show a placeholder instead of a misleading "real" value). Automations can read it directly from the select entity's attributes.
π Fixed
- Card hydration race β the card's first-load guard used to flip
trueas soon as the schedule attribute appeared, even iftou_priceswasn't there yet. Result: rate inputs stayed blank forever until the user clicked "Reload from cube" manually. v0.7.0 only sets the guard once prices have successfully landed, so schedule-only ticks keep retrying.
π§Ή Cleanup
- Dropped the v0.6.3 legacy synthetic-price tokens (
0.01/0.20/1.00) from the strip set β the one-release migration window has expired. Any pre-v0.6.3 in-flight Predbat overrides have long since rotated out. Slots with these prices on your cube would now look like genuine user slots, which was the whole reason for the v0.6.3 migration in the first place (they collided with realistic fixed-tariff prices and were silently dropping user data from the editor card's hydrated view).
π Service contract (new field highlighted)
service: ep_cube.set_tou_schedule
data:
peak_workday: ["16:00-19:00"]
mid_peak_workday: ["04:30-16:00", "19:00-23:59"]
off_peak_workday: ["00:30-04:30"]
peak_weekend: []
mid_peak_weekend: []
off_peak_weekend: []
switch_to_tou: false # optional
prices: # β¨ NEW in v0.7.0, optional
off_peak_workday: 8.5 # p/kWh
peak_workday: 28.5
device_id: "5613" # optionalEach prices key independently routes through: (1) explicit value β (2) cube's existing price β (3) factory default. Pass none of them and behaviour matches pre-v0.7. Pass some of them and only those tiers get overridden.
π Precision note
The cube's wire format is 2dp on the Β£-scale = 1p resolution per tier. Sub-p input (e.g. 19.25 p/kWh from an Octopus Agile rate) rounds to 19 on save. Documented in the service description, the card hint text, and services.py. For Predbat users this is irrelevant (Predbat optimises against the real Octopus rate, not the cube's internal prices). For fixed-tariff users UK tariffs are usually quoted to whole pence anyway.
π§ͺ Tests
Suite is now 229 tests (was 200 in v0.6.4):
- 23 new cases in
tests/test_set_tou_schedule.pycovering thepricesarg (full override, partial preservation, empty-cube-tier with explicit price, schema validation, sub-penny rounding, string coercion, 2-write dance interaction, zero-price accepted) and the newparse_tou_priceshelper +_first_non_shim_priceshared scanner. - 3 hard-coded legacy synthetic prices in
tests/test_shim.pyreplaced withSHIM_PRICE_*constants. - 1 new case verifying legacy prices (
0.01/0.20/1.00) now flow through as user slots instead of being stripped.
All green on Python 3.12 in CI + local Synology container.
π¦ Upgrading
- HACS users: bump from v0.6.4 β v0.7.0 in the HACS UI.
- Manual users: re-copy
custom_components/ep_cube/+www/ep-cube-tou-editor.jsfrom the release zip; bump the card's resource version (Settings β Dashboards β Resources β change/local/ep-cube-tou-editor.js?v=0.6.4to?v=0.7.0) so browsers re-fetch. - HA restart required β Python-side service + entity changes.
π£ What's next
- v0.7.x β placeholder defaults driven by
predbat.metric_low_rate_threshold/high_rate_threshold(or the current Octopus rate via the BottlecapDave integration) instead of static constants. Chipped during v0.7.0 testing. - v0.7.x β
queryDataElectricityV2cloud-stats expansion (signed grid import/export,*_yesterdayvariants, lifetime totals withRestoreSensorseeding) β waiting on a mitmproxy capture session. - v0.8 β auto-paint TOU schedule from Predbat's rate thresholds + Agile forecast (one-click "match Predbat's bucketing").
β Support
If this saves you the mitmproxy sessions and Python hours it took to build, consider tossing a ko-fi in the tank. Thanks!
Not affiliated with or endorsed by Canadian Solar or EP Cube.