Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set/obtain DPL target power consumption via MQTT #1063

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

cerise21
Copy link

As suggested in #1047 (comment) TargetPowerConsumption can be set by sending a power value to topic 'powerlimiter/cmd/target_power_consumption' via MQTT and be read from topic 'powerlimiter/status/target_power_consumption'.

Is it correct that changing config values by issuing MQTT commands still entails writing to the flash memory (and thereby increasing the 'config save count')?
A development goal is to keep and reflect (at some other place than the DPL settings menu) these changes independent of the flashed values?

cerise21 added 3 commits June 18, 2024 13:32
add 'target_power_consumption' as MQTT topic
add 'target_power_consumption' as MQTT topic
@schlimmchen
Copy link
Member

Is it correct that changing config values by issuing MQTT commands still entails writing to the flash memory (and thereby increasing the 'config save count')?

Yes, except for the mode, which is not a config value at all, so the config is not written when changing the mode.

A development goal is to keep and reflect (at some other place than the DPL settings menu) these changes independent of the flashed values?

Yes, exactly. We need some kind of "DPL state" class, separate from the current PowerLimiter.cpp, like PowerLimiterState.cpp. This class shall initialize itself from the configuration struct. Its variables shall be modifiable by MQTT commands. When saving the DPL setting from the web UI, this class shall reload the settings from the configuration struct. The DPL shall use the state from this new DPL state class, and not use the configuration struct (at least for the state which is part of PowerLimiterState.cpp).

The next step would be to add even more state into this class, specifically values coming from the DPL calculations/decisions, like the calculated target power limit for the inverter. All of this then needs to be transported to and displayed by the web UI in a new card.

Thank you for this PR! I saw you also updated the wiki for your last contribution. Awesome! ❤️

@schlimmchen schlimmchen merged commit ccbaf55 into hoylabs:development Jun 20, 2024
8 checks passed
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants