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

Mqtt and other small fixes #33

Merged

Conversation

FredericMa
Copy link
Contributor

Fixes #29

I've managed to fix the issues I was facing in #29.
The mqtt reconnect logic suffered the same issue. Basically it was possible that multiple callbacks were added to the handlers.
I've added a cleanup before every addition to the handlers to make sure only one callback will be in the handler.
I'm not an android developer so I've basically just hardened the logic to prevent the issue from happening.

I've also did some other minor fixes like using the displaymanager to get the state of the screen since "isInteractive" on the power manager doesn't necessarily represents the correct screen state (https://developer.android.com/reference/android/os/PowerManager#isInteractive())

- Remove MQTT3 disconnect exception handling MQTT5 service.
- Remove MQTT5 disconnect exception handling MQTT3 service.
- Correct wrong set of mReady (should be false) and wrong call of handleMqttConnected (should be handleMqttDisconnected)
- Fixed typo.
- Remove irrelevant mqttConnected variable
- Use displayManager to get real display state (see bottom remark of: https://developer.android.com/reference/android/os/PowerManager#isScreenOn())
@netlify
Copy link

netlify bot commented Oct 2, 2022

Deploy Preview for wallpanel canceled.

Name Link
🔨 Latest commit e68ca03
🔍 Latest deploy log https://app.netlify.com/sites/wallpanel/deploys/6339555f75c7d20008603446

@TheTimeWalker
Copy link
Owner

Thank you very much for looking into this issue! I will look into the PR in the following days

@TheTimeWalker
Copy link
Owner

LGTM!

@TheTimeWalker TheTimeWalker merged commit 3420d61 into TheTimeWalker:master Oct 11, 2022
@FredericMa FredericMa deleted the mqtt_and_other_small_fixes branch October 12, 2022 05:36
@FredericMa
Copy link
Contributor Author

Thanks for merging! Is there also a new release going to be published?

@TheTimeWalker
Copy link
Owner

Yes, hopefully today

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.

[BUG] Endless loop MQTT battery sensor publish
2 participants