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

Add support for discovering new devices via broadcast of their first heartbeat #111

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

bdraco
Copy link
Contributor

@bdraco bdraco commented Feb 9, 2022

  • Adds set_discovery_callback which will immediately discover devices when they boot up when push updates are active.
    Devices broadcast a firstBeat udp packet on boot with their mac address which allows us to discover new devices, and update the ip address we have for the device to avoid having to wait for the next discovery.

  • Adds white channels and white to color ratio from bulb config. The data described in Comment: Determining Bulb Kind #77 seems to be a lot more generic and its actually the number of white channels and white to color ratio.
    Closes Comment: Determining Bulb Kind #77

  • Various refactoring and tests to increase test coverage

  • Remove connect_on_init as it did blocking I/O which would stall the event loop

@bdraco bdraco force-pushed the determine_model_description branch 2 times, most recently from e6662e8 to 8488b71 Compare February 9, 2022 01:15
@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

The descriptions may be too specific as I think the models are a bit more generic

@bdraco bdraco force-pushed the determine_model_description branch 4 times, most recently from 1aa17bf to b0b6ff6 Compare February 9, 2022 01:46
@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2022

Codecov Report

Merging #111 (b788440) into master (772566f) will increase coverage by 44.49%.
The diff coverage is 82.45%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #111       +/-   ##
===========================================
+ Coverage   29.59%   74.08%   +44.49%     
===========================================
  Files          13       12        -1     
  Lines         821      741       -80     
===========================================
+ Hits          243      549      +306     
+ Misses        578      192      -386     
Impacted Files Coverage Δ
pywizlight/push_manager.py 26.31% <37.50%> (-0.20%) ⬇️
pywizlight/bulb.py 75.88% <81.81%> (+50.88%) ⬆️
pywizlight/utils.py 89.18% <82.60%> (+54.18%) ⬆️
pywizlight/models.py 92.30% <92.30%> (ø)
pywizlight/bulblibrary.py 91.66% <100.00%> (+26.44%) ⬆️
pywizlight/discovery.py 77.96% <100.00%> (+36.53%) ⬆️
pywizlight/rgbcw.py 72.91% <100.00%> (+55.20%) ⬆️
pywizlight/scenes.py 100.00% <100.00%> (+57.14%) ⬆️
pywizlight/vec.py 89.28% <100.00%> (+28.57%) ⬆️
pywizlight/cli.py
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 772566f...b788440. Read the comment docs.

@bdraco bdraco force-pushed the determine_model_description branch 20 times, most recently from ee3ac82 to 114a07c Compare February 9, 2022 03:29
@bdraco bdraco marked this pull request as ready for review February 9, 2022 03:43
@bdraco bdraco marked this pull request as draft February 9, 2022 05:36
@bdraco
Copy link
Contributor Author

bdraco commented Feb 9, 2022

So wcr is White to Color Ratio, and nowc is number of white channels.

I don't think this actually gives enough info to identify the device

@bdraco bdraco force-pushed the determine_model_description branch 2 times, most recently from b2ba620 to 326adaf Compare February 9, 2022 05:54
@bdraco bdraco changed the title Determine model description from bulb config Determine white channels and white to color ratio from bulb config Feb 9, 2022
@bdraco bdraco force-pushed the determine_model_description branch 4 times, most recently from efd11ad to c24c771 Compare February 9, 2022 06:36
@bdraco bdraco changed the title Determine white channels and white to color ratio from bulb config Add support for detecting new devices booting up as they broadcast their first heartbeat Feb 9, 2022
@bdraco bdraco changed the title Add support for detecting new devices booting up as they broadcast their first heartbeat Add support for discovering new devices via broadcast of their first heartbeat Feb 9, 2022
@bdraco bdraco force-pushed the determine_model_description branch from c24c771 to b788440 Compare February 9, 2022 06:40
@bdraco bdraco marked this pull request as ready for review February 9, 2022 06:54
@sbidy
Copy link
Owner

sbidy commented Feb 9, 2022

So wcr is White to Color Ratio, and nowc is number of white channels.

I don't think this actually gives enough info to identify the device

Yes, thats true. I don't see a chance to have such a generic approach with the info we got from the UDP interface. Maybe we got a new property for a possible detection of the physical shape of the bulb/stripe/etc..

Thank you for jumping in and having a second look into that.

@sbidy sbidy merged commit 13c05ab into sbidy:master Feb 9, 2022
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.

Comment: Determining Bulb Kind
3 participants