Xiaomi No Heartbeats

Tags: #<Tag:0x00007f6170522988>

Hi All,

I’ve looked through the various threads and am struggling to work out my issue. Basically, Openhab is not seeing any of the Xiaomi multicast messages (heartbeat, status updates) - meaning after the initial connect, 5 minutes later everything goes offline.

Appreciate any input/ideas - what I have attempted is below.

Openhab logs:

2019-12-09 11:39:43.449 [me.event.ThingUpdatedEvent] - Thing 'mihome:bridge:34ce008ae8e8' has been updated.

2019-12-09 11:39:43.489 [DEBUG] [internal.handler.XiaomiBridgeHandler] - Init socket on Port: 9898

2019-12-09 11:39:43.531 [DEBUG] [e.internal.socket.XiaomiBridgeSocket] - Setup socket

2019-12-09 11:39:43.562 [DEBUG] [e.internal.socket.XiaomiBridgeSocket] - Initialized socket to null:-1 on 0.0.0.0/0.0.0.0:9898

2019-12-09 11:39:43.635 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - There are 1 open sockets: {9898=java.net.MulticastSocket@1be06b3}

2019-12-09 11:39:43.698 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Adding socket listener org.openhab.binding.mihome.internal.handler.XiaomiBridgeHandler@1ae88e3

2019-12-09 11:39:43.708 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Staring reveicer thread for socket on port 9898

2019-12-09 11:39:43.725 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-118,5,main] waiting for data on port 9898

2019-12-09 11:39:43.768 [DEBUG] [internal.handler.XiaomiBridgeHandler] - Cancelled running timer

2019-12-09 11:39:44.730 [DEBUG] [internal.handler.XiaomiBridgeHandler] - Triggered discovery

2019-12-09 11:39:44.760 [DEBUG] [internal.handler.XiaomiBridgeHandler] - Send to bridge mihome:bridge:34ce008ae8e8: {"cmd": "get_id_list"}

2019-12-09 11:39:44.782 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Sending message: {"cmd": "get_id_list"} to /192.168.1.4:9898

2019-12-09 11:39:44.826 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.1.4:9898 on Port 9898

2019-12-09 11:39:44.906 [TRACE] [internal.handler.XiaomiBridgeHandler] - Received message {"cmd":"get_id_list_ack","sid":"34ce008ae8e8","token":"EVrfahSdiDkz0qbK","data":"[\"158d0001c0de63\",\"158d0001c3179c\",\"158d0001e54f0a\",\"158d0001f50870\",\"158d0001b7815a\",\"158d0001c20a11\",\"158d0001bf46f2\",\"158d00019ffe39\"]"}

2019-12-09 11:39:46.927 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-118,5,main] waiting for data on port 9898

2019-12-09 11:39:46.937 [DEBUG] [.mihome.internal.socket.XiaomiSocket] - Received Datagram from 192.168.1.4:9898 on Port 9898

2019-12-09 11:39:46.950 [TRACE] [internal.handler.XiaomiBridgeHandler] - Received message {"cmd":"read_ack","model":"gateway","sid":"34ce008ae8e8","short_id":0,"data":"{\"rgb\":0,\"illumination\":1292,\"proto_version\":\"1.1.2\"}"}

2019-12-09 11:39:46.959 [TRACE] [internal.handler.XiaomiBridgeHandler] - Updated "last time seen" for device 34ce008ae8e8

2019-12-09 11:39:46.985 [DEBUG] [internal.handler.XiaomiBridgeHandler] - Cancelled running timer

2019-12-09 11:39:46.996 [DEBUG] [internal.handler.XiaomiBridgeHandler] - Device 34ce008ae8e8 honored read request

2019-12-09 11:39:47.006 [DEBUG] [discovery.XiaomiItemDiscoveryService] - Detected Xiaomi smart device - sid: 34ce008ae8e8 model: gateway

2019-12-09 11:39:47.044 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Data received and notified 1 listeners

2019-12-09 11:39:47.054 [TRACE] [.mihome.internal.socket.XiaomiSocket] - Thread Thread[Thread-118,5,main] waiting for data on port 9898

2019-12-09 11:44:47.072 [hingStatusInfoChangedEvent] - 'mihome:bridge:34ce008ae8e8' changed from ONLINE to OFFLINE

Testing Attempted

  • Removed/readded the binding and items
  • Checked developer key is correct
  • Run the following commands:
  1. sudo netcat -ulk 9898
    This returns no response, except for the initial send from Openhab to setup
  2. sudo tcpdump -n -p udp dst port 9898
    This sees all the heartbeat/status update messages from the Xiaomi device
  3. sudo netstat -ulptn
    This returns that there is nothing listening on UDP 9898; however there is a udp6 entry for ::::9898
    Additionally, on another pi running homeassistant, there is an entry for udp 224.0.0.50:9898 - this device works fine.

Hardware
This is running on a Raspberry Pi, connected to ethernet directly. I have a similar pi running homeassistant, which does not have any issue connecting to the Xiaomi sensors (although I am trying to move off it to Openhab).