Register OHPCF event handler in constructor#228
Open
andig wants to merge 4 commits into
Open
Conversation
NewOHPCF never subscribed the concrete *OHPCF to the device event bus, so only the embedded UseCaseBase.HandleEvent ran (firing UseCaseSupportUpdate). OHPCF.HandleEvent — which subscribes/binds SmartEnergyManagementPs on entity add and processes the data updates — was never invoked, so a CEM received no process-state data and could not schedule the compressor. Add the localEntity.Device().Events().Subscribe(uc) call that every other use case constructor already performs.
Contributor
Author
|
@sthelen-enqs this is an actual bug with #223 |
andig
added a commit
to evcc-io/evcc
that referenced
this pull request
Jun 25, 2026
Point eebus-go at andig/eebus-go fix branch (enbility/eebus-go#228) which registers the OHPCF use case event handler, so the compressor's SmartEnergyManagementPs feature is actually subscribed and process-state updates arrive. Revert to an upstream pseudo-version once #228 lands.
A subscription only delivers future updates, so without an initial read the CEM never learns the current optional power consumption until the heat pump pushes a change. Request the data on connect, as the other use cases do.
andig
added a commit
to evcc-io/evcc
that referenced
this pull request
Jun 25, 2026
Pick up enbility/eebus-go#228 follow-up that reads the OHPCF data on connect so the compressor's process state is populated instead of staying empty.
andig
commented
Jun 25, 2026
volschin
added a commit
to volschin/eebus-ha-bridge
that referenced
this pull request
Jun 30, 2026
…SCF) Adds the read-only CEM-client side of the OHPCF/OSCF use case (optimizationOfSelfConsumptionByHeatPumpCompressorFlexibility) so a SHIP trace can confirm whether the VR940 binds and serves its SmartEnergyManagementPs feature before building the schedule/pause control path. Gated by experimental.ohpcf_client (EEBUS_EXP_OHPCF_CLIENT), off by default. cem/ohpcf only exists in eebus-go's dev API (PR enbility/eebus-go#223), so this migrates the bridge off v0.7.0 to that commit: - service.go: NewConfiguration gains deviceCategories + pairingConfig + ringBuffer; RegisterRemoteSKI -> RegisterRemoteService(NewServiceIdentity); AllowWaitingForTrust behaviour preserved via UserIsAbleToApproveOrCancelPairingRequests(true). - callbacks.go: rewritten for the redesigned ServiceReaderInterface (ServiceIdentity / RemoteMdnsService, auto-trust callbacks). - mgcp/vabd/vapd: Measurement.UpdateDataForId -> UpdateDataForIds. OHPCFWrapper.Setup works around enbility/eebus-go#228 (NewOHPCF, unlike NewMPC/NewLPC, does not subscribe its concrete HandleEvent) by registering the use case on the device event bus explicitly. Setup is idempotent so the subscription is installed exactly once. Lifecycle is process-scoped, matching the LPC/monitoring wrappers (no teardown). Read-only observer: no proto or HA changes. Tests cover event routing and Setup idempotency. docs/eebus-vaillant-improvements.md updated to supersede the outdated "OSCF = fully custom SPINE" note.
volschin
added a commit
to volschin/eebus-ha-bridge
that referenced
this pull request
Jun 30, 2026
…SCF) Adds the read-only CEM-client side of the OHPCF/OSCF use case (optimizationOfSelfConsumptionByHeatPumpCompressorFlexibility) so a SHIP trace can confirm whether the VR940 binds and serves its SmartEnergyManagementPs feature before building the schedule/pause control path. Gated by experimental.ohpcf_client (EEBUS_EXP_OHPCF_CLIENT), off by default. cem/ohpcf only exists in eebus-go's dev API (PR enbility/eebus-go#223), so this migrates the bridge off v0.7.0 to that commit: - service.go: NewConfiguration gains deviceCategories + pairingConfig + ringBuffer; RegisterRemoteSKI -> RegisterRemoteService(NewServiceIdentity); AllowWaitingForTrust behaviour preserved via UserIsAbleToApproveOrCancelPairingRequests(true). - callbacks.go: rewritten for the redesigned ServiceReaderInterface (ServiceIdentity / RemoteMdnsService, auto-trust callbacks). - mgcp/vabd/vapd: Measurement.UpdateDataForId -> UpdateDataForIds. OHPCFWrapper.Setup works around enbility/eebus-go#228 (NewOHPCF, unlike NewMPC/NewLPC, does not subscribe its concrete HandleEvent) by registering the use case on the device event bus explicitly. Setup is idempotent so the subscription is installed exactly once. Lifecycle is process-scoped, matching the LPC/monitoring wrappers (no teardown). Read-only observer: no proto or HA changes. Tests cover event routing and Setup idempotency. docs/eebus-vaillant-improvements.md updated to supersede the outdated "OSCF = fully custom SPINE" note.
volschin
added a commit
to volschin/eebus-ha-bridge
that referenced
this pull request
Jun 30, 2026
…nt + HA control (#70) * feat(ohpcf): spike CEM-client for heat-pump compressor flexibility (OSCF) Adds the read-only CEM-client side of the OHPCF/OSCF use case (optimizationOfSelfConsumptionByHeatPumpCompressorFlexibility) so a SHIP trace can confirm whether the VR940 binds and serves its SmartEnergyManagementPs feature before building the schedule/pause control path. Gated by experimental.ohpcf_client (EEBUS_EXP_OHPCF_CLIENT), off by default. cem/ohpcf only exists in eebus-go's dev API (PR enbility/eebus-go#223), so this migrates the bridge off v0.7.0 to that commit: - service.go: NewConfiguration gains deviceCategories + pairingConfig + ringBuffer; RegisterRemoteSKI -> RegisterRemoteService(NewServiceIdentity); AllowWaitingForTrust behaviour preserved via UserIsAbleToApproveOrCancelPairingRequests(true). - callbacks.go: rewritten for the redesigned ServiceReaderInterface (ServiceIdentity / RemoteMdnsService, auto-trust callbacks). - mgcp/vabd/vapd: Measurement.UpdateDataForId -> UpdateDataForIds. OHPCFWrapper.Setup works around enbility/eebus-go#228 (NewOHPCF, unlike NewMPC/NewLPC, does not subscribe its concrete HandleEvent) by registering the use case on the device event bus explicitly. Setup is idempotent so the subscription is installed exactly once. Lifecycle is process-scoped, matching the LPC/monitoring wrappers (no teardown). Read-only observer: no proto or HA changes. Tests cover event routing and Setup idempotency. docs/eebus-vaillant-improvements.md updated to supersede the outdated "OSCF = fully custom SPINE" note. * feat(ohpcf): Path B — proto RPC + HA control for compressor flexibility Builds the control path on top of the OHPCF CEM-client spike: Home Assistant can now read the heat pump compressor's optional-consumption offer and schedule / pause / resume / abort it to soak up PV surplus (§1.3.1). Proto contract (regenerated both sides per CLAUDE.md): - ohpcf_service.proto: OHPCFService with GetCompressorFlexibility, ControlCompressorFlexibility (schedule/pause/resume/abort) and SubscribeOHPCFEvents; CompressorFlexibility + OHPCFAction + CompressorPowerConsumptionState. Added to generate_proto.sh. Go bridge: - usecases/ohpcf.go: CompatibleEntity resolver (picks the Compressor entity, issue #47), read passthroughs, and Schedule/Pause/Resume/Abort with async result-callback logging. - grpc/ohpcf_service.go: gRPC impl mirroring lpc_service; best-effort buildFlexibility (omits fields the compressor has not populated yet) and state mapping. Registered in main.go. HA integration: - coordinator: poll reads compressor_flexibility + ohpcf_supported; async_control_compressor(action). UNAVAILABLE (bridge OHPCF off) keeps the entities unavailable. - switch: EebusCompressorFlexibilitySwitch (on=schedule/resume, off=pause/abort), added only when ohpcf_supported. - proto_stubs re-exports, en/de/strings translations, test_ohpcf.py (5 tests). Go build/vet/test green; 47 Python tests pass; ruff + gofmt clean. * test(ohpcf): fix integration test for eebus-go v0.7.1 callback API RemoteSKIConnected was renamed to RemoteServiceConnected(svc, identity) in the v0.7.1 rebase. Update the integration test call site accordingly.
PowerConsumptionProcessState only matched PowerSequenceStateTypeScheduledPaused
("scheduledPaused"), but [OHPCF-012] specifies the state string "paused" — which
is exactly what this use case's own PausePowerConsumptionProcess writes. So a
paused process was written as "paused" and read back as ErrNotSupported.
Match PowerSequenceStateTypePaused, keeping ScheduledPaused for devices that
report it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
NewOHPCFis the only use-case constructor in this repo that does not subscribe the concrete use case to the device event bus.NewUseCaseBaseonly subscribes the embedded*UseCaseBase, whoseHandleEventhandles use-case-data updates (firingUseCaseSupportUpdate).OHPCF.HandleEvent— which on entity-add callsconnected()toSubscribe()/Bind()the remoteSmartEnergyManagementPsfeature, and on data change runsloadSmartEnergyManagementPsDataTypeto emit theDataUpdate*events — is therefore never registered and never runs.Add the same
_ = localEntity.Device().Events().Subscribe(uc)call toNewOHPCF.Also added requesting initial data same als LPC does.
🤖 Generated with Claude Code