jimboca / udi-poly-kasa

UDI ISY Polyglot NodeServer for TP-Link Kasa
MIT License
2 stars 4 forks source link

HS103 v5 get "unpack requires a buffer of 4 bytes" error when trying to "discover" #24

Open albrandwood opened 2 years ago

albrandwood commented 2 years ago

HS103 v5 get "unpack requires a buffer of 4 bytes" error when trying to "discover"

2022-01-05 17:39:45,766 NodeServer polyinterface      WARNING  Controller:discover: Adding previously known device that didn't respond to discover: {'type': 'SmartPlug', 'name': 'PA Node Test', 'host': '192.168.1.68', 'mac': '00:5f:67:d4:c9:f2', 'model': 'HS103(US)', 'address': '005f67d4c9f2', 'emeter': False, 'id': 'SmartPlug_NN'}
2022-01-05 17:39:45,766 NodeServer polyinterface      INFO     Controller:add_node: adding SmartPlug 'PA Node Test' 005f67d4c9f2
2022-01-05 17:39:45,766 NodeServer polyinterface      DEBUG    SmartDeviceNode:__init__: PA Node Test: dev=None
2022-01-05 17:39:45,766 NodeServer polyinterface      DEBUG    SmartDeviceNode:__init__: PA Node Test: cfg={'type': 'SmartPlug', 'name': 'PA Node Test', 'host': '192.168.1.68', 'mac': '00:5f:67:d4:c9:f2', 'model': 'HS103(US)', 'address': '005f67d4c9f2', 'emeter': False, 'id': 'SmartPlug_NN'}
2022-01-05 17:39:45,766 NodeServer polyinterface      DEBUG    SmartDeviceNode:__init__: PA Node Test: controller=<nodes.Controller.Controller object at 0xf700962c> address=005f67d4c9f2 name=PA Node Test host=192.168.1.68
2022-01-05 17:39:45,766 NodeServer polyinterface      INFO     polyinterface:addNode: Adding node PA Node Test(005f67d4c9f2)
2022-01-05 17:39:45,766 NodeServer polyinterface      INFO     Controller:discover: done
2022-01-05 17:39:45,769 Controller polyinterface      DEBUG    SmartDeviceNode:connect: PA Node Test: connected=None
2022-01-05 17:39:45,769 Controller kasa.smartdevice   DEBUG    smartdevice:__init__: Initializing 192.168.1.68 of type <class 'kasa.smartplug.SmartPlug'>
2022-01-05 17:39:45,770 Controller polyinterface      DEBUG    SmartDeviceNode:update: PA Node Test: self.dev:<DeviceType.Plug at 192.168.1.68 - update() needed>
2022-01-05 17:39:45,770 Controller polyinterface      DEBUG    SmartDeviceNode:update: PA Node Test: asyncio.run
2022-01-05 17:39:45,770 Controller asyncio            DEBUG    selector_events:__init__: Using selector: EpollSelector
2022-01-05 17:39:45,798 Controller kasa.protocol      DEBUG    protocol:query: > (143) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null, "get_monthstat": {"year": 2022}, "get_daystat": {"month": 1, "year": 2022}}}
2022-01-05 17:40:45,852 Controller kasa.protocol      DEBUG    protocol:query: Unable to query the device, retrying: unpack requires a buffer of 4 bytes
2022-01-05 17:40:45,859 Controller kasa.protocol      DEBUG    protocol:query: > (143) {"system": {"get_sysinfo": null}, "emeter": {"get_realtime": null, "get_monthstat": {"year": 2022}, "get_daystat": {"month": 1, "year": 2022}}}

I'm fairly sure (based on my limited Python abilities) the issue the is "protocol:query: Unable to query the device, retrying: unpack requires a buffer of 4 bytes" ... I'm assuming that it's just a case of "code change" by TPLink ...

My Polyglot has python-kasa 0.4.0 installed ... The device does respond to the test script:

# kasa --host 192.168.1.68 --plug sysinfo
== System info ==
{'active_mode': 'none',
 'alias': 'PA Node Test',
 'dev_name': 'Smart Wi-Fi Plug Mini',
 'deviceId': '8006E4CFFFEE6ABA49B2B2F2C90C8A791E5A7712',
 'err_code': 0,
 'feature': 'TIM',
 'hwId': 'B25CBC5351DD892EA69AB42199F59E41',
 'hw_ver': '5.0',
 'icon_hash': '',
 'latitude_i': 407337,
 'led_off': 0,
 'longitude_i': -736779,
 'mac': '00:5F:67:D4:C9:F2',
 'mic_type': 'IOT.SMARTPLUGSWITCH',
 'model': 'HS103(US)',
 'next_action': {'type': -1},
 'oemId': '211C91F3C6FA93568D818524FE170CEC',
 'on_time': 0,
 'relay_state': 0,
 'rssi': -33,
 'status': 'new',
 'sw_ver': '1.0.3 Build 201015 Rel.142523',
 'updating': 0}
# kasa --host 192.168.1.68 --plug on     
Turning on PA Node Test
# kasa --host 192.168.1.68 --plug off
Turning off PA Node Test

Let me know if you need more (or if you want me to send you a device and/or have Amazon send you one)

Thanks

@shley