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

Feature Request: MQTT - only report valid data #49

Closed
Argafal opened this issue May 20, 2022 · 4 comments
Closed

Feature Request: MQTT - only report valid data #49

Argafal opened this issue May 20, 2022 · 4 comments
Labels
enhancement New feature or request fixed dev fixed

Comments

@Argafal
Copy link
Contributor

Argafal commented May 20, 2022

Hi folks, This is a great piece of software. It comes very handy for my own little solar installation and it looks amazing in Domoticz. Thanks to all of you who got this started and contributed to it.

I believe there is a small issue with the MQTT implementation. Currently it reports data such as the frequency, voltage, individual panel power all night, even though this data is no longer valid. Also, it skips to report the zero on the current total power. Therefore the current total power reports some small number all night, which a home automation system then integrates to a small (wrong) number of Wh of solar power produced throughout the night hours. This spoils the statistics.

Expected behaviour:
a) if a zero is read from the inverter a zero should be reported on mqtt
b) if new data is read from the inverter it should be reported on mqtt
c) if there is no new data from the inverter, nothing should be reported on mqtt
d) Ideally, the last thing reported on mqtt in the evening is a zero value

Questions:

  1. Is there already a way to know that the inverter data was recently updated in app::loop() but not yet reported to mqtt?
  2. Does the inverter send a "shutting down for the night" signal of sorts? If yes we could use this to send one last mqtt broadcast of "0 Watt" everywhere.
@Argafal Argafal closed this as completed May 21, 2022
@Argafal Argafal reopened this May 21, 2022
@Argafal
Copy link
Contributor Author

Argafal commented May 21, 2022

I am attaching a patch that I believe fixes the reported behaviour in a neat way.
I did not yet find if there is a "shutting down for the night" signal.
If you like the patch, would you please add it to the repository?

diff.txt

@lumapu
Copy link
Owner

lumapu commented May 21, 2022

thank you for contributing, I will check that.

@elxsi
Copy link

elxsi commented May 22, 2022

Hi,

I think the mMqtt.loop(); should be called with with each ticker interval (and not only if new mqtt data is available), because otherwise the mqqt connection does not get refreshed:

if(checkTicker(&mTicker, 1000)) {
mMqtt.loop();
if(mMqttActive & mMqttNewDataAvail) {
...

Thanks!

@lumapu
Copy link
Owner

lumapu commented May 22, 2022

good point I'll give it a try. I'll check the documentation about the loop function how often it must be called at least.

@lumapu lumapu closed this as completed May 24, 2022
@stefan123t stefan123t added bug Something isn't working fixed dev fixed enhancement New feature or request and removed bug Something isn't working labels Jan 13, 2023
@stefan123t stefan123t changed the title MQTT - only report valid data Feature Request: MQTT - only report valid data Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed dev fixed
Projects
None yet
Development

No branches or pull requests

4 participants