-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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 Xiaomi Miio gateway illuminance sensor and gateway light #37959
Conversation
This pull request needs to be manually signed off by @home-assistant/core before it can get merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested on my local dev environment and it works well. There is one thing though. I have a AC partner (lumi.acpartner.v3
) that does not have illuminance sensor. It ends up with a sensor always given 0 lux in HA. Maybe we should check for positive illuminance value before adding the entity or filter using gateway model.
@shenxn I did not know the lumi.acpartner.v3 also worked with the xiaomi miio code. If so I will list it in the documentation and will add it to zeroconf discovery |
@starkillerOG There is no weather sensors for |
I've been thinking about how to add the light to the gateway implementation and my first impulse was to define the entities within the Gateway filera ther than the Light file. What do you think about my approach? |
@shenxn that is probably because you do not have temperature sensors connected to your acpartner.v3.
|
@javicalle had not thought about it to much actually. @javicalle are you already working on the light implementation or schould I add it? |
No, I haven't been working on it, sorry. |
@starkillerOG Yes I do have some zigbee devices and I can get device states using the code. |
Greath I will list the AC partner as supported including subdevices in the documentation update I am working on |
I also added the gateway light entity. |
@shenxn I made sure the gateway lux sensor and gateway light entities do not get setup when the gateway is an AC partner (since those don't have the lux sensor or LEDs build in). |
This is ready for revieuw/merge |
Co-authored-by: Xiaonan Shen <s@sxn.dev>
@rytilahti I just rebased, could you approve this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a very minor changes are needed from my side.
But let me ask, have you thought about if the light platform could use some refactoring to ease the maintenance burden in the future? At the moment there are so many separate light implementations in this file, I'd rather like to see that we consolidate at least the most common functionality to simplify the code base, if possible.
Co-authored-by: Teemu R. <tpr@iki.fi>
Co-authored-by: Teemu R. <tpr@iki.fi>
I have thought about it, but all those other classes are of the old Xiaomi Philips Light platform that still uses YAML config https://www.home-assistant.io/integrations/light.xiaomi_miio/. I think that schould be cleaned up when the Xiaomi Philips Light platform gets converted to Config flow. |
Yes, agreed. It will make sense to go through all the lights (and purifiers, and other..) at some point to find which parts (or API) they share and refactor python-miio to offer common interface where possible. The separate platform files are getting really large and share many common things, so for maintenance those should be refactored, maybe be introducing something like I'll try to see if I can find some time to untangle that puzzle, so it is not something that's to be taken care of this PR, so I'm okay for merging this. I'll add a label to see if someone wants to chime in on something that needs to be changed before merging. |
@rytilahti I do not see this PR in the dev project where PRs are tracked, I think something went wrong with the labels... |
Can someone approve this? |
@MartinHjelmare Any more suggestions? |
@MartinHjelmare can this be merged now? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…sistant#37959) Co-authored-by: Xiaonan Shen <s@sxn.dev> Co-authored-by: Teemu R. <tpr@iki.fi>
Breaking change
Proposed change
Type of change
Example entry for
configuration.yaml
:Config flow
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale: