Openhab switch/dimmer switching back to ON by itself after switching OFF

Opehab2 Server on RPi3

I have a TPLink Smart Bulb which I believed was setup/configured correctly. I managed to integrate it to Openhab having this in sitemap and items file.

Group hall_way	(Room)
Switch hallway "Hallway Light [MAP(tplinkbulb.map):%s]" <lightbulb> {channel="tplinksmarthome:lb120:13FB31:brightness"} 
Dimmer brightness "Brightness [%d %%]" <brightness> {channel="tplinksmarthome:lb120:13FB31:brightness"}
Dimmer color_temp "Color Temperature" (colorTemp) {channel="tplinksmarthome:lb120:13FB31:colorTemperature"}
Number signal_rssi "Signal" (signal) {channel="tplinksmarthome:lb120:13FB31:rssi"}
Group item=hall_way label="Hallway" icon="room"			
		{
			Switch item=hallway label="Hallway Light" icon="lightbulb"
			Slider item=brightness label="Brightness" icon="lightbulb"
			Slider item=color_temp label="Color Temperature" icon="colorwheel"
			Text   item=signal_rssi label="Signal" icon="signal"

Even when the light is OFF it still shows the switch/dimmer item is ON. But when I checked it on Kasa(TPlink) app the switch status is OFF which is correct.

I tried dynamic icons, .map tranformations even rules but I couldn’t get it to stay OFF(switch status).

Thanks in advance for any help.

you need to give more details, like:
Which TP Link product are you using?
Which version of Java?
Which version of openHAB? (2.1, 2.2, 2.3)
Which version of the the org.openhab.binding.tplinksmarthome ?
How did you install the binding? (via PaperUI or manually)
How did you configure your TP Link Things? (via PaperUI or manually)
Any relevant logs?
Does the item state update while the sitemap does not or the item state does not get updated?
Do you have any rules that may modify the item state?
Can you control the TPLink Smart Bulb from openHAB?

Is it only in the UI, or is the bulb itself still ON?
If it’s only the UI - there’s some bug with autorefresh, try F5/reload of the UI - it should read the exact state now?

you need to give more details, like:
Which TP Link product are you using? - TP-Link LB120 Smart Wi-Fi LED Bulb with Tunable White Light
Which version of Java? - Java version 1.8.0_161
Which version of openHAB? (2.1, 2.2, 2.3) - openhab 2.2
Which version of the the org.openhab.binding.tplinksmarthome ? - tplinksmarthome:lb120
How did you install the binding? (via PaperUI or manually) - via PAPERUI
How did you configure your TP Link Things? (via PaperUI or manually) - via PAPERUI
Any relevant logs?

2018-02-20 17:02:12.136 [ome.event.ItemCommandEvent] - Item 'hallway' received command OFF
2018-02-20 17:02:12.141 [vent.ItemStateChangedEvent] - hallway changed from ON to OFF

Does the item state update while the sitemap does not or the item state does not get updated?
The switch/dimmer UI interface work, it updated the state. The problem is when I turn the light OFF using the UI the light turned OFF, the UI status switch to OFF but after a couple of seconds the UI switch itself back to ON but the light is actually still OFF.

Do you have any rules that may modify the item state? - No rules
Can you control the TPLink Smart Bulb from openHAB? - YES!

The problem is that when you switch the UI to OFF the bulb will turn off then after couple of seconds the switch UI will switch itself back to ON but the light bulb is actually OFF (no light).

hmmm… looks like something may be wrong with the UI refresh… did you try to refresh the page to see if it stays off?
(I assume that we are talking about BasicUI here…correct?)

by the way: when the switch on the BasicUI sitemap goes back to ON by itself: is there any log of the item state being updated from OFF to ON?

BASICUI Yes.
Yes the light stays OFF, after refreshing the page light stays OFF but the switch UI turn itself to ON.

Yes there’s a log of the item state being updated.

2018-02-20 22:41:57.338 [ome.event.ItemCommandEvent] - Item 'hallway' received command OFF
2018-02-20 22:41:57.357 [vent.ItemStateChangedEvent] - hallway changed from ON to OFF
2018-02-20 22:42:27.326 [vent.ItemStateChangedEvent] - hallway changed from OFF to ON

so, it’s not a UI issue since the UI correctly displays the updated Item state.
You need to dig deeper into the logs to see why 30 seconds after the OFF state, the Item changes back to ON.

Try to enable trace level on the binding to see if more details come up.

I’m sure, this is some rule or even some manual activity. Either in openHAB or in the KASA App. So, activating TRACE for the binding could be the way to solve the problem

@Home_Agecra are the posted items and sitemap the only thing you have?
Did you try to remove all things, items, sitemap, and rules? only set up this one switch and one rule? To see if i is not burried in one of them?

This looks like the problem

Recent fix to binding

1 Like

Issue is solved. I uninstalled TPLINK Binding then install the eclipse iot market binding. I did not even remove the discovered bulb in THINGs, it showed the right switch status now.

The state problem with bulbs should be fixed in the 2.3.0 release.

1 Like

Great work @hilbrand!