Skip to content

Add support for service callbacks#229

Merged
ikalchev merged 1 commit intoikalchev:devfrom
bdraco:service_callback_brightness_fix
Mar 28, 2020
Merged

Add support for service callbacks#229
ikalchev merged 1 commit intoikalchev:devfrom
bdraco:service_callback_brightness_fix

Conversation

@bdraco
Copy link
Copy Markdown
Contributor

@bdraco bdraco commented Mar 19, 2020

For some services we want to send all the char value
changes at once. This resolves an issue where we send
ON and then BRIGHTNESS and the light would go to 100%
and then dim to the brightness because each callback
would only send one char at a time.

For additional details about why this is needed:
home-assistant/core#32348
home-assistant/core#13695
home-assistant/core#13768
home-assistant/core#32278

The end result is that home assistant can now get sets for a service in one call and do the right thing

2020-03-19 02:14:28 DEBUG (Thread-48) [custom_components.homekit.type_lights] _set_chars: {'Brightness': 45}
2020-03-19 02:14:29 DEBUG (Thread-48) [custom_components.homekit.type_lights] _set_chars: {'On': 1, 'Brightness': 25}
2020-03-19 02:14:30 DEBUG (Thread-48) [custom_components.homekit.type_lights] _set_chars: {'On': 1, 'Brightness': 66}

For some services we want to send all the char value
changes at once.  This resolves an issue where we send
ON and then BRIGHTNESS and the light would go to 100%
and then dim to the brightness because each callback
would only send one char at a time.
@codecov-io
Copy link
Copy Markdown

codecov-io commented Mar 19, 2020

Codecov Report

Merging #229 into dev will increase coverage by 0.67%.
The diff coverage is 91.66%.

@@            Coverage Diff             @@
##              dev     #229      +/-   ##
==========================================
+ Coverage   62.08%   62.76%   +0.67%     
==========================================
  Files          16       16              
  Lines        1704     1716      +12     
  Branches      176      178       +2     
==========================================
+ Hits         1058     1077      +19     
+ Misses        606      594      -12     
- Partials       40       45       +5     
Impacted Files Coverage Δ
pyhap/accessory_driver.py 65.05% <88.88%> (+2.90%) ⬆️
pyhap/characteristic.py 98.23% <100.00%> (+0.01%) ⬆️
pyhap/service.py 98.11% <100.00%> (+0.07%) ⬆️
pyhap/accessory.py 54.72% <0.00%> (+1.35%) ⬆️

@bdraco
Copy link
Copy Markdown
Contributor Author

bdraco commented Mar 20, 2020

@ikalchev Hope you are staying safe. Any chance you could look at this one this weekend?

@ikalchev
Copy link
Copy Markdown
Owner

Overall it makes sense. We need to make sure to properly document the fact that you can register callbacks in both the service and the char, which can cause some confusion.

@ikalchev ikalchev merged commit 06f73da into ikalchev:dev Mar 28, 2020
@bdraco
Copy link
Copy Markdown
Contributor Author

bdraco commented Mar 28, 2020

Good call. Will send a PR to update the docs.

@bdraco bdraco mentioned this pull request Mar 28, 2020
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.

3 participants