[TapoControl] - Control Tapo Smart WiFi-Devices with Openhab - Official Support Thread

@rubenfuser
Not bad. Seem’s to be the response i need.
Still need the command to get this type of response.
Sure i’ll take a look in the tp-link source. But don’t hurry. I’m a little busy.

Thank’s for helping @Eriberto_de_Munari. If the snapshot-binding works fine i dont’t need the debug log anymore from him. Just give me feedback then

Thanks to you. Hope you will get the goal :blush:
If can help, i’ve found this on github:

@Bigdesaster All works fine with L530, sorry for not being able to make the debug binding, now thanks to @rubenfuser, for this and some more, I’ll do this if needed.
You got the point anyway and that’s great.
Thanks a lot again, cheers, Eriberto

@rubenfuser
Thanks. I ordered a P110 now too. If the device arrives i’ll show how i can implement it.

@Eriberto_de_Munari
Well nice. Then i’ll create a pull request so that the change can be implemented in the official version.

1 Like

Great! I prefer tapo device instead of tp-link because its cost is 3times cheaper!
Thanks a lot!

Great. Just installed one P110 and I can join the testing team.

Hey Guys,
just uploaded new version with energy support here.
Pay attention to readme when using L510/L530 devices.

Please give feedback here.

1 Like

Just installed this new version. Some observations:

  1. When thing is activated a json decode failed appears in the Thing tab and status goes to UNKNOWN
  2. Output Switch channel works (even if thing status is UNKNOWN)
  3. Channels Power, Today Usage and Today Runtime do not report any value

I have Tapo (and all my other IoT) devices in a separate vlan with no internet access.

Mhh. It’s working with my P110 device. Can you post Trace log?

for me everything is okay with Tapo P110!

great job man, really great! i’ll keep this in test for 1 week and then i will buy 5 tapo devices to control my house main devices! really really thanks for your help!!!

Here is the trace log

2022-01-10 15:28:57.215 [TRACE] [pocontrol.internal.device.TapoDevice] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) starScheduler: create job with interval : 30
2022-01-10 15:28:58.471 [TRACE] [pocontrol.internal.device.TapoDevice] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD4BA) schedulerAction
2022-01-10 15:28:58.473 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD4BA) DeviceConnetor_queryInfo from 'http://192.168.129.153/app?token=2D9718974197D397FF973E972097C097'
2022-01-10 15:28:58.474 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD4BA) sendAsncRequest to 'http://192.168.129.153/app?token=2D9718974197D397FF973E972097C097' with cookie 'TP_SESSIONID=C0A5CFA63796B89744878387F5879E87'
2022-01-10 15:28:58.505 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD4BA) requestCompleted '{"error_code":0,"result":{"device_id":"8022310D8180F003B5BF4ED6745514C11DE2622C","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-FF-D4-BA","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"UsOhZGlvIGUgVFY=","location":"","avatar":"plug","longitude":-86465,"latitude":406386,"has_set_location_info":true,"ip":"192.168.129.153","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":3,"rssi":-39,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}'
2022-01-10 15:28:58.507 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD4BA) received result: {"error_code":0,"result":{"device_id":"8022310D8180F003B5BF4ED6745514C11DE2622C","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-FF-D4-BA","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"UsOhZGlvIGUgVFY=","location":"","avatar":"plug","longitude":-86465,"latitude":406386,"has_set_location_info":true,"ip":"192.168.129.153","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":3,"rssi":-39,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}
2022-01-10 15:28:59.218 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) sending login to url 'http://192.168.129.160/app'
2022-01-10 15:28:59.219 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) create handhsake with payload: {"method":"handshake","params":{"key":"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCvCP8+a4ZxM9d5xjPncQHn88YMJ8M+8srbWcaw\r\nxu194rDRjIxzp5F5pwg4U2BpjFlXlbU4E5vddkwKQ+F2xjFh9nYUKvJxQA0La3V0dw9rHk7hLdsh\r\nUCsHuBFSiBaeqvztcvtYKevJCSTlvt/6Ktdi3epRZd2eoehapIosRKl/OwIDAQAB\n-----END PUBLIC KEY-----\n"},"requestTimeMils":1641828539218}
2022-01-10 15:28:59.220 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) sendRequest to 'http://192.168.129.160/app' with cookie ''
2022-01-10 15:28:59.751 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) received awnser: {"error_code":0,"result":{"key":"jc6vj4EeSWXnDrsfflOJhbP/6Ts4OtsOL/Bk1ZL3TbG/UaBFyy6549F7mrdOIbhPIrBnXqymMlGcoRufb6hTebyjAkdCzn2g6xzSK7nQ7IgJAZTIiCAfXB1NS+DzvKzSp7oRUt037oBjU2l2igodnLSES+OFMUNXXpB+4n6ZjG4="}}
2022-01-10 15:28:59.752 [TRACE] [ocontrol.internal.helpers.TapoCipher] - Init TapoCipher with key: jc6vj4EeSWXnDrsfflOJhbP/6Ts4OtsOL/Bk1ZL3TbG/UaBFyy6549F7mrdOIbhPIrBnXqymMlGcoRufb6hTebyjAkdCzn2g6xzSK7nQ7IgJAZTIiCAfXB1NS+DzvKzSp7oRUt037oBjU2l2igodnLSES+OFMUNXXpB+4n6ZjG4= 
2022-01-10 15:28:59.755 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) got cookie: 'TP_SESSIONID=B786992EBDB99A63C504769CEC7CE57F'
2022-01-10 15:28:59.756 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) sendRequest to 'http://192.168.129.160/app' with cookie 'TP_SESSIONID=B786992EBDB99A63C504769CEC7CE57F'
2022-01-10 15:28:59.935 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) received result: {"error_code":0,"result":{"token":"41A316622E2C2ABE069F9EC9F3F0B95B"}}
2022-01-10 15:28:59.936 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) DeviceConnetor_queryInfo from 'http://192.168.129.160/app?token=41A316622E2C2ABE069F9EC9F3F0B95B'
2022-01-10 15:28:59.936 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) sendAsncRequest to 'http://192.168.129.160/app?token=41A316622E2C2ABE069F9EC9F3F0B95B' with cookie 'TP_SESSIONID=B786992EBDB99A63C504769CEC7CE57F'
2022-01-10 15:28:59.952 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) requestCompleted '{"result":{"device_id":"80227F7E16FE84060344E9D43D5DECEE1F37479C","fw_ver":"1.0.7 Build 210629 Rel.174901","hw_ver":"1.0","type":"SMART.TAPOPLUG","model":"P110","mac":"6C-5A-B0-EF-42-1B","hw_id":"2FB30EF5BF920C44099401D396C6B55B","fw_id":"00000000000000000000000000000000","oem_id":"18BDC6C734AF8407B3EF871EACFCECF5","overheated":false,"ip":"192.168.129.160","time_diff":0,"ssid":"QXZlaXJvLURvbW90aWM=","rssi":-76,"signal_level":1,"latitude":406389,"longitude":-86489,"lang":"pt_PT","avatar":"plug","region":"Europe/Lisbon","specs":"","nickname":"RGVzdW1pZGlmaWNhZG9y","has_set_location_info":true,"device_on":true,"on_time":1228,"default_states":{"type":"last_states","state":null}},"error_code":0}'
2022-01-10 15:28:59.953 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P110:2a2ef37a29:8d49c446e9) received result: {"result":{"device_id":"80227F7E16FE84060344E9D43D5DECEE1F37479C","fw_ver":"1.0.7 Build 210629 Rel.174901","hw_ver":"1.0","type":"SMART.TAPOPLUG","model":"P110","mac":"6C-5A-B0-EF-42-1B","hw_id":"2FB30EF5BF920C44099401D396C6B55B","fw_id":"00000000000000000000000000000000","oem_id":"18BDC6C734AF8407B3EF871EACFCECF5","overheated":false,"ip":"192.168.129.160","time_diff":0,"ssid":"QXZlaXJvLURvbW90aWM=","rssi":-76,"signal_level":1,"latitude":406389,"longitude":-86489,"lang":"pt_PT","avatar":"plug","region":"Europe/Lisbon","specs":"","nickname":"RGVzdW1pZGlmaWNhZG9y","has_set_location_info":true,"device_on":true,"on_time":1228,"default_states":{"type":"last_states","state":null}},"error_code":0}
2022-01-10 15:29:06.759 [TRACE] [pocontrol.internal.device.TapoDevice] - (tapocontrol:P100:6731f67b2d:C0C9E37658C6) schedulerAction
2022-01-10 15:29:06.759 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E37658C6) DeviceConnetor_queryInfo from 'http://192.168.129.150/app?token=242F962EB33EE23EF03ED03ED13EC13E'
2022-01-10 15:29:06.760 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E37658C6) sendAsncRequest to 'http://192.168.129.150/app?token=242F962EB33EE23EF03ED03ED13EC13E' with cookie 'TP_SESSIONID=D00FD10FC90F490F450F8D0F0B0F6F0F'
2022-01-10 15:29:06.800 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E37658C6) requestCompleted '{"error_code":0,"result":{"device_id":"802200E417335EB9A90D90BD5F477AF91DD57765","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-76-58-C6","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"QXF1ZWNlZG9y","location":"","avatar":"plug","longitude":-86489,"latitude":406388,"has_set_location_info":true,"ip":"192.168.129.150","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":1,"rssi":-74,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}'
2022-01-10 15:29:06.801 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E37658C6) received result: {"error_code":0,"result":{"device_id":"802200E417335EB9A90D90BD5F477AF91DD57765","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-76-58-C6","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"QXF1ZWNlZG9y","location":"","avatar":"plug","longitude":-86489,"latitude":406388,"has_set_location_info":true,"ip":"192.168.129.150","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":1,"rssi":-74,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}
2022-01-10 15:29:15.662 [TRACE] [pocontrol.internal.device.TapoDevice] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD1A1) schedulerAction
2022-01-10 15:29:15.663 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD1A1) DeviceConnetor_queryInfo from 'http://192.168.129.152/app?token=7258FA597E493A4978495249F349E649'
2022-01-10 15:29:15.664 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD1A1) sendAsncRequest to 'http://192.168.129.152/app?token=7258FA597E493A4978495249F349E649' with cookie 'TP_SESSIONID=A25AFC591E69396848785B786B786A78'
2022-01-10 15:29:15.711 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD1A1) requestCompleted '{"error_code":0,"result":{"device_id":"802224E5D956A55685AE5BF9FAA9A6471DE3408E","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-FF-D1-A1","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"QXF1ZWNlZG9yIMOzbGVvIA==","location":"","avatar":"plug","longitude":-86489,"latitude":406388,"has_set_location_info":true,"ip":"192.168.129.152","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":2,"rssi":-53,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}'
2022-01-10 15:29:15.712 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E3FFD1A1) received result: {"error_code":0,"result":{"device_id":"802224E5D956A55685AE5BF9FAA9A6471DE3408E","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-FF-D1-A1","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"QXF1ZWNlZG9yIMOzbGVvIA==","location":"","avatar":"plug","longitude":-86489,"latitude":406388,"has_set_location_info":true,"ip":"192.168.129.152","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":2,"rssi":-53,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}
2022-01-10 15:29:22.371 [TRACE] [pocontrol.internal.device.TapoDevice] - (tapocontrol:P100:6731f67b2d:C0C9E3963230) schedulerAction
2022-01-10 15:29:22.371 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E3963230) DeviceConnetor_queryInfo from 'http://192.168.129.151/app?token=7432E2338623C523FF235E2343239323'
2022-01-10 15:29:22.372 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E3963230) sendAsncRequest to 'http://192.168.129.151/app?token=7432E2338623C523FF235E2343239323' with cookie 'TP_SESSIONID=C647C740DF305F335B0313029112BD12'
2022-01-10 15:29:22.417 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:6731f67b2d:C0C9E3963230) requestCompleted '{"error_code":0,"result":{"device_id":"802276D916E481D2AAC519233901C9351DDB14C1","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-96-32-30","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"Q2FuZGVlaXJvIGR1cGxv","location":"","avatar":"plug","longitude":-86491,"latitude":406387,"has_set_location_info":true,"ip":"192.168.129.151","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":3,"rssi":-45,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}'
2022-01-10 15:29:22.417 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:6731f67b2d:C0C9E3963230) received result: {"error_code":0,"result":{"device_id":"802276D916E481D2AAC519233901C9351DDB14C1","fw_ver":"1.4.9 Build 20210621 Rel. 30941","hw_ver":"1.20.0","type":"SMART.TAPOPLUG","model":"P100","mac":"C0-C9-E3-96-32-30","hw_id":"9994A0A7D5B29645B8150C392284029D","fw_id":"1D18AD293A25ABDE41405B20C6F98816","oem_id":"D7C5ADFD37188938BA82FD0FE208D1E7","specs":"EU","device_on":false,"on_time":0,"overheated":false,"nickname":"Q2FuZGVlaXJvIGR1cGxv","location":"","avatar":"plug","longitude":-86491,"latitude":406387,"has_set_location_info":true,"ip":"192.168.129.151","ssid":"QXZlaXJvLURvbW90aWM=","signal_level":3,"rssi":-45,"region":"Europe/Lisbon","time_diff":0,"lang":"pt_PT","default_states":{"type":"last_states","state":null}}}

192.168.129.160 is the P110 device.

one little question, can you also add the overheated thing in your binding?

@moody_blue
Mhh in this peace of log the device does not query the energydata. There’s also no error inside.
Do you see something in the log?

@rubenfuser
Thx :slight_smile: . I’ll take a look. Should not be a big problem.

When I enable internet access to my IoT vlan the power info is ok. I’ve now disabled internet access to see what happens (normally , after some time, Tapo app will report that the device is offline but, using OpenHab, I’m still able to switch it on/off).

Edit: all seems ok. Firewall blocking internet access, but OH able to switch the P110 and read its power data.

Great achievement, thank you very much.

Good to hear that it works now. :slight_smile:
Don’t really know what internet access has to do with the energy data query. It uses the same connection like normal device-queries.
Could it be that the devices made a firmware update when you let them access to internet?

Edit:
Maybe it’s a time/date problem when the devices have no internet-connection.
In the response of energy-monitoring-data is a 'local_time': '2021-08-21 12:23:45' returned.
Could be possible that when device did not get a date/time energy monitoring is not working on the device itself.

Another possibility is that during device initialization your binding queries the Tapo cloud, and if the device is offline you don’t get the tokens to access power. I’ve unplugged the P110 to put it in its target location. And doing so power reporting stopped. Enabling internet for one minute fixed it.

If it’s a time problem how can I fix it ? I have some Tasmota devices and had to implement my own NTP server so that they work correctly. But Tasmota allows me to specify the ip of the ntp service. I can open ports 123 / 1023 to test if Tapo P110 is trying to access an external ntp service.

No, as i already said it’s the same conenction and token than normal device-queries.

If it’s a time problem how can I fix it ?

I’m afraid theres no fix if energy monitoring is not working on device. If you can reproduce the error you can try to trace result one more time and look if there is any energy result from device.
Maybe you can unlock only udp port in the case devices get time over udp?

Hi all,
I am new on this thread and addon.
Today I installed 2 P100 and 2 P110 on OH3.2 stable.
I directly setup the snaphot jar and it seems that everything is OK for both device types !
The only issue is that i cannot use manual thing file for devices (only for tapo account). Annoying because all my other OH things are on manual thing files…
Are you in the same situation guys ?
Anyways, great job again for this addon.
Final question : will be ever possible anytime to get rid of the cloud base authentication to be only in LAN ? I can live with this now, but my entire setup is independant of internet… except this binding.

Many thanks ! :grinning:

@rubenfuser
overheated was already implemented but it’s advanced. :sweat_smile:
Check advanced checkbox then the channel is there.

@funcat
textual configuration should work, but i have to admit that i didn’t test it really. Did you configure them like at the end of readme?

The communication with devices is directly. The bridge is the only thing who is connecting to the Tapo-Cloud by this binding. This is only for device discovery.
As moody_blue’s example shows it’s working, except energy-monitoring, if devices have no internet access.