monster1025 / aqara-mqtt

Aqara (Xiaomi) Gateway to MQTT bridge (I use it for home assistant integration)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blocked in _read_unwanted_data

seblucas opened this issue · comments

Hi,

I started to test your program last week and for an unknown reason it wasn't working at all. At first I was blaming my iptables setup, next docker and finally I spend some time to debug and found out that once started it remained stuck in _read_unwanted_data (exactly here)

I saw that you added it with this commit : 54eda12

For now I just put a return at the top of the function and it seems to work fine (I'll let it run a day or two before being sure)

I'm not using your docker python container (because I use a small armhf SBC) but mine should be almost the same :

  • Docker 17.05.0-ce
  • Python 3.5.2
  • Latest git revision of this repo
  • The command line I'm using to start the docker image : docker run -it --rm --net host -v /var/opt/docker/aqara/:/app/config seblucas/alpine-aqara:1.7

This function has to be useful and the problem got to be on my end, I hope you have an idea ;)

Thanks in advance

This function is dirty hack for case when we poll some data and have a network delays:
for example we ask for state of sensor1 and sensor2, we send following packets: read_sensor1, read_sensor2 and we miss first replay and than we have: read_sensor1 - sensor2_replay and read_sensor2 - ...next packet replay.

I got this case 2 times when gateway works for some days\week without restart(rare case) - so I haven't more beautiful fix for now =(

If your setup will work without this problem - you can simply leave it removed =)

But when i will have some free time - i will try to think how to do it more correctly =)

Thanks a lot for your answer. I have only one motion sensor (the other was dead when I received it so I got some repairing to do).

I'll let it run for a week with full logs and see if everything is fine.

I'll let it run for a week with full logs and see if everything is fine.
Yep, i hope you have configured sensor polling (this problem exist only when I have a lot of sensor polls - my setup is polling all 20 sensors every 2sec).

For now I only have one motion sensor and 2 magnets ....
I won't be able to test that for now. Hopefully I'll be able to fix my other motion sensor but don't count on me to confirm that for now.

I have maid a settings switch to turn off "read_unwanted_data" fix (for now), but really need to fix all work with udp =)

  unwanted_data_fix: True #leave it True if it works for you. Otherwise (if you didn't recieve any data from sensors) - set it to False

Sorry for the delay but I can confirm that with unwanted_data_fix: False everything works perfectly fine.

I retried unwanted_data_fix: True and it still hangs after printing INFO:xiaomihub:Discovering Xiaomi Devices

Anyway I'll close this. Thanks a lot