Coder Social home page Coder Social logo

Comments (24)

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024 2

I'm gonna fix this bug this week.

from pyxiaomigateway.

Danielhiversen avatar Danielhiversen commented on May 29, 2024

I agree.
I only have one gw and then it works fine.
So the multi gw solution is an old implementation, that I have never tested.

A pull request is welcome :)

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

You will have this issue even with a single gateway. You just need several XiaomiDevices (like XiaomiMotionSensor) to make a request to gateway at the same time. And there will be a big chance of failure and broken state.

from pyxiaomigateway.

Danielhiversen avatar Danielhiversen commented on May 29, 2024

You are right

from pyxiaomigateway.

heff27 avatar heff27 commented on May 29, 2024

I have noticed since upgrading to 0.62.1 i am getting a lot of Unavailable status on the window and door sensors, a restart of HA, fixes this for a white while.

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

@heff27 it can indicate that your local network is not very stable and loses packets sent by gateway.

Can you enable debug logging and provide us xiaomi_gateway/homeassistant.components.xiaomi_aqara logs for the last 2 days:

logger:
  logs:
    xiaomi_gateway: debug
    homeassistant.components.xiaomi_aqara: debug

?

Device becomes unavailable when it doesn't send at least one packet of data in 2.5 hours. So if you don't see any report/read_ack/write_ack/heartbeat from your device in 2.5 hours time frame - you get unavailable state. Restarting HA just resets this 2.5 hours timer and countdown begins from start :).

from pyxiaomigateway.

heff27 avatar heff27 commented on May 29, 2024

Ok i have enabled logging with the command, I am new to logging how do it get the Xiaomi Logs as the home assistant log file, has a load of stuff in it since added the above commands in to my Config Yaml.

Here is one of the errors since logging as enabled

2018-02-03 02:33:24 DEBUG (SyncWorker_0) [xiaomi_gateway] _send_cmd resp << {'cmd': 'write_ack', 'model': 'gateway', 'sid': '34ce008db90c', 'short_id': 0, 'data': '{"rgb":455343891,"illumination":392,"proto_version":"1.0.9"}'}
2018-02-03 02:33:24 ERROR (SyncWorker_0) [xiaomi_gateway] Non matching response. Expecting read_ack, but got write_ack
2018-02-03 02:33:24 DEBUG (SyncWorker_0) [xiaomi_gateway] read_ack << None
2018-02-03 02:33:24 DEBUG (SyncWorker_5) [xiaomi_gateway] _send_cmd resp << {'cmd': 'read_ack', 'model': 'magnet', 'sid': '158d0001a49988', 'short_id': 43824, 'data': '{"voltage":3045,"status":"open"}'}
2018-02-03 02:33:24 ERROR (SyncWorker_5) [xiaomi_gateway] Non matching response. Expecting write_ack, but got read_ack
2018-02-03 02:33:24 ERROR (SyncWorker_0) [xiaomi_gateway] No data in response from hub None
2018-02-03 02:33:24 DEBUG (SyncWorker_5) [xiaomi_gateway] write_ack << None
2018-02-03 02:33:24 ERROR (SyncWorker_5) [xiaomi_gateway] No data in response from hub None
2018-02-03 02:33:24 INFO (MainThread) [homeassistant.core] Bus:Handling <Event service_executed[L]:

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

@heff27 do it like this:

logger:
  default: error
  logs:
    xiaomi_gateway: debug
    homeassistant.components.xiaomi_aqara: debug

This will log only error logs and all xiaomi-related logs. After 2 days provide us a log file. Read here how you can get all logs as a file: https://home-assistant.io/components/logger/#service-set_level.

from pyxiaomigateway.

heff27 avatar heff27 commented on May 29, 2024

HI please attached the log file as requested, if you need anymore information please let me know

Thanks
home-assistant.log.zip

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

I have greped your log and didn't find any problems during this period. I have checked 4 sids: 158d0001a98550, 158d0001a98401, 158d0001d86d4a and 158d0001d5c426 with the command like this: egrep "homeassistant.components.xiaomi_aqara.*158d0001d5c426" home-assistant.log.
I see that you have at least 1 PUSH per hour which means you shouldn't have any unavailabilities. Can you specify at which time did you have unavailability status and for which sids?

from pyxiaomigateway.

heff27 avatar heff27 commented on May 29, 2024

158d0001a4c991 7 158d00019e0551 were the sensors that we going into unavailable state but these have seem to have stopped ever since i rebooted after adding the Debug Config.... Sorry probably not what you was looking for..

I am still getting loads of these errors that you can see in the log

No data in response from hub None
23:20 components/binary_sensor/xiaomi_aqara.py (ERROR)
No data in response from hub None
23:20 components/light/xiaomi_aqara.py (ERROR)
Non matching response. Expecting read_ack, but got write_ack
23:20 components/binary_sensor/xiaomi_aqara.py (ERROR)
Non matching response. Expecting write_ack, but got read_ack
23:20 components/light/xiaomi_aqara.py (ERROR)

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

If you want me to debug unavailability state, you need to provide logs, sids and time when state switch happenned.

I am still getting loads of these errors that you can see in the log

Yes, that's what is explained in this issue and will be fixed. But it's not always connected with unavailability.

from pyxiaomigateway.

heff27 avatar heff27 commented on May 29, 2024

I had an unavailability status late Friday night around 11pm i looked in the log and nothing. I looked on the MI apps and the sensor was showing unavailable also.... but yesterday I was back available again with no interaction....

from pyxiaomigateway.

monster1025 avatar monster1025 commented on May 29, 2024

I have same issue with HA component, packet miss/wrong packets(write command other than recieved data)/socket timeouts. It happens often when client (raspberry pi 3 in my case) is connected over wifi network and less often when client is connected over ethernet.

from pyxiaomigateway.

ReX1983 avatar ReX1983 commented on May 29, 2024

So the multi gw solution is an old implementation, that I have never tested.

I can confirm that with 3 gateways each time I restart HA at least one of the gateways is not found.

Have you or PaulAnnekov started any work on the UDP refactoring? I would like to help.

from pyxiaomigateway.

Danielhiversen avatar Danielhiversen commented on May 29, 2024

I have not started on this.

So a pull request would be very welcome

from pyxiaomigateway.

UmerFraz avatar UmerFraz commented on May 29, 2024

i get the non-matching error too. my gateway seems to have been discovered and responds to the ringtone commands. but no attached devices are discovered.

from pyxiaomigateway.

Martinvdm avatar Martinvdm commented on May 29, 2024

Having the same issues. errors like:

[xiaomi_gateway] Cannot connect to Gateway
[xiaomi_gateway] No data in response from hub None

Having a about 6 door/window sensors.

With the errors everything seems to working fine, but log is filling

from pyxiaomigateway.

Barrysv avatar Barrysv commented on May 29, 2024

I have been getting the "cannot connect to Gateway" and "No data in response from hub None" since setting up the Xiaomi gear back in Dec last year. The Xiaomi gear works really well 99% of the time but have witnessed automations not turn switches on at the scheduled time only to check the HA logs to see that at the same time the above connection errors had occurred.

Hoping I could solve this by brute force, I changed my network setup so my Aqara gateway is on its own access point in close range and on its own vlan with the home assistant. Network traffic is low.
However since this network topology change I still get the cannot connect and no data in response messages in the logs and have seen switches not turn on when they were supposed to.

I wonder if the ultimate solution is to implement point 4 mentioned by Paul? Suggest that HA checks for the acknowledgment within a timeout period and if not it resends the request?

from pyxiaomigateway.

Barrysv avatar Barrysv commented on May 29, 2024

Hi Paul/Daniel is this ready to test? I can help

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

@Barrysv yes. It's merged now.

from pyxiaomigateway.

Barrysv avatar Barrysv commented on May 29, 2024

@PaulAnnekov been testing it today - no connection errors in the log and the Xiaomi devices working as expected. Great job

from pyxiaomigateway.

PaulAnnekov avatar PaulAnnekov commented on May 29, 2024

I think this bug was fixed. Closing the issue.

from pyxiaomigateway.

cosinguyen avatar cosinguyen commented on May 29, 2024

Hi,
Sorry my code skill very bad. So what i need to do in this case. I using newest version of HassIO with docker.

Thanks.

from pyxiaomigateway.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.