Xiaomi Gateway 3 binding (ZNDMWG03LM)

Ok, lets try to investigate.

  1. Please connect to the gateway via telnet. Are you using standard port 23?
  2. run this command to get firmware version
cat /etc/rootfs_fw_info

image

  1. get all processes
ps -w
  1. Restart mosquitto:
killall mosquitto
mosquitto -d
killall zigbee_gw

and send me logs please.

it’s really weird: last time I checked (a couple of days ago) I was able telnet it, now it doesn’t find the host (I can ping it but not able to telnet anymore).
I don’t understand what changed :pensive:

Weird. Can you turn of the binding, restart the gateway and then turn on the binding in a couple of minutes?
The binding itself on restart should enable telnet, so gateway restart is just a precaution.

Unfortunately doesn’t work (still unable to telnet and error from the bridge), but the logs now show more info:

2022-01-14 09:24:49.697 [INFO ] [l.discovery.XiaomiGatewayV3Discovery] - Class set
2022-01-14 09:24:49.722 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - Initializing the bridge handler 'xiaomigatewayv3:config:7150139422' with thingType xiaomigatewayv3:config
2022-01-14 09:24:49.725 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - IP address: 192.168.1.24
2022-01-14 09:24:49.727 [DEBUG] [3.internal.helpers.MIIOCommunication] - No device ID defined. Retrieving Mi device ID
2022-01-14 09:24:49.730 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Sending Ping  (192.168.1.24)
2022-01-14 09:24:49.734 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Starting Mi IO MessageSenderThread
2022-01-14 09:24:49.735 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Opening socket on port: 42280 
2022-01-14 09:24:49.907 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Ping  (192.168.1.24) success
2022-01-14 09:24:49.909 [DEBUG] [3.internal.helpers.MIIOCommunication] - Ping response from device 13D24DFE at 192.168.1.24. Time stamp: 1970-01-01T02:02:51, OH time 2022-01-14T09:24:49.908982, delta -1642144918
2022-01-14 09:24:49.911 [DEBUG] [3.internal.helpers.MIIOCommunication] - Ping response from device 13D24DFE at 192.168.1.24. Time stamp: 1970-01-01T02:02:51, OH time 2022-01-14T09:24:49.910866, delta -1642144918
2022-01-14 09:24:49.912 [DEBUG] [3.internal.helpers.MIIOCommunication] - Using retrieved Mi device ID: 13D24DFE
2022-01-14 09:24:49.914 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Command added to Queue {"id":1,"method":"enable_telnet_service","params":[]} -> 192.168.1.24 (Device: 13D24DFE token: 3758466FXXXXXXXXXXXXXXXX546F414C Queue: 1).
2022-01-14 09:24:49.915 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Sending Ping 13D24DFE (192.168.1.24)
2022-01-14 09:24:50.022 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Ping 13D24DFE (192.168.1.24) success
2022-01-14 09:24:50.024 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Command added to Queue {"id":2,"method":"get_device_list","params":[]} -> 192.168.1.24 (Device: 13D24DFE token: 3758466FXXXXXXXXXXXXXXXX546F414C Queue: 1).
2022-01-14 09:24:50.026 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Sending Ping 13D24DFE (192.168.1.24)
==> /var/log/openhab/events.log <==
2022-01-14 09:24:49.711 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'xiaomigatewayv3:config:7150139422' changed from UNINITIALIZED (DISABLED) to INITIALIZING
2022-01-14 09:24:49.726 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'xiaomigatewayv3:config:7150139422' changed from INITIALIZING to UNKNOWN
2022-01-14 09:24:49.737 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'xiaomigatewayv3:door_sensor:7150139422:lumi_158d000522535b' changed from UNINITIALIZED (BRIDGE_UNINITIALIZED) to INITIALIZING
2022-01-14 09:24:49.749 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'xiaomigatewayv3:door_sensor:7150139422:lumi_158d000522535b' changed from INITIALIZING to UNKNOWN
2022-01-14 09:24:50.591 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'xiaomigatewayv3:door_sensor:7150139422:lumi_158d000522535b' changed from UNKNOWN to ONLINE
==> /var/log/openhab/openhab.log <==
2022-01-14 09:24:54.251 [DEBUG] [3.internal.helpers.MIIOCommunication] - Received response for type: TELNET_ENABLE, result: null, fullresponse: {"id":1,"error":{"code":-9999,"message":"user ack timeout"},"exe_time":4070}
2022-01-14 09:24:54.253 [DEBUG] [3.internal.helpers.MIIOCommunication] - Error received: {"code":-9999,"message":"user ack timeout"}
2022-01-14 09:24:54.255 [DEBUG] [3.internal.helpers.MIIOCommunication] - Error in response for TELNET_ENABLE command. Ignoring and continuing.
2022-01-14 09:24:54.257 [INFO ] [internal.helpers.TenletCommunication] - Connecting via telnet to 192.168.1.24
2022-01-14 09:24:54.277 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Ping 13D24DFE (192.168.1.24) success
2022-01-14 09:24:54.278 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - Creating a new instance of MqttBrokerConnection
2022-01-14 09:24:54.278 [ERROR] [internal.helpers.TenletCommunication] - Error enabling external MQTT server
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:609) ~[?:?]
	at java.net.Socket.connect(Socket.java:558) ~[?:?]
	at java.net.Socket.<init>(Socket.java:454) ~[?:?]
	at java.net.Socket.<init>(Socket.java:231) ~[?:?]
	at org.openhab.binding.xiaomigatewayv3.internal.helpers.TenletCommunication.EnableMqttExternalServer(TenletCommunication.java:49) [bundleFile:?]
	at org.openhab.binding.xiaomigatewayv3.internal.helpers.MIIOCommunication.onMessageReceived(MIIOCommunication.java:289) [bundleFile:?]
	at org.openhab.binding.xiaomigatewayv3.internal.miio.MiIoAsyncCommunication$MessageSenderThread.run(MiIoAsyncCommunication.java:257) [bundleFile:?]
2022-01-14 09:24:54.280 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - MQTT brokers state changed to:CONNECTING
2022-01-14 09:24:54.290 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.24' with clientid sgbinding1
2022-01-14 09:24:54.314 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - MQTT brokers state changed to:CONNECTING
2022-01-14 09:24:54.690 [DEBUG] [3.internal.helpers.MIIOCommunication] - Received response for type: GET_DEVICE_LIST, result: [{"did":"lumi.158d00039d8f0b","model":"lumi.vibration.aq1","num":1,"total":2},{"did":"lumi.158d000522535b","model":"lumi.sensor_magnet.aq2","num":2,"total":2}], fullresponse: {"code":0,"id":2,"result":[{"did":"lumi.158d00039d8f0b","model":"lumi.vibration.aq1","num":1,"total":2},{"did":"lumi.158d000522535b","model":"lumi.sensor_magnet.aq2","num":2,"total":2}],"exe_time":220}
2022-01-14 09:24:54.694 [INFO ] [3.internal.helpers.MIIOCommunication] - Found devices count: 2
2022-01-14 09:24:54.696 [INFO ] [l.discovery.XiaomiGatewayV3Discovery] - AutoDiscovery: creating 2 devices
==> /var/log/openhab/events.log <==
2022-01-14 09:24:54.619 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Umidificatore_Humidity' changed from 51 % to 50 %
2022-01-14 09:24:54.811 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Umidificatore_MotorSpeed' changed from 752 to 744
==> /var/log/openhab/openhab.log <==
2022-01-14 09:24:58.502 [DEBUG] [nwebnet4j.communication.FrameChannel] - -FC-BUS-MON <------- [*#18*51*113*193##]
2022-01-14 09:24:58.505 [INFO ] [unication.BUSConnector.message.event] - BUS-MON <<<<<<<< *#18*51*113*193##
==> /var/log/openhab/events.log <==
2022-01-14 09:24:58.513 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'PotenzaImpegnata' changed from 188 to 193
==> /var/log/openhab/openhab.log <==
2022-01-14 09:25:04.320 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.24'. Next attempt in 60000ms
2022-01-14 09:25:04.328 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - MQTT brokers state changed to:CONNECTING
2022-01-14 09:25:04.338 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.24' with clientid sgbinding1
2022-01-14 09:25:04.363 [DEBUG] [andlers.XiaomiGatewayV3BridgeHandler] - MQTT brokers state changed to:CONNECTING
2022-01-14 09:25:04.369 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Command added to Queue {"id":3,"method":"enable_telnet_service","params":[]} -> 192.168.1.24 (Device: 13D24DFE token: 3758466FXXXXXXXXXXXXXXXX546F414C Queue: 1).
2022-01-14 09:25:04.371 [DEBUG] [internal.miio.MiIoAsyncCommunication] - Command added to Queue {"id":4,"method":"get_device_list","params":[]} -> 192.168.1.24 (Device: 13D24DFE token: 3758466FXXXXXXXXXXXXXXXX546F414C Queue: 2).
2022-01-14 09:25:08.546 [DEBUG] [3.internal.helpers.MIIOCommunication] - Received response for type: TELNET_ENABLE, result: null, fullresponse: {"id":3,"error":{"code":-9999,"message":"user ack timeout"},"exe_time":4070}
2022-01-14 09:25:08.548 [DEBUG] [3.internal.helpers.MIIOCommunication] - Error received: {"code":-9999,"message":"user ack timeout"}
2022-01-14 09:25:08.549 [DEBUG] [3.internal.helpers.MIIOCommunication] - Error in response for TELNET_ENABLE command. Ignoring and continuing.
2022-01-14 09:25:08.551 [INFO ] [internal.helpers.TenletCommunication] - Connecting via telnet to 192.168.1.24
2022-01-14 09:25:08.730 [ERROR] [internal.helpers.TenletCommunication] - Error enabling external MQTT server
java.net.ConnectException: Connection refused (Connection refused)
	at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[?:?]
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[?:?]
	at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
	at java.net.Socket.connect(Socket.java:609) ~[?:?]
	at java.net.Socket.connect(Socket.java:558) ~[?:?]
	at java.net.Socket.<init>(Socket.java:454) ~[?:?]
	at java.net.Socket.<init>(Socket.java:231) ~[?:?]
	at org.openhab.binding.xiaomigatewayv3.internal.helpers.TenletCommunication.EnableMqttExternalServer(TenletCommunication.java:49) [bundleFile:?]
	at org.openhab.binding.xiaomigatewayv3.internal.helpers.MIIOCommunication.onMessageReceived(MIIOCommunication.java:289) [bundleFile:?]
	at org.openhab.binding.xiaomigatewayv3.internal.miio.MiIoAsyncCommunication$MessageSenderThread.run(MiIoAsyncCommunication.java:257) [bundleFile:?]
2022-01-14 09:25:08.986 [DEBUG] [3.internal.helpers.MIIOCommunication] - Received response for type: GET_DEVICE_LIST, result: [{"did":"lumi.158d00039d8f0b","model":"lumi.vibration.aq1","num":1,"total":2},{"did":"lumi.158d000522535b","model":"lumi.sensor_magnet.aq2","num":2,"total":2}], fullresponse: {"code":0,"id":4,"result":[{"did":"lumi.158d00039d8f0b","model":"lumi.vibration.aq1","num":1,"total":2},{"did":"lumi.158d000522535b","model":"lumi.sensor_magnet.aq2","num":2,"total":2}],"exe_time":220}
2022-01-14 09:25:08.991 [INFO ] [3.internal.helpers.MIIOCommunication] - Found devices count: 2
2022-01-14 09:25:08.992 [INFO ] [l.discovery.XiaomiGatewayV3Discovery] - AutoDiscovery: creating 2 devices

@enrico.mcc What’s your device model? Can you check the firmware version?
The workaround I’ve added will make sense only if you can access the device via telnet and the command to enable causes an error. If you can’t telnet to your device, the biding won’t be able to to anything.
So, the first thing is to enable telnet on your gateway.

Hi,

I think I must have updated the hub by mistake as I cannot telnet into it and I get connection refused when I try to conect.

Tbh, at this moment I don’t have the time to work on this, but I really appreciate all your help.

Maybe I will try it again in a few months.

When you have time, can you check the firmware version in the app?
I am checking another options to enable telnet and might have a solution (will try to implement) if the firmware version is correct.
Cheers.

Hi mate,

It’s 1.5.1_0032.

Cheers,

Pim

my device info:

  • firmwareVersion

1.5.1_0032

  • modelId

lumi.gateway.mgl03

I tried multiple ways to telnet again but to no avail (honestly some methods were to advanced for my skills) :frowning:

Sorry, still in progress, my original idea didn’t work. Still looking for a solution.

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.