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 fixes #779

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

MQTT fixes #779

wants to merge 2 commits into from

Conversation

ccutrer
Copy link

@ccutrer ccutrer commented Oct 21, 2022

ensuring that the state in MQTT is always up to date

if there was no change, isMqttDirty() will be false and no packet
will be sent
@kenn5108
Copy link

Hi @ccutrer !
I would like to use your fix but I don't know how to apply.
I have Milight Hub working with sidoh last version.

Thanks for help

@ccutrer ccutrer marked this pull request as draft May 17, 2023 22:26
@ccutrer
Copy link
Author

ccutrer commented May 17, 2023

I'd say it's not ready yet. My ESP crashes quite a bit. I know when it happens, so it doesn't bother me too much, but I haven't had time to debug it. Once I finally get around to it, I'll be sure to post a compiled image for you.

@kenn5108
Copy link

Hi ! Thank you very much !

@ccutrer ccutrer marked this pull request as ready for review December 15, 2023 17:11
@ccutrer
Copy link
Author

ccutrer commented Dec 15, 2023

Turns out my issues weren't with the ESP crashing, but with an unrelated issue in openHAB. So this PR is ready. See https://github.com/ccutrer/esp8266_milight_hub/releases/tag/20221021.1 for a pre-compiled binary for a NodeMCU v2 style board.

staleGroups.push(bulbId);
// if this was to group 0, we need to enqueue an update for all child groups as well
if (bulbId.groupId == 0) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just group 0? Depending on your remote type you have 4 or 8 groups.

Also, this code reads as:
If group == 0 then update this current bulb in all groups with this new state.

While i'd expect it to read as:
if this bulb is a group, set the state to all bulbs in this group to this new state.

I could be completely wrong here, just explaining how i read the code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you're reading it incorrectly. a BulbId consists of a deviceId and a groupId (and a deviceType, which tells us if the device supports 4 or 8 groups). the deviceId corresponds to the particular fut089 remote for example. groupId 0 is a special group that means "all groups on this device". so this code says "if we're marking group 0 stale, find out how many groups this particular device type supports, and mark all groups on that device (note that it's reusing bulbId, without modifying its deviceId) as stale as well".

note that all "bulbs" are a "group", since you can synchronize as many physical bulbs as you want to a given group id (but not 0!). For example, I have a FUT089. The groups are:

  • Group 1: a single channel LED strip controller
  • Group 2: 4 RGB+CCT downlights
  • Group 3: 12 RGB+CCT downlights
  • Group 4: 4 RGB+CCT adjustable downlights
  • Group 5: two RGB+CCT LED strip controllers
  • Group 6: a RGB+CCT LED strip controller
  • Group 7: a single channel LED strip controller
  • Group 8: 4 RGB+CCT downlight

And then Group 0 is the All group.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for that explanation, that's much appreciated!
Perhaps a comment in code explaining this a little would be helpful?

The people actively hacking on this code probably know it and to them - like you - it's "common knowledge" by now. But newcomers are going to have a hard time understanding what's going on.

Side note, not a review at all. Just a comment from a fellow developer :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The people actively hacking on this code

Lulz. Soo.... no one apparently. Two commits in the last two years. This PR having gotten no response from @sidoh in a year and a half. That's why I added the precompiled binary as a release in my fork. If @sidoh indicates interest in actually merging this, I'll worry about it then.

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.

None yet

3 participants