monster1025 / aqara-mqtt

Aqara (Xiaomi) Gateway to MQTT bridge (I use it for home assistant integration)
Apache License 2.0
88 stars 21 forks source link

Issues receiving packets with both x64 & arm docker images. #18

Closed basbl closed 6 years ago

basbl commented 6 years ago

Hi, thanks for taking the time to develop this useful tool! I am having issues receiving packets. I have 4 devices (motion, temperature, button, and magnet) but not receiving data from any. Tested both on my macbook and on an rpi3.

The log:

aqara    | INFO:mqtt:Starting mqtt loop.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/+/set.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/write.
aqara    | INFO:mqtt:Subscribing to home/plug/+/status/set.
aqara    | INFO:xiaomihub:"Read unwanted data" fix is True
aqara    | INFO:xiaomihub:Discovering Xiaomi Gateways using address 192.168.1.153
aqara    | INFO:mqtt:Connected to mqtt server.
aqara    | INFO:xiaomihub:Gateway found on IP 192.168.1.153
aqara    | INFO:xiaomihub:Creating Multicast Socket
aqara    | INFO:xiaomihub:Listening
aqara    | INFO:xiaomihub:Discovering Xiaomi Devices
aqara    | INFO:xiaomihub:Found 4 devices
aqara    | INFO:mqtt:Publishing message to topic home/motion/158d0001d672d0/voltage: 3065.

It appears to not do anything after that last publish.

With some extra info:

aqara    | INFO:mqtt:Starting mqtt loop.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/+/set.
aqara    | INFO:mqtt:Subscribing to home/gateway/+/write.
aqara    | INFO:mqtt:Connected to mqtt server.
aqara    | INFO:mqtt:Subscribing to home/plug/+/status/set.
aqara    | INFO:xiaomihub:"Read unwanted data" fix is True
aqara    | INFO:xiaomihub:Discovering Xiaomi Gateways using address 192.168.1.153
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"whois"}
aqara    | INFO:xiaomihub:Recieved from GW {'ip': '192.168.1.153', 'cmd': 'iam', 'sid': '7811dcb7c98b', 'port': '9898', 'model': 'gateway'}
aqara    | INFO:xiaomihub:Gateway found on IP 192.168.1.153
aqara    | INFO:xiaomihub:Creating Multicast Socket
aqara    | INFO:xiaomihub:Listening
aqara    | INFO:xiaomihub:Discovering Xiaomi Devices
aqara    | INFO:xiaomihub:Sending to GW {"cmd" : "get_id_list"}
aqara    | INFO:xiaomihub:Recieved from GW {'cmd': 'get_id_list_ack', 'token': '5Jwf8YoNZJcOIJkH', 'sid': '7811dcb7c98b', 'data': '["158d0001fa518f","158d0001d672d0","158d0001f3b212","158d0001e5c0f0"]'}
aqara    | INFO:xiaomihub:Found 4 devices
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001fa518f"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 12923, 'cmd': 'read_ack', 'model': 'sensor_ht', 'sid': '158d0001fa518f', 'data': '{"voltage":3005,"temperature":"1853","humidity":"5763"}'}
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001f3b212"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 59356, 'cmd': 'read_ack', 'model': 'magnet', 'sid': '158d0001f3b212', 'data': '{"voltage":3085,"status":"close"}'}
aqara    | INFO:xiaomihub:Sending to GW {"cmd":"read","sid":"158d0001e5c0f0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 52916, 'cmd': 'read_ack', 'model': 'switch', 'sid': '158d0001e5c0f0', 'data': '{"voltage":3102}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}
aqara    | INFO:xiaomihub:Sending to GW { "cmd":"read","sid":"158d0001d672d0"}
aqara    | INFO:xiaomihub:Recieved from GW {'short_id': 32357, 'cmd': 'read_ack', 'model': 'motion', 'sid': '158d0001d672d0', 'data': '{"voltage":3065}'}

Docker version:

Client:
 Version:       17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:03:51 2017
 OS/Arch:       darwin/amd64

Server:
 Engine:
  Version:      17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:        Wed Dec 27 20:12:29 2017
  OS/Arch:      linux/amd64
  Experimental: true

Hope you can help!

monster1025 commented 6 years ago

Check firewall or try turn off "Read unwanted data" fix in config, also - connect your rpi via ethernet (not wifi - rpi can loose packets over wifi when you get it worked).

Here is same issue when local firewall was a problem (it also didn't receive info packets - but receive answer for 'read' command): https://github.com/monster1025/aqara-mqtt/issues/16

basbl commented 6 years ago

Thanks, I will check it out!

basbl commented 6 years ago

Appears that I had a stray route defined which messed up everything. Thanks for the help!