Skip to content

Register OHPCF event handler in constructor#228

Open
andig wants to merge 3 commits into
enbility:implement-cem-ohpcffrom
andig:fix/ohpcf-register-event-handler
Open

Register OHPCF event handler in constructor#228
andig wants to merge 3 commits into
enbility:implement-cem-ohpcffrom
andig:fix/ohpcf-register-event-handler

Conversation

@andig

@andig andig commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

NewOHPCF is the only use-case constructor in this repo that does not subscribe the concrete use case to the device event bus. NewUseCaseBase only subscribes the embedded *UseCaseBase, whose HandleEvent handles use-case-data updates (firing UseCaseSupportUpdate). OHPCF.HandleEvent — which on entity-add calls connected() to Subscribe()/Bind() the remote SmartEnergyManagementPs feature, and on data change runs loadSmartEnergyManagementPsDataType to emit the DataUpdate* events — is therefore never registered and never runs.

Add the same _ = localEntity.Device().Events().Subscribe(uc) call to NewOHPCF.

Also added requesting initial data same als LPC does.

🤖 Generated with Claude Code

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.
@andig

andig commented Jun 25, 2026

Copy link
Copy Markdown
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.
Comment thread usecases/cem/ohpcf/events.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant