GadgetReactor / pyHS100

Python Library to control TPLink Switch (HS100 / HS110)
Other
409 stars 128 forks source link

Smartstrip not reporting power state correctly. #160

Closed ghost closed 5 years ago

ghost commented 5 years ago

Plug 5 and 6 are actually off.

== TP-LINK_Power Strip_D838 - HS300(US) == Device state: ON Host/IP: 192.168.129.154 LED state: True Plug 1 on since: 2019-02-25 14:10:13.342708 Plug 2 on since: 2019-02-25 14:10:13.342718 Plug 3 on since: 2019-02-25 14:10:13.342720 Plug 4 on since: 2019-02-25 14:10:13.342721 Plug 5 on since: 2019-02-25 14:10:13.342722 Plug 6 on since: 2019-02-25 14:10:13.342723 == Generic information == Time: 2019-02-25 14:10:12 Hardware: 1.0 Software: 1.0.6 Build 180627 Rel.081000 MAC (rssi): B0:BE:76:2A:D8:38 (-52) Location: {'latitude': 373636, 'longitude': -1220101} == Emeter == == Current State == {0: {'voltage_mv': 122265, 'current_ma': 4, 'power_mw': 0, 'total_wh': 57}, 1: {'voltage_mv': 122514, 'current_ma': 4, 'power_mw': 46, 'total_wh': 8}, 2: {'voltage_mv': 123359, 'current_ma': 4, 'power_mw': 60, 'total_wh': 24}, 3: {'voltage_mv': 123110, 'current_ma': 4, 'power_mw': 31, 'total_wh': 0}, 4: {'voltage_mv': 122729, 'current_ma': 4, 'power_mw': 7, 'total_wh': 0}, 5: {'voltage_mv': 122481, 'current_ma': 4, 'power_mw': 5, 'total_wh': 0}}

rytilahti commented 5 years ago

Please run with --debug, e.g., pyhs100 --debug state to get the raw payloads from the device and include them.

ghost commented 5 years ago

Happy to!

pyhs100 --host 192.168.129.154 --strip --debug

DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9044,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9044,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9044,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9044,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9044,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9044,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} == TP-LINK_Power Strip_D838 - HS300(US) == Device state: ON Host/IP: 192.168.129.154 DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9044,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9044,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9044,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9044,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} LED state: True Plug 1 on since: 2019-02-25 14:13:48.687408 Plug 2 on since: 2019-02-25 16:44:32.687418 Plug 3 on since: 2019-02-25 16:44:32.687420 Plug 4 on since: 2019-02-25 16:44:32.687421 Plug 5 on since: 2019-02-25 16:44:32.687422 Plug 6 on since: 2019-02-25 14:13:48.687424 == Generic information == DEBUG:pyHS100.protocol:> (28) {"time": {"get_time": null}} DEBUG:pyHS100.protocol:< (96) {"time":{"get_time":{"year":2019,"month":2,"mday":25,"hour":16,"min":44,"sec":31,"err_code":0}}} Time: 2019-02-25 16:44:31 DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9044,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9044,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} Hardware: 1.0 DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} Software: 1.0.6 Build 180627 Rel.081000 DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} MAC (rssi): B0:BE:76:2A:D8:38 (-51) DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} Location: {'latitude': 373636, 'longitude': -1220101} == Emeter == DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (33) {"system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9045,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9045,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (107) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00"]}, "system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9046,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9046,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (108) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00"]}, "emeter": {"get_realtime": null}} DEBUG:pyHS100.protocol:< (108) {"emeter":{"get_realtime":{"voltage_mv":121006,"current_ma":35,"power_mw":2898,"total_wh":65,"err_code":0}}} DEBUG:pyHS100.protocol:> (107) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01"]}, "system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9046,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9046,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (108) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01"]}, "emeter": {"get_realtime": null}} DEBUG:pyHS100.protocol:< (104) {"emeter":{"get_realtime":{"voltage_mv":121288,"current_ma":4,"power_mw":0,"total_wh":12,"err_code":0}}} DEBUG:pyHS100.protocol:> (107) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02"]}, "system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9046,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9046,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (108) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02"]}, "emeter": {"get_realtime": null}} DEBUG:pyHS100.protocol:< (105) {"emeter":{"get_realtime":{"voltage_mv":122149,"current_ma":4,"power_mw":55,"total_wh":25,"err_code":0}}} DEBUG:pyHS100.protocol:> (107) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03"]}, "system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9047,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9047,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (108) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03"]}, "emeter": {"get_realtime": null}} DEBUG:pyHS100.protocol:< (103) {"emeter":{"get_realtime":{"voltage_mv":121951,"current_ma":4,"power_mw":0,"total_wh":4,"err_code":0}}} DEBUG:pyHS100.protocol:> (107) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04"]}, "system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-51,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9047,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9047,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (108) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04"]}, "emeter": {"get_realtime": null}} DEBUG:pyHS100.protocol:< (103) {"emeter":{"get_realtime":{"voltage_mv":121570,"current_ma":4,"power_mw":0,"total_wh":0,"err_code":0}}} DEBUG:pyHS100.protocol:> (107) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05"]}, "system": {"get_sysinfo": null}} DEBUG:pyHS100.protocol:< (1237) {"system":{"get_sysinfo":{"sw_ver":"1.0.6 Build 180627 Rel.081000","hw_ver":"1.0","model":"HS300(US)","deviceId":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA","oemId":"5C9E6254BEBAED63B2B6102966D24C17","hwId":"34C41AA028022D0CCEA5E678E8547C54","rssi":-52,"longitude_i":-1220101,"latitude_i":373636,"alias":"TP-LINK_Power Strip_D838","mic_type":"IOT.SMARTPLUGSWITCH","feature":"TIM:ENE","mac":"B0:BE:76:2A:D8:38","updating":0,"led_off":0,"children":[{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA00","state":1,"alias":"Computer Clock Light","on_time":9047,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA01","state":0,"alias":"Computer Room Light","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA02","state":0,"alias":"Computer Room Ionizer","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA03","state":0,"alias":"Computer Radio","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA04","state":0,"alias":"House Fan","on_time":0,"next_action":{"type":-1}},{"id":"8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05","state":1,"alias":"Plug 6","on_time":9047,"next_action":{"type":-1}}],"child_num":6,"err_code":0}}} DEBUG:pyHS100.protocol:> (108) {"context": {"child_ids": ["8006B8B4F8E9963F903B170A018DDAAE1ABB51EA05"]}, "emeter": {"get_realtime": null}} DEBUG:pyHS100.protocol:< (103) {"emeter":{"get_realtime":{"voltage_mv":121255,"current_ma":4,"power_mw":1,"total_wh":0,"err_code":0}}} == Current State == {0: {'voltage_mv': 121006, 'current_ma': 35, 'power_mw': 2898, 'total_wh': 65}, 1: {'voltage_mv': 121288, 'current_ma': 4, 'power_mw': 0, 'total_wh': 12}, 2: {'voltage_mv': 122149, 'current_ma': 4, 'power_mw': 55, 'total_wh': 25}, 3: {'voltage_mv': 121951, 'current_ma': 4, 'power_mw': 0, 'total_wh': 4}, 4: {'voltage_mv': 121570, 'current_ma': 4, 'power_mw': 0, 'total_wh': 0}, 5: {'voltage_mv': 121255, 'current_ma': 4, 'power_mw': 1, 'total_wh': 0}}

rytilahti commented 5 years ago

I'm reading it as if plugs "Computer Clock Light" and "Plug 6" were on, and the others were off. @jimboca any ideas?

edit: actually, I suppose this is just a problem in the cli part, it's printing the output based on "on_time" without checking its state.

ghost commented 5 years ago

At the time that this debug command was issued:

Computer Room Light, Computer Room Ionizer, Computer Radio, Plug 6, House Fan were off. Computer Clock Light was the only device that was on.

I am excited power strips are being supported by this library, I use it a lot, but trying to figure out how to turn the individual plugs on an off via library or the cli is not revealing itself.

jimboca commented 5 years ago

Sorry don't have time to review, but most work was done by @newAM for the strip support

rytilahti commented 5 years ago

@kyroraz could you test if the linked PR works for you?

@jimboca no worries, sorry for the unnecessary ping!

newAM commented 5 years ago

Eek, sorry about this bug!

I ran your PR and found a small problem, I left a comment there.