Add basic support for native Hue sensors#22598
Conversation
43346a1 to
e1cab48
Compare
balloob
left a comment
There was a problem hiding this comment.
This will require tests to be written.
|
I'll address these shortly, thanks for the feedback. Some of these corrections are an upshot of me copying code from the light module and not understanding broader codebase guidelines. |
…e it has finished adding
fc4f92b to
74fb6f1
Compare
|
Pushed a rebase to trigger tests again - last run failed due to an unstable test in another component. @balloob, how do you feel about this now? Personally, I think it's in pretty good shape and much better than the original request thanks to people's feedback. @MartinHjelmare makes a good point about handling updates for newly added sensors, but I hope my response makes sense and that others agree with that. |
Codecov Report
@@ Coverage Diff @@
## dev #22598 +/- ##
==========================================
+ Coverage 94.19% 94.2% +<.01%
==========================================
Files 453 456 +3
Lines 36917 37084 +167
==========================================
+ Hits 34775 34936 +161
- Misses 2142 2148 +6
Continue to review full report at Codecov.
|
* Add basic support for native Hue sensors * Update coveragerc * Simplify attributes * Remove config option * Refactor and document device-ness and update mechanism * Entity docstrings * Remove lingering config for sensors * Whitespace * Remove redundant entity ID generation and hass assignment. * More meaningful variable name. * Add new 'not-darkness' pseudo-sensor. * Refactor sensors into separate binary, non-binary, and shared modules. * formatting * make linter happy. * Refactor again, fix update mechanism, and address comments. * Remove unnecessary assignment * Small fixes. * docstring * Another refactor: only call API once and make testing easier * Tests & test fixes * Flake & lint * Use gather and dispatcher * Remove unnecessary whitespace change. * Move component related stuff out of the shared module * Remove unused remnant of failed approach. * Increase test coverage * Don't get too upset if we're already trying to update an entity before it has finished adding * relative imports
|
Hi, Is there a particular reason the motion sensor binary_sensors have device_class "presence" rather than "motion"? |
|
This is fixed in another PR, #23193.
…On Thu, 18 Apr 2019, 18:24 James, ***@***.***> wrote:
Hi, Is there a particular reason the motion sensor binary_sensors have
device_class "presence" rather than "motion"?
Cheers,
James
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22598 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABD47XT5UMOJVZ2XI4MPM3PRCVFDANCNFSM4HCSAHIA>
.
|
|
#23208 for actual naming |
|
I was looking through the code to see how it compared to my personal hacks to get the Hue sensors work with hass and noticed 2 small issues. According to https://www.home-assistant.io/components/sensor/ the light unit should be lx (for lux) or lm (for lumen), however current implementation seems to use 'Lux' Light level in the Hue API is not in lux, it is in another unit. So in my custom code I had the following to convert to lux. It seemed right, but I had some issues getting it working so it may have issues
|
|
Excellent info, thanks @mvdwetering! I'll get this updated right away. |
|
not really being sure, so please forgive me if this is an unnecessary question, but it would really be very nice if we got these values with the native sensors, since they are all part of templates being used throughtout the setup: about the lux setting: in the current custom component, lx is calculated from light level as follows: if you need more info, please let me help if, be glad to. |
|
Some of these additional attributes are exposed as attributes on the sensor
entities, for example battery level. For the initial implementation I opted
not to include some of them, but that doesn't mean they cannot be included
in the future.
…On Mon, 22 Apr 2019, 21:20 Marius, ***@***.***> wrote:
not really being sure, so please forgive me if this is an unnecessary
question, but it would really be very nice if we got these values with the
native sensors, since they are all part of templates being used throughtout
the setup:
[image: Schermafbeelding 2019-04-22 om 22 15 30]
<https://user-images.githubusercontent.com/33354141/56526322-7072c380-654c-11e9-8f8c-3e4e67b9491b.jpg>
about the lux setting: in the current custom component, lx is calculated
from light level as follows:
lx = round(float(10 ** ((lightlevel - 1) / 10000)), 2)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#22598 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABD47TWSVJBNP4WICHVPY3PRYM2DANCNFSM4HCSAHIA>
.
|
|
ok thanks, please do. Some of them are simply there for the taking. adding them is a matter of adding a line (at least it was like that in the CC...) Hope you can add them like that too? 'reachable' and 'on' are truly important, hope these are already included right now? |
|
Please open an issue if you suspect a bug. Merged PRs should not be used for enhancement discussion or bug reports. If you've found a bug it's ok to make a review with inline comments and link to an issue that reports the bug. Thanks! |

Description:
This PR adds support for Hue motion sensors and their integrated light-level & temperature sensors.
In future, this could be expanded to include support for Hue switches and artificial sensors.
Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#9084
Example entry for
configuration.yaml(if applicable):unchanged
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
.coveragerc.