-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Fix xiaomi gateway disappearing and builtin light/sensor updates #21116
Conversation
Enable polling of xiaomi gateways devices
Fix for Illumination sensor of gateway get values only once (after restart of HA)
Fix for light switch won't report states back to HA
Update __init__.py
Can confirm code working with setup of 3 gateways. |
Sorry for the noob question, I'd like to test it but how can I apply this fix in hassio? SSH or simply activating the beta repository? Thank you |
"""Return the polling state. No polling needed.""" | ||
return False | ||
"""Return the polling state.""" | ||
return True |
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.
If we should return True here, we should remove the property completely, since True is the default.
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, I'd removed these lines
At the moment the component parses a multicast message ( |
My gateway sends only ip in heartbeat messages. Example:
|
Remove should_poll property due to True is default
I am not sure if this is a good idea. |
Which hardware version of the gateway do you own? It looks like a lumi.v3 with LAN protocol version 1.1.2. I assume there is something wrong with your network. Your log should look like this (without any requests):
|
You are right - lumi.v3 with LAN protocol version 1.1.2 Network setup simple as possible: Apple time capsule as wifi and router. HA at lan, gateway on wifi. No VLANS, no segments. Due to apple bonjour works as expected I consider that there is no issues with multicast. I also check multicast connectivity by omping tool from my 2 laptops to HA and there is no issues also. My gateway send nothing about built-in sensors until we ask :( I think it would be a good idea to enable polling only for built-in sensors. |
@stsergo This is the multicast message of the gateway. It publishs the state of the light and illumination sensor every 60 seconds:
I mixed things up: The message is called |
Mine sent only ip :( |
Is it possible that some firmwares don't send that message and still it's working in HA? I don't see that in log, maybe I don't have enough debugging turned on? Should I see it in meanwhile of normal traffic? EDIT: |
Got it! It's a firmware issue. Firmware version 1.4.1_164.0158 doesn't publish the
In this case polling is a workaround. |
I'm running latest (at least as of yesterday):
Those are the heartbeats, right? |
@andriej This is the message we are looking for:
You've posted the heartbeat used for key rotation. I've mixed these two messages types up in the past. |
Then I can see those in ngrep:
but not very often. It almost seems like only one GW reports it. Edit: Edit2: |
I moved my gateway away from dark room. Reports have really random gaps between.
Edit1:
P.S. I'd disable polling today and gateway disappeared regardless of reports. |
Why?
If all are answered with: 'no' then I urge you to reconsider... * i have been searching on how to change this behavior and found no clue on how to do this in hassio except for |
@@ -112,3 +112,8 @@ def parse_data(self, data, raw_data): | |||
else: | |||
self._state = round(value, 1) | |||
return True | |||
|
|||
def update(self): |
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.
With this change the update_entity
service will have an effect and users that are affected by the bad firmware can schedule their own update interval with automations. We then don't need to set polling to true for all xiaomi aqara entities.
Quickie; Firmware 1.4.1_167 came out. Updated one of my gateways to test if this fixed current issue. Not so; behavior remains the same. We need this fix... |
This would supposedly fix this #21250 right? I'm currently running Hassio on VM and doesn't work correctly the sensors (sometimes it does sometimes it doesn't). However running Hassio on my pi3 works perfect. Is there a way I can apply this to Hassio to test it out? |
Hope for the fix in hassio |
I have a theory...One thing I have noticed, and including myself, is that the people who appear to have most problems all have MAC address of the gateway starting 04:XX:XX:XX:XX:XX. When I get updates from a sensor, I can see in the debug these appearing as a PUSH and the sensor gets updated. 2019-02-24 20:24:33 DEBUG (Thread-23) [xiaomi_gateway] MCAST (heartbeat) << {'model': 'sensor_ht', 'sid': '158dXXXXXXXXXX', 'cmd': 'heartbeat', 'short_id': 63981, 'data': '{"voltage":2985," However when I get an illumination update from the gateway I don't get the corresponding PUSH debug message. 2019-02-24 20:20:27 DEBUG (Thread-23) [xiaomi_gateway] MCAST (report) << {'model': 'gateway', 'sid': '04XXXXXXXXXX', 'cmd': 'report', 'short_id': 0, 'data': '{"rgb":1694434079,"illumination One thing I notice that the entity_id that home assistant set up, is sensor.illumination_4XXXXXXXXXX thus missing the leading zero. Could this be causing a mismatch between the SID being broadcast and the HA entitiy? |
Superseded by #21453. |
Description:
Related issue (if applicable): fixes #20329 #20383
This fix addresses next issues:
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:
REQUIREMENTS
variable (example).requirements_all.txt
by runningscript/gen_requirements_all.py
..coveragerc
.If the code does not interact with devices: