[TapoControl] - Control Tapo Smart WiFi-Devices with Openhab

I had to uninstall the 3.3 binding from the UI, then put the jar into that folder. I did a restart of openHAB and the new binding appears in Karaf and the item is online. Looks good so far, thanks :slight_smile:

Will report when I have the devices!

Hello, thanks for uploading the jar, but my “TapoP100SmartPlug” doesn’t send OFF signal. Signal ON is ok.

UPD: Sorry, OFF signal doesn’t send in admin mode only.

Admin Mode? If you are logged in in OH? Should not matter.
What’s says the log?

Yes, i mean logged in OH. I’m going to “Items”, choose “Output Switch” (TapoP100SmartPlug_OutputSwitch) and touch switcher up/down but in logs only:

2022-11-18 04:24:39.748 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:3e2e5feb38:6C5AB042E8AB' changed from OFFLINE (COMMUNICATION_ERROR): Device Offline to UNKNOWN: No route to host (16562879)
2022-11-18 04:24:40.064 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:3e2e5feb38:6C5AB042E8AB' changed from UNKNOWN: No route to host (16562879) to OFFLINE (COMMUNICATION_ERROR): Device Offline
2022-11-18 04:25:10.224 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:3e2e5feb38:6C5AB042E8AB' changed from OFFLINE (COMMUNICATION_ERROR): Device Offline to ONLINE
2022-11-18 04:26:21.988 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'esp8266hub_temperature' changed from 26.18 to 26.51
2022-11-18 04:26:53.386 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command ON
2022-11-18 04:26:53.389 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become ON
2022-11-18 04:26:53.404 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TapoP100SmartPlug_OutputSwitch' changed from OFF to ON
2022-11-18 04:30:02.803 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OpenWeatherMap_temp' changed from -3.1 to -3.24
2022-11-18 04:30:02.851 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OpenWeatherMap_humidity' changed from 93 to 94
2022-11-18 04:30:02.853 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OpenWeatherMap_pressure' changed from 1007 to 1008
2022-11-18 04:30:10.256 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TapoP100SmartPlug_nn' changed from 3 to 2
2022-11-18 04:30:10.317 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'OWM_temp' changed from -5.18 to -6.18
2022-11-18 04:30:42.395 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command ON
2022-11-18 04:30:42.399 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become ON
2022-11-18 04:31:02.544 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command ON
2022-11-18 04:31:02.554 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become ON
2022-11-18 04:31:02.646 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TapoP100SmartPlug_nn' changed from 2 to 3
2022-11-18 04:31:21.964 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'esp8266hub_humidity' changed from 27.94 to 32.62
2022-11-18 04:32:03.613 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command ON
2022-11-18 04:32:03.617 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become ON
2022-11-18 04:32:40.259 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TapoP100SmartPlug_nn' changed from 3 to 2
2022-11-18 04:33:40.265 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TapoP100SmartPlug_nn' changed from 2 to 3
2022-11-18 04:35:27.125 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command ON
2022-11-18 04:35:27.130 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become ON
2022-11-18 04:35:38.009 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command ON
2022-11-18 04:35:38.014 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become ON

Please set log-level for bindig to ‘trace’ in oh-console post it here.
Login normally is not detected by the binding.

it looks like “openhab.event.” does not work properly. When I switching OFF my p100 nothing happened and I need wait when my mqtt binding generate openhab.event.ItemStateChangedEvent:

2022-11-19 01:36:22.677 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'esp8266hub_temperature' changed from 25.50 to 25.51

then:

2022-11-19 01:56:22.698 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'TapoP100SmartPlug_OutputSwitch' received command OFF
2022-11-19 01:56:22.703 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'TapoP100SmartPlug_OutputSwitch' predicted to become OFF
2022-11-19 01:56:22.711 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'TapoP100SmartPlug_OutputSwitch' changed from ON to OFF

openab.log:

2022-11-19 01:56:22.720 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:3e2e5feb38:6C5AB042E8AB) sendAsncRequest to 'http://192.168.100.38/app?token=CE6BF66F772F632D2B0DA90C851C4C1C' with cookie 'TP_SESSIONID=36D971DA03EA28EB91FB0CFBD0FB16FB'
2022-11-19 01:56:22.724 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:3e2e5feb38:6C5AB042E8AB) DeviceConnetor_queryInfo from 'http://192.168.100.38/app?token=CE6BF66F772F632D2B0DA90C851C4C1C'
2022-11-19 01:56:22.732 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:3e2e5feb38:6C5AB042E8AB) sendAsncRequest to 'http://192.168.100.38/app?token=CE6BF66F772F632D2B0DA90C851C4C1C' with cookie 'TP_SESSIONID=36D971DA03EA28EB91FB0CFBD0FB16FB'
2022-11-19 01:56:22.811 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:P100:3e2e5feb38:6C5AB042E8AB) requestCompleted '{"error_code":0}'
2022-11-19 01:56:22.814 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:P100:3e2e5feb38:6C5AB042E8AB) received result: {"error_code":0}

So I think it’s my openhab local problem and TapoControl binding is OK

I think also. Looks everything good for me.

@Maintainers and community: Any chance we get support for tapo L630? Feature-set is afaik the same as for L530, only with different lamp socket (GU10 instead of E27), but it is not found / supported as of now.

Would gladly support in any required information gathering and testing.

Yes but device name is needed. If you have one, set log level to trace and try to connect

Forgive my ignorance, but where does the updated jar file go? Or do I need to upgrade my whole system?

Thanks a lot for the offer!
I was not sure how to connect so I tried to connect with the L530 item definition, and it resulted in a response in the trace.
If you need device_id please let me know, I was not sure if this should be treated as sensitive data or not.

2022-11-25 08: 51: 19.495 [TRACE
] [rol.internal.api.TapoDeviceConnector
] - (tapocontrol:L530:tapoBridge:test-lamp) received result: {
    "result": {
        "device_id": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
        "fw_ver": "1.0.3 Build 220703 Rel.125450",
        "hw_ver": "1.0",
        "type": "SMART.TAPOBULB",
        "model": "L630",
        "mac": "XX-XX-XX-XX-XX-XX",
        "hw_id": "0161987C98B25AD5BC3CD002C7EEE7D0",
        "fw_id": "7BECA9DC454565672FEC87D1104F9972",
        "oem_id": "9E6C0F34C742F1F710041E8DED16B223",
        "color_temp_range": [
            2200,
            6500
        ],
        "overheated": false,
        "ip": "192.168.XXX.XXX",
        "time_diff": 60,
        "ssid": "XXXXXXXXXX",
        "rssi": -62,
        "signal_level": 2,
        "latitude": XXXXXX,
        "longitude": XXXXXX,
        "lang": "en_US",
        "avatar": "bulb",
        "region": "Europe/Berlin",
        "specs": "",
        "nickname": "XXXXXXXXXXXXXXXX",
        "has_set_location_info": true,
        "device_on": true,
        "brightness": 40,
        "hue": 240,
        "saturation": 100,
        "color_temp": 2700,
        "dynamic_light_effect_enable": false,
        "default_states": {
            "type": "last_states",
            "state": {
                "brightness": 40,
                "hue": 240,
                "saturation": 100,
                "color_temp": 2700
            }
        }
    },
    "error_code": 0
}

@344clinton jar files for add ons go to the add on folder, have a look here

Thank you sir!

@holyibis
OK i integrated it for testing. You can try it downloading the .jar from here
Please give response here for creating a PR

L630 support:
Ok, first I thought the ThingHandlerFactory would not be found, but that was just my mistake by not correctly replacing the addon.

The first smoke test passed, but I found some issues that I want to further investigate over the weekend with some more testing:

  • Setting the color does not work most of the time, but sporadically also works (receiving color that is set via the Tapo App directly works reliably).
  • There are quite some DEBUG logs that read “command not sent becauso of min_gap: 1669406152705 ← 1669406152243”
  • The DeviceOnTime is stuck at 0 s

Thanks for the quick implementation!

Hi, need a trace log if color change is not working. OnTime seems not to be supported by this device.

Finally Got my L530 lights working except for colour selection. Is this a known issue or did I do something wrong?

No my L530 is working fine. Need trace log to investigate it.

Here is the TRACE of a requested, but unsuccesfull color change via colorpicker in sitemap. Unsuccesful here means that the observable state of the light does not change, and Color item is set to 10,100,6 regardless of input.

2022-11-26 22:06:05.951 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) encrypting payload '{"method":"set_device_info","params":{"saturation":100.0,"brightness":75.69832402234637,"device_on":true,"hue":10.000000074505806},"requestTimeMils":1669496765951}'
2022-11-26 22:06:05.956 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) sendAsncRequest to 'http://192.168.XXX.XXX/app?token=F96DA2C0D97F22DCCBEF2EDC5BE62EDA' with cookie 'TP_SESSIONID=6BEC1AF8585613C0624F9BC47BD29FC0'
2022-11-26 22:06:05.957 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) command/payload: 'set_device_info''{"method":"securePassthrough","params":{"request":"nh8aGxbVJezCA+CgwppOXaEnK1kpT1o+EukWtC1MSHQ71kv4+TpN8piiN7Jz6tHr9wAi29HhEwHShAmLi3o2+cOAO3BVJ+XdYLfbK27CKLbcDgv/xO6+2t57P/GyJLYNImlYuoLvdkVVoW7+NxKodx+8Migvp3zX2JX4Hk0WI/lkIj8e2S2MHYyDv40ngE+7GaZ0YuxhHhVyUBxj4tZstzLmTVx9cVjUOZHk0AnwmXI\u003d"},"requestTimeMils":1669496765956}'
2022-11-26 22:06:05.958 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) DeviceConnetor_queryInfo from 'http://192.168.XXX.XXX/app?token=F96DA2C0D97F22DCCBEF2EDC5BE62EDA'
2022-11-26 22:06:05.959 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) encrypting payload '{"method":"get_device_info","requestTimeMils":1669496765959}'
2022-11-26 22:06:05.960 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) sendAsncRequest to 'http://192.168.XXX.XXX/app?token=F96DA2C0D97F22DCCBEF2EDC5BE62EDA' with cookie 'TP_SESSIONID=6BEC1AF8585613C0624F9BC47BD29FC0'
2022-11-26 22:06:05.961 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) command/payload: 'get_device_info''{"method":"securePassthrough","params":{"request":"SMVGCt7/JRGXJUsEexXyZXIjVTz/+ZEmH4bkmCmj+2yiKM+DK/xET2jYqAPQ1Sfo161EF11Ijpe8q64yr5cnjQ\u003d\u003d"},"requestTimeMils":1669496765960}'
2022-11-26 22:06:06.071 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) receivedRespose '{"error_code":0,"result":{"response":"UV9WUWD0qhC7nJ2x4/wnBtq5CKssp3+mxuUDpR45hcc="}}'
2022-11-26 22:06:06.073 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) decryptedResponse '{"error_code":-1008}'
2022-11-26 22:06:06.074 [DEBUG] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) device answers with errorcode -1008 - received invalid parameter
2022-11-26 22:06:06.076 [DEBUG] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) set deviceInfo not succesfull: {"error_code":-1008}
2022-11-26 22:06:06.088 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) receivedRespose '{"error_code":0,"result":{"response":"XXXXXXXXXXXXXXXXXXXX"}}'
2022-11-26 22:06:06.089 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) decryptedResponse '{"result":{"device_id":"XXXXXXXXXXXXXXXXXXXX","fw_ver":"1.0.3 Build 220703 Rel.125450","hw_ver":"1.0","type":"SMART.TAPOBULB","model":"L630","mac":"34-60-F9-B2-9C-5E","hw_id":"0161987C98B25AD5BC3CD002C7EEE7D0","fw_id":"7BECA9DC454565672FEC87D1104F9972","oem_id":"9E6C0F34C742F1F710041E8DED16B223","color_temp_range":[2200,6500],"overheated":false,"ip":"192.168.XXX.XXX","time_diff":60,"ssid":"XXXXXX","rssi":-72,"signal_level":1,"latitude":XXXXXX,"longitude":XXXXXX,"lang":"en_US","avatar":"bulb","region":"Europe/Berlin","specs":"","nickname":"XXXXXX","has_set_location_info":true,"device_on":true,"brightness":6,"hue":10,"saturation":100,"color_temp":2700,"dynamic_light_effect_enable":false,"default_states":{"type":"last_states","state":{"brightness":6,"hue":10,"saturation":100,"color_temp":2700}}},"error_code":0}'
2022-11-26 22:06:06.090 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) received result: {"result":{"device_id":"XXXXXXXXXXXXXXXXXXXX","fw_ver":"1.0.3 Build 220703 Rel.125450","hw_ver":"1.0","type":"SMART.TAPOBULB","model":"L630","mac":"34-60-F9-B2-9C-5E","hw_id":"0161987C98B25AD5BC3CD002C7EEE7D0","fw_id":"7BECA9DC454565672FEC87D1104F9972","oem_id":"9E6C0F34C742F1F710041E8DED16B223","color_temp_range":[2200,6500],"overheated":false,"ip":"192.168.XXX.XXX","time_diff":60,"ssid":"XXXXXX","rssi":-72,"signal_level":1,"latitude":XXXXXX,"longitude":XXXXXX,"lang":"en_US","avatar":"bulb","region":"Europe/Berlin","specs":"","nickname":"XXXXXX","has_set_location_info":true,"device_on":true,"brightness":6,"hue":10,"saturation":100,"color_temp":2700,"dynamic_light_effect_enable":false,"default_states":{"type":"last_states","state":{"brightness":6,"hue":10,"saturation":100,"color_temp":2700}}},"error_code":0}
2022-11-26 22:06:06.283 [DEBUG] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) command not sent becauso of min_gap: 1669496766283 <- 1669496765951
2022-11-26 22:06:06.285 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) DeviceConnetor_queryInfo from 'http://192.168.XXX.XXX/app?token=F96DA2C0D97F22DCCBEF2EDC5BE62EDA'
2022-11-26 22:06:06.287 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) encrypting payload '{"method":"get_device_info","requestTimeMils":1669496766287}'
2022-11-26 22:06:06.288 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) sendAsncRequest to 'http://192.168.XXX.XXX/app?token=F96DA2C0D97F22DCCBEF2EDC5BE62EDA' with cookie 'TP_SESSIONID=6BEC1AF8585613C0624F9BC47BD29FC0'
2022-11-26 22:06:06.289 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) command/payload: 'get_device_info''{"method":"securePassthrough","params":{"request":"SMVGCt7/JRGXJUsEexXyZXIjVTz/+ZEmH4bkmCmj+2yiKM+DK/xET2jYqAPQ1SfoJ5mWvYn4+Acy6N7KYgB5Gw\u003d\u003d"},"requestTimeMils":1669496766288}'
2022-11-26 22:06:06.391 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) receivedRespose '{"error_code":0,"result":{"response":"XXXXXXXXXXXXXXXXXXXX"}}'
2022-11-26 22:06:06.392 [TRACE] [ntrol.internal.api.TapoDeviceHttpApi] - (tapocontrol:L630:tapoBridge:spot1) decryptedResponse '{"result":{"device_id":"XXXXXXXXXXXXXXXXXXXX","fw_ver":"1.0.3 Build 220703 Rel.125450","hw_ver":"1.0","type":"SMART.TAPOBULB","model":"L630","mac":"34-60-F9-B2-9C-5E","hw_id":"0161987C98B25AD5BC3CD002C7EEE7D0","fw_id":"7BECA9DC454565672FEC87D1104F9972","oem_id":"9E6C0F34C742F1F710041E8DED16B223","color_temp_range":[2200,6500],"overheated":false,"ip":"192.168.XXX.XXX","time_diff":60,"ssid":"XXXXXX","rssi":-72,"signal_level":1,"latitude":XXXXXX,"longitude":XXXXXX,"lang":"en_US","avatar":"bulb","region":"Europe/Berlin","specs":"","nickname":"XXXXXX","has_set_location_info":true,"device_on":true,"brightness":6,"hue":10,"saturation":100,"color_temp":2700,"dynamic_light_effect_enable":false,"default_states":{"type":"last_states","state":{"brightness":6,"hue":10,"saturation":100,"color_temp":2700}}},"error_code":0}'
2022-11-26 22:06:06.394 [TRACE] [rol.internal.api.TapoDeviceConnector] - (tapocontrol:L630:tapoBridge:spot1) received result: {"result":{"device_id":"XXXXXXXXXXXXXXXXXXXX","fw_ver":"1.0.3 Build 220703 Rel.125450","hw_ver":"1.0","type":"SMART.TAPOBULB","model":"L630","mac":"34-60-F9-B2-9C-5E","hw_id":"0161987C98B25AD5BC3CD002C7EEE7D0","fw_id":"7BECA9DC454565672FEC87D1104F9972","oem_id":"9E6C0F34C742F1F710041E8DED16B223","color_temp_range":[2200,6500],"overheated":false,"ip":"192.168.XXX.XXX","time_diff":60,"ssid":"XXXXXX","rssi":-72,"signal_level":1,"latitude":XXXXXX,"longitude":XXXXXX,"lang":"en_US","avatar":"bulb","region":"Europe/Berlin","specs":"","nickname":"XXXXXX","has_set_location_info":true,"device_on":true,"brightness":6,"hue":10,"saturation":100,"color_temp":2700,"dynamic_light_effect_enable":false,"default_states":{"type":"last_states","state":{"brightness":6,"hue":10,"saturation":100,"color_temp":2700}}},"error_code":0}

There is an error code -1008 and a “command not sent becauso of min_gap” in it, so hopefully that helps in debugging. Please let me know if you require a specific test scenario.

Overall status:

  • Output - works as expected
  • Brightness - works as expected
  • Color - see above
  • Color temperature - can be read but not set (is this the intended behaviour?)
  • WIFi Signal - 1, seems plausible, but I don’t have a reference
  • OnTime - not working or not supported, constantly 0
  • Overheated - OFF, seems plausible, but I don’t know how to test this other than to manipulate the (REST?) response. I don’t want to actually overheat my device.

@holyibis

device answers with errorcode -1008 - received invalid parameter

This is the real error. I belive the number sent to the device are too long.
Uploaded a new fix for that. Please test it.

Overheated is ReadOnly. ColorTemp should be able to set for white bulbs only

@344clinton
same for you. please test new .jar and write result down here