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

Okay i found something. Could be if the device retrieves an emtpy response. Maybe a timing problem. I’ll try to fix it soon. :wink:
In most cases it should be enough to save the thing settings. it’ll be reinitialized then.

1 Like

Did not try to save. But recovery from this situation should be automatic. Yesterday I had the same problem on another P100, probably caused by a micro interruption (just guessing).

The problem can be recreated easily by replugging the P100. I’ve done it twice before posting.

Sometimes there are no errors in logs but the P100 is not actuated

2021-04-04 00:28:28.797 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GF_LivingDining_Power' changed from OFF to ON
2021-04-04 00:40:10.279 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command ON
2021-04-04 00:40:10.280 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become ON
2021-04-04 00:40:15.632 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command ON
2021-04-04 00:40:15.633 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become ON
2021-04-04 00:41:22.154 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command OFF
2021-04-04 00:41:22.155 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become OFF
2021-04-04 00:41:22.156 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GF_LivingDining_Power' changed from ON to OFF
2021-04-04 00:41:28.338 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command OFF
2021-04-04 00:41:28.339 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become OFF
2021-04-04 00:41:36.835 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command OFF
2021-04-04 00:41:36.836 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become OFF
2021-04-04 00:42:57.826 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command OFF
2021-04-04 00:42:57.827 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become OFF
2021-04-04 00:45:42.028 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:e9a001ba67' changed from ONLINE to UNKNOWN
2021-04-04 00:45:42.917 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:e9a001ba67' changed from UNKNOWN to ONLINE
2021-04-04 00:45:52.572 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command ON
2021-04-04 00:45:52.573 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become ON
2021-04-04 00:45:52.575 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GF_LivingDining_Power' changed from OFF to ON
2021-04-04 00:45:56.663 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command OFF
2021-04-04 00:45:56.664 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become OFF
2021-04-04 00:45:56.666 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GF_LivingDining_Power' changed from ON to OFF
2021-04-04 00:46:00.342 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command ON
2021-04-04 00:46:00.343 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become ON
2021-04-04 00:46:00.345 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GF_LivingDining_Power' changed from OFF to ON
2021-04-04 00:46:03.230 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'GF_LivingDining_Power' received command OFF
2021-04-04 00:46:03.232 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'GF_LivingDining_Power' predicted to become OFF
2021-04-04 00:46:03.234 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'GF_LivingDining_Power' changed from ON to OFF

In above case it was Ok @ 2021-04-04 00:28:28.797 but minutes later, when I’ve tried to activate it I had no success. Then I’ve saved the thing @ 2021-04-04 00:45:42.028 and this fixed the issue.

The only sign in logs that something was not ok was the absence of the ItemStateChangedEvent after a ItemCommandEvent.

@Bigdesaster I observe communication errors in all my wifi devices every now and then. All bindings except TAPO recover from them automatically.

I’ve been away from home but will be back today. Do you need more info ?

I think I know the problem. But I’ve little time this week. Just give me view days.

No problem. All my 4 P100’s are in non critical places, I’ve bought them initially to help fix binding problems, after this they will go into production.

Hi, just uploaded a new jar. Thing should now just reconnect at the next polling interval after communication errors

1 Like

@Bigdesaster I’ve noticed that time to react is randomly slow with Tapo plugs. More specifically, I’ve linked a zigbee button with a zigbee lamp and a tapo plug (controlling another lamp in the same room) so that I can compare reaction times. Tapo plug reacts 1-5 seconds later. I see no delay in OH logs.

2021-05-15 14:26:30.320 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'IluminacaoSala_OutputSwitch' received command OFF
2021-05-15 14:26:30.321 [INFO ] [openhab.event.ItemCommandEvent      ] - Item 'LuzSala_Power' received command OFF
2021-05-15 14:26:30.326 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'IluminacaoSala_OutputSwitch' predicted to become OFF
2021-05-15 14:26:30.329 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'LuzSala_Power' predicted to become OFF
2021-05-15 14:26:30.331 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'InterruptorCandeeirosSala_LinkQuality' changed from 21 to 5
2021-05-15 14:26:30.333 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'IluminacaoSala_OutputSwitch' changed from ON to OFF
2021-05-15 14:26:30.334 [INFO ] [hab.event.GroupItemStateChangedEvent] - Item 'gPower' changed from UNDEF to OFF through LuzSala_Power
2021-05-15 14:26:30.334 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'LuzSala_Power' changed from ON to OFF

Edit: made some more tests, when I command the Tapo plug with the Tapo app the action is almost instataneous, but using your binding sometimes there is a considerable delay.

Edit2: When I start OH3.1.M4 all seems ok. After some days CPU utilization, normally at 3%, jumps to 60% and Tapo binding shows delays in action (other bindings react ok). If I restart OH (without rebooting) all returns to normal. The only thing strange are these messages in the closing log.

2021-05-21 08:53:16.702 [INFO ] [ab.ui.habpanel.internal.HABPanelTile] - Stopped HABPanel
2021-05-21 08:53:16.865 [INFO ] [basic.internal.servlet.WebAppServlet] - Stopped Basic UI
2021-05-21 08:53:23.896 [INFO ] [org.openhab.ui.internal.UIService   ] - Stopped UI
2021-05-21 08:53:41.079 [WARN ] [org.eclipse.jetty.io.ManagedSelector] - java.nio.channels.ClosedSelectorException
2021-05-21 08:53:41.082 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:a8f19d213a tried updating channel actuator#output although the handler was already disposed.
2021-05-21 08:53:41.083 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:a8f19d213a tried updating channel device#wifiSignal although the handler was already disposed.
2021-05-21 08:53:41.083 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:a8f19d213a tried updating channel device#onTime although the handler was already disposed.
2021-05-21 08:53:41.084 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:a8f19d213a tried updating channel device#overheated although the handler was already disposed.

Edit3: Looks like TAPO binding becomes very slow to react after these errors

2021-05-25 23:06:06.432 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - Problem with writing the data, class org.openhab.core.io.rest.Stream2JSONInputStream, ContentType: application/json
2021-05-25 23:06:06.453 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.
java.io.IOException: Close SendCallback@453f8f9e[PROCESSING][i=null,cb=org.eclipse.jetty.server.HttpChannel$SendCallback@4bf87949] in state PROCESSING
	at org.eclipse.jetty.util.IteratingCallback.close(IteratingCallback.java:428) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.HttpConnection.onClose(HttpConnection.java:513) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.ssl.SslConnection.onClose(SslConnection.java:363) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.SelectorManager.connectionClosed(SelectorManager.java:345) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint.run(ManagedSelector.java:1104) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [bundleFile:9.4.38.v20210224]
	at java.lang.Thread.run(Thread.java:834) [?:?]
2021-05-25 23:08:57.681 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - Problem with writing the data, class org.openhab.core.io.rest.Stream2JSONInputStream, ContentType: application/json
2021-05-25 23:08:57.683 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.
java.io.IOException: Close SendCallback@283bb898[PROCESSING][i=null,cb=org.eclipse.jetty.server.HttpChannel$SendCallback@459675ac] in state PROCESSING
	at org.eclipse.jetty.util.IteratingCallback.close(IteratingCallback.java:428) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.server.HttpConnection.onClose(HttpConnection.java:513) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.ssl.SslConnection.onClose(SslConnection.java:363) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.SelectorManager.connectionClosed(SelectorManager.java:345) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint.run(ManagedSelector.java:1104) ~[bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [bundleFile:9.4.38.v20210224]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [bundleFile:9.4.38.v20210224]
	at java.lang.Thread.run(Thread.java:834) [?:?]

@Bigdesaster could it be that these errors are produced by your binding ?

It is a fact that after some time (and after few on/off cycles) the P100 plug reacts with considerable delay. Sometimes I have this in the log when this happens:

2021-06-13 17:09:21.630 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:723cf88a39 tried updating channel actuator#output although the handler was already disposed.
2021-06-13 17:09:21.634 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:723cf88a39 tried updating channel device#wifiSignal although the handler was already disposed.
2021-06-13 17:09:21.635 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:723cf88a39 tried updating channel device#onTime although the handler was already disposed.
2021-06-13 17:09:21.636 [WARN ] [.core.thing.binding.BaseThingHandler] - Handler TapoSmartPlug of thing tapocontrol:P100:723cf88a39 tried updating channel device#overheated although the handler was already disposed.
2021-06-13 17:09:59.868 [ERROR] [rg.apache.cxf.jaxrs.utils.JAXRSUtils] - Problem with writing the data, class org.openhab.core.io.rest.Stream2JSONInputStream, ContentType: application/json
2021-06-13 17:09:59.890 [ERROR] [internal.JSONResponseExceptionMapper] - Unexpected exception occurred while processing REST request.
java.io.IOException: Close SendCallback@1e303062[PROCESSING][i=null,cb=org.eclipse.jetty.server.HttpChannel$SendCallback@1ac03c2a] in state PROCESSING
	at org.eclipse.jetty.util.IteratingCallback.close(IteratingCallback.java:428) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.server.HttpConnection.onClose(HttpConnection.java:519) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.io.ssl.SslConnection.onClose(SslConnection.java:363) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.io.SelectorManager.connectionClosed(SelectorManager.java:345) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.io.ManagedSelector$DestroyEndPoint.run(ManagedSelector.java:1104) ~[bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:882) [bundleFile:9.4.40.v20210413]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1036) [bundleFile:9.4.40.v20210413]
	at java.lang.Thread.run(Thread.java:834) [?:?]

Disabling / enabling the thing solves the problem, but this is only a temporary solution.

My IoT lan has no internet access. When I need to register a new Tapo device I have to enable internet access but I disable it afterwards. The thing disable / enable sequence does not need internet access.

My experience with this binding is worsening. I have one P100 device that has been working for several weeks but it’s no longer recognized. Nothing helps (disable/enable or delete/create the thing, restart OH). These are the messages in the log

2021-06-20 21:42:41.830 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:3cbbb05b88' changed from UNINITIALIZED to INITIALIZING
2021-06-20 21:42:41.840 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:3cbbb05b88' changed from INITIALIZING to UNKNOWN
2021-06-20 21:42:42.485 [INFO ] [ab.event.ThingStatusInfoChangedEvent] - Thing 'tapocontrol:P100:3cbbb05b88' changed from UNKNOWN to OFFLINE (CONFIGURATION_ERROR): wrong device found: ''

The Tapo App manages the device without any problem.

Edit: So I’ve removed the device from Tapo App but not from OH. Added it in Tapo App and the thing enabled automatically in OH.

Hi,

this binding will be included in new release of openHab or it can be only installed manually?

Bye Mirko

Hello Hugo,
could it be that the IP of the device changes? So another device (not Tapo) now uses the ip the device was configured?

Hi Chris, I have IP reservation active in my router so I do not think that the IP can change.

I’ve seen that you have a new 3.2.0-snapshot jar. As I’m using OH 3.2.0.M1 I’ve installed that jar. Anything new on it ?

No. Just updated to new snapshot version

Just grabbed your OH3.2 jar, installs without any problem.
1 remark: in the settings the password field is not masked. Is that on purpose or can you make it a password field? Thanks.

Hello.
I have downloaded the jar but it is not showing in the ui bindings list. These are the addons that I have:

pi@pi4:/usr/share/openhab/addons $ ls -lh
total 234M
-rw-r--r-- 1 openhab openhab 233M Sep  8 06:41 openhab-addons-3.2.0-SNAPSHOT.kar
-rw-r--r-- 1 root    root    130K Sep  8 13:53 org.openhab.binding.tapocontrol-3.2.0-SNAPSHOT.jar
-rw-r--r-- 1 root    root     67K Jan  1  2021 org.openhab.binding.wizlighting-3.0.0-SNAPSHOT.jar
-rw-r--r-- 1 openhab openhab   70 Sep  8 06:41 README

It is odd because the wizlighting binding appears with no problem:

Can you please help? I really would like to see my bulbs working with Openhab.

Thanks

Pedro

When you add a new thing it will appear and, before adding a thing, you should fill your Tapo credentials.

Hello Hugo. Thank you for your answer.
The sequence of actions is not clear for me. This is what I am doing:

2021-09-08_15h02_49

then: