Dear @dnpwwo,
Working on 2 UDP connectons here is the log file:
Code: Select all
2018-01-30 19:01:13.391 (test) Debug log level set to: 'true'.
2018-01-30 19:01:13.391 (test) Creating device 'Miio AQI'.
2018-01-30 19:01:13.393 (test) Device created.
2018-01-30 19:01:13.393 (test) 'HardwareID':'2'
2018-01-30 19:01:13.393 (test) 'HomeFolder':'/config/plugins/Xiaomi/'
2018-01-30 19:01:13.393 (test) 'Version':'0.9.0'
2018-01-30 19:01:13.393 (test) 'Author':'febalci'
2018-01-30 19:01:13.393 (test) 'Name':'test'
2018-01-30 19:01:13.393 (test) 'Address':'192.168.1.86'
2018-01-30 19:01:13.393 (test) 'Port':'54321'
2018-01-30 19:01:13.393 (test) 'Key':'XiaomiPM'
2018-01-30 19:01:13.393 (test) 'Mode6':'Debug'
2018-01-30 19:01:13.393 (test) 'DomoticzVersion':'3.8833'
2018-01-30 19:01:13.393 (test) 'DomoticzHash':'60050638'
2018-01-30 19:01:13.393 (test) 'DomoticzBuildTime':'2018-01-19 15:22:13'
2018-01-30 19:01:13.393 (test) Device count: 1
2018-01-30 19:01:13.394 (test) Device: 1 - ID: 1, Name: 'test - Miio AQI', nValue: 0, sValue: ''
2018-01-30 19:01:13.394 (test) Device ID: '1'
2018-01-30 19:01:13.394 (test) Device Name: 'test - Miio AQI'
2018-01-30 19:01:13.394 (test) Device nValue: 0
2018-01-30 19:01:13.394 (test) Device sValue: ''
2018-01-30 19:01:13.394 (test) Device LastLevel: 0
2018-01-30 19:01:13.401 (test) Protocol set to: 'None'.
2018-01-30 19:01:13.401 (test) Protocol set to: 'None'.
2018-01-30 19:01:13.401 (test) Transport set to: 'UDP/IP', 192.168.1.86:54321.
2018-01-30 19:01:13.403 PluginSystem: Starting I/O service thread.
2018-01-30 19:01:13.404 (test) Listen directive received, action initiated successfully.
2018-01-30 19:01:13.404 (test) Transport set to: 'UDP/IP', 192.168.1.86:54321 for 'miioConnection2'.
2018-01-30 19:01:13.404 (test) Sending 32 bytes of data:
2018-01-30 19:01:13.404 (test) 21 31 00 20 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff !1..����������������
2018-01-30 19:01:13.404 (test) ff ff ff ff ff ff ff ff ff ff ff ff .. .. .. .. .. .. .. .. ������������
2018-01-30 19:01:13.404 (test) Heartbeat interval set to: 30.
So i see the message going out. But no response.
Here is the wireshark log:
Code: Select all
38 8.505739 192.168.1.54 192.168.1.86 UDP 74 56575→54321 Len=32
0000 78 11 dc 8b b3 19 98 e0 d9 9a 51 df 08 00 45 00
0010 00 3c 3f f9 00 00 3f 11 b7 db c0 a8 01 36 c0 a8
0020 01 56 dc ff d4 31 00 28 a9 3e 21 31 00 20 ff ff
0030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
0040 ff ff ff ff ff ff ff ff ff ff
39 8.513941 192.168.1.86 192.168.1.54 UDP 74 54321→56575 Len=32
0000 98 e0 d9 9a 51 df 78 11 dc 8b b3 19 08 00 45 00
0010 00 3c 03 9f 00 00 ff 11 34 35 c0 a8 01 56 c0 a8
0020 01 36 d4 31 dc ff 00 28 d8 2a 21 31 00 20 00 00
0030 00 00 04 79 f2 0b 00 00 0c dd 9d e5 5e dd 1b ac
0040 47 45 77 36 4e cd e7 43 c0 b5
So i got the response back.
Here is the related part of the test plugin:
Code: Select all
class BasePlugin:
miioConn = None
miioConn2 = None
hellopackage = b'\x21\x31\x00\x20\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
def __init__(self):
#self.var = 123
return
def onStart(self):
if Parameters["Mode6"] == "Debug":
Domoticz.Debugging(1)
if (len(Devices) == 0):
Domoticz.Device(Name="Miio AQI", Unit=1, TypeName="Air Quality", Used=1).Create()
Domoticz.Debug("Device created.")
DumpConfigToLog()
self.miioConn = Domoticz.Connection(Name="miioConnection", Transport="UDP/IP", Protocol="None", Address=Parameters["Address"], Port=Parameters["Port"])
self.miioConn2 = Domoticz.Connection(Name="miioConnection2", Transport="UDP/IP", Protocol="None", Address=Parameters["Address"], Port=Parameters["Port"])
self.miioConn.Listen()
self.miioConn2.Send(self.hellopackage)
Domoticz.Heartbeat(30)
It never goes to onMessage... Btw domoticz version is 3.8833