usage type self controlled - #3775
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new consumer usage type (self_controlled) to support consumers that are not directly controlled by openWB but instead receive current system values (e.g., PV, grid, battery) via MQTT for self-managed behavior.
Changes:
- Added
self_controlledto the consumer usage type model (UI + backend enum/config). - Updated control flow to treat
self_controlledas “not controlled” and to send aggregatedCurrentValuesto the consumer module when configured. - Extended MQTT consumer module + setdata validation to support publishing/accepting the new value topics (
bat_power,bat_soc,cp_power,evu_power,home_consumption,pv_power) and adjusted UI visibility for mode controls.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/modules/web_themes/koala/source/src/stores/mqtt-store-model.ts | Adds self_controlled to the UI-level consumer usage type union. |
| packages/modules/web_themes/koala/source/src/components/ConsumerSettings.vue | Hides mode controls for self_controlled consumers. |
| packages/modules/web_themes/koala/source/src/components/ConsumerCard.vue | Treats self_controlled similarly to meter_only in the card UI logic. |
| packages/modules/consumers/generic/mqtt/consumer.py | Adds send_values() to publish aggregated values for self-controlled consumers. |
| packages/modules/consumers/generic/mqtt/config.py | Enables SELF_CONTROLLED as a supported usage for the generic MQTT consumer module. |
| packages/modules/common/configurable_consumer.py | Extends ConfigurableConsumer with a send_values(CurrentValues) callback pathway. |
| packages/modules/common/abstract_consumer.py | Introduces CurrentValues dataclass used for passing aggregated values. |
| packages/helpermodules/setdata.py | Expands topic validation for new MQTT consumer set-topics and adds validation for id-less consumer fault topics. |
| packages/control/process.py | Sends CurrentValues via consumer.module.send_values() when usage is SELF_CONTROLLED. |
| packages/control/consumer/usage.py | Adds SELF_CONTROLLED enum value and NOT_CONTROLLED grouping constant. |
| packages/control/consumer/consumer.py | Uses NOT_CONTROLLED to skip control logic for meter_only and self_controlled. |
| packages/control/consumer/consumer_data.py | Refactors dataclass defaults (and removes unused nested log dataclass). |
| docs/samples/sample_consumer/sample_consumer/consumer.py | Documents how to implement send_values() for a self-controlled consumer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| initializer: Optional[Callable] = lambda: None, | ||
| error_handler: Optional[Callable] = lambda: None, | ||
| update: Optional[Callable[[], ConsumerState]] = lambda: None, | ||
| send_values: Optional[Callable[[CurrentValues], None]] = lambda: None, |
Comment on lines
125
to
127
| const meterOnly = computed( | ||
| () => mqttStore.consumerUsageType(props.consumerId) === 'meter_only', | ||
| () => mqttStore.consumerUsageType(props.consumerId) === 'meter_only' || mqttStore.consumerUsageType(props.consumerId) === 'self_controlled', | ||
| ); |
Comment on lines
+200
to
+202
| return Thread(target=consumer.module.send_values, | ||
| args=(current_values,), | ||
| name=f"set current consumer{consumer.num}") |
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.
openWB/openwb-ui-settings#1039