When setting switch to ON it goes ON -> OFF -> ON

Setup: Openhab2 on RPi with tellstick connected.

Example:
My microwave is OFF
I press ON in which ever UI
In the Openhab log the item goes from
OFF -> ON
On -> OFF
OFF -> ON

Why does i not go straight to ON?

I always get the item state to what I want but it creates a flickering thing in all User Interfaces and it creates problems when involving rules because they may want to execute more than one time.
Is this a common problem and what is causing it?

Log from example:
2018-08-18 23:17:40.215 [ome.event.ItemCommandEvent] - Item ‘Light_Kok_Micro’ received command OFF
2018-08-18 23:17:40.249 [vent.ItemStateChangedEvent] - Light_Kok_Micro changed from ON to OFF
2018-08-18 23:17:40.254 [vent.ItemStateChangedEvent] - Light_Kok_Micro changed from OFF to ON
2018-08-18 23:17:40.792 [vent.ItemStateChangedEvent] - Light_Kok_Micro changed from ON to OFF

Can you post your items/rules, in the log above, line 4 and 5 have the group and item state changing back to off, then on again. Hard to say why without seeing how everything is set up.

I don’t have any particular rule for this item. But it seems in general, whatever device i turn ON/OFF, I can see this in the log. I also have IKEAs smart lights but they are not behaving like this. Difference is i only have them in the Paper UI and not in the items file. Can that have anything to do with it?

Items file:

Group All
Group Vardagsrum (All)
Group Sovrum (All)
Group Kok (All)
Group Special

/* active groups */
Group:Switch:OR(ON, OFF) Lights “Allt [(%d)]” (All)
Group:Switch:OR(ON, OFF) VR “Alla [(%d)]” (All)
Group:Switch:OR(ON, OFF) SR “Alla [(%d)]” (All)
Group:Switch:OR(ON, OFF) K “Alla [(%d)]” (All)
Group:Switch:OR(ON, OFF) S “Alla [(%d)]” (All)
Group:Switch:OR(ON, OFF) Left “Hemma/Borta”
Group:Switch:OR(ON, OFF) Right “Zzz/Schema”
Group:Switch:OR(ON, OFF) Gardiner “Oppna/Stang”
Group:Switch:OR(ON, OFF) Alarm “Virtuell Alarm”
Group:Switch:OR(ON, OFF) Morgon “Morning” [“Lighting”]
Group:Dimmer Brightness “Brightness”
Group:Dimmer Temp “Temp”

Switch Light_Vardagsrum_Sang “Bed” (Vardagsrum, Lights, VR) [“Lighting”] {channel=“tellstick:switch:1:4:state”}
Dimmer Light_Vardagsrum_Damen “Lady [%d %%]” (Vardagsrum, Lights, VR, Brightness) [“Lighting”] {channel=“tellstick:dimmer:1:21:dimmer”}

Switch Light_Kok_Kaffe “Coffee” (Kok, Morgon, K) [“Lighting”] {channel=“tellstick:switch:1:7:state”}
Switch Light_Kok_Micro “Microwave” (Kok, Morgon, K) [“Lighting”] {channel=“tellstick:switch:1:13:state”}

Switch Light_Vardagsrum_Skivspelare “Stereo” (Special, S) [“Lighting”] {channel=“tellstick:switch:1:8:state”}
Switch Light_Vardagsrum_Flakt “Air Conditioning” (Special, S) [“Switchable”] {channel=“tellstick:switch:1:6:state”}
Switch Light_Vardagsrum_Flakt2 “Candle” (Special, S) [“Switchable”] {channel=“tellstick:switch:1:6:state”}
Switch Light_Vardagsrum_TV “Philip” (Special, Morgon, S) [“Switchable”] {channel=“tellstick:switch:1:16:state”}
Switch Light_Vardagsrum_Gardiner “Curtains” (Morgon, Gardiner) [“Switchable”] {channel=“tellstick:switch:1:11:state”}
Switch Wallswitch_Hall_Left “Vanster” (Left) {channel=“tellstick:switch:1:14:state”}
Switch Wallswitch_Hall_Right “Hoger” (Right) {channel=“tellstick:switch:1:15:state”}

In PaperUI do you have auto detect item set to on? I ran into a similar issue in the past with duplicate items. Had to remove the item in PaperUI (only the ones I had config iin the items file) then:

sudo service openhab2 stop && sudo rm -rf /var/lib/openhab2/cache/* && sudo rm -rf /var/lib/openhab2/tmp/* && sudo reboot

to clean the cache and temp files. *All on the same line, even the grayed out part.

That may help with duplicate entries in logs but I’m not sure why the ON, OFF, ON is occurring. Clean the files with the line above and see what changes. Sometime openhab does weird things and a clean up usually fixes it.

Yes I have auto detect. I’ll play around with that. Thanks for the tip!

I did what you suggested but no change. I tried doing everything in Paper UI but it still behaves like this. I also tried removing the Thing but kept the Item in the Items file. Then it looks good in the log but obviously no signals are passed through to the Tellstick. In Openhab 1 I guess it would’ve worked though because then we only had Items…

Just wondering if you’ve been able to solve this as I have the same issue with a wemo switch

2019-06-20 21:04:03.886 [vent.ItemStateChangedEvent] - switch_laundry1 changed from OFF to ON
2019-06-20 21:04:04.321 [vent.ItemStateChangedEvent] - switch_laundry1 changed from ON to OFF
2019-06-20 21:04:04.331 [vent.ItemStateChangedEvent] - switch_laundry1 changed from OFF to ON

When you send a command;
Autoupdate guesses what the effect will be and issues an update.
Also
Bindings transmit the command to a device.
The device may respond with its status now (before actioning command)
The device may send another update later with a new status.

If your devices respond promptly, you may remove the nuisance factor by disabling autoupdate for this item.