Repository navigation
Add mFRR activation sensor/event and total revenue; test in real Home Assistant - #11
Merged
Merged
Conversation
The 2026-10 web app's /ems/ActivationSchedule lists the site's actual mFRR activations (MfrrUpActivation/MfrrDownActivation). A new binary sensor is on while one is ongoing, and a new event entity fires "up" or "down" for each activation that appears after HA starts. Activations are fetched every 5 minutes; the on/off state is re-evaluated every cycle. A new Total Revenue sensor sums /revenue with resolution=month since 2023-01-01, as the dashboard does, with a per-service breakdown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
Update docs/api.md from a 2026-10-08 dashboard HAR: mFRR activations in ActivationSchedule (hourly SpotPrice removed), the mFRR EAM revenue service and monthly revenue, Day/Month/Period resolutions and savings data types in SiteMeasurements, and new fields in site, energyflow, Statuses, CustomerDetail and diagnostics responses. Describe the new sensors and event in the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
Also correct the entity id in the automation example: in a real Home Assistant the event entity gets event.mfrr_activation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
Home Assistant 2026.10 prefixes the event entity id with the device (site) name, e.g. event.<site>_mfrr_activation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
The existing tests run against simplified HA stubs. tests_ha/ sets the integration up in Home Assistant 2026.10.0 via pytest-homeassistant-custom-component, with a fake API client, and checks that setup logs no errors, that the event entities stay unknown until something happens and then fire with their attributes, that the last event survives a reload, the mFRR binary sensor, the total revenue sensor, and unload. The stubs replace homeassistant in sys.modules, so the suites run separately: a new CI job runs tests_ha on Python 3.14, and releases now wait for it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
Matches the action updates in #12, so the workflow is consistent whichever pull request merges first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on a HAR export of the EnergyInBalance dashboard from 2026-10-08.
New entities
/ems/ActivationSchedulenow lists the site's actual activations (MfrrUpActivation/MfrrDownActivation: start, end, power, ramp times). The list is fetched every 5 minutes, and the on/off state is re-evaluated every 60-second cycle so it turns off at the end time. Attributes describe the ongoing activation, or the latest one when off.upordownfor each activation that appears after HA starts. Activations already listed at startup do not fire. An activation missing from a single response does not fire again when it reappears (seen activations are kept for 7 days)./revenue?resolution=monthsince 2023-01-01, the same query the dashboard makes, with a per-service breakdown inby_service. If a response comes back empty, the sensor keeps its previous value.activationsis added to the slow updates shown on the Last API Poll sensor. Version is bumped to 1.6.0 (v1.6.0b1is already published as a pre-release from this branch).Docs
docs/api.mdis updated with all changes found in the export, marked 2026-10:ActivationSchedule; the hourlySpotPricearray is removedmFRR EAMrevenue service andresolution=monthDay/Month/Periodresolutions and the new savings data types inSiteMeasurementssite,energyflow,Statuses,CustomerDetailand diagnostics responsesTests and CI
tests_ha/sets the integration up in Home Assistant 2026.10.0 (viapytest-homeassistant-custom-component, pinned inrequirements_test_ha.txt) with a fake API client. It checks:tests_ha/on Python 3.14, and releases now wait for it. It is a separate job because the stubs intests/replacehomeassistantinsys.modules.Local results: 115 stubbed tests pass, 6 real-HA tests pass on 2026.10.0, and ruff check/format are clean. As a check that the tests catch real failures, temporarily disabling the mFRR event made
test_events_firefail.🤖 Generated with Claude Code
https://claude.ai/code/session_01UwYSvzP667Y5pkhzfs8obW
Generated by Claude Code