Rule turn on/off color bulb Yeelight with double switch aqara wirelss doesn't work

Hi,
I have a double Aqara Wireless Double Switch that I set up in a rule for turning on/off one Yeelight color bulb but it doesn’t work. The bulb was added with Xiaomi mi IO binding and I did it by file. Bulb has token and is working some items but I watched that it doen’t refresh the state of this items. Thank you very much for your help!:slight_smile:

Hardware: Raspberry PI 3B
OS: openHABian v1.4.1
Java Runtime Environment: openjdk version “1.8.0_152”
OpenJDK Runtime Environment (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 1.8 .0_152-b76)
OpenJDK Client VM (Zulu Embedded 8.25.0.76-linux-aarch32hf) (build 25.152-b76, m ixed mode, Evaluation)
openHAB version: openHAB 2

Rule turn on/off color bulb Yeelight with double switch aqara wirelss doesn't work

* Things configuration related to the issue

Thing miio:basic:color1 "Lámapara mesita noche Naty dormitorio" @ "Yeelight" [ host="192.168.1.15", token="XXXXXXXXXXXXXXXXXXXXXXXXX", deviceId="0XXXXXX" ]

* Items configuration related to the issue

// Lámpara mesita noche
Switch LMaparaMesitaNocheNatyDormitorio_Power "Está[MAP(luces.map):%s]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:power"}
Dimmer LMaparaMesitaNocheNatyDormitorio_Brightness "Brillo" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:brightness"}
String LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer "Temporizador apagado[:%.0f]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:delayoff"}
Dimmer LMaparaMesitaNocheNatyDormitorio_ColorTemperature "Color Temperatura[%d %%]" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:colorTemperature"}
Dimmer LMaparaMesitaNocheNatyDormitorio_ColorMode "Modo de color" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:colorMode"}
Switch LMaparaMesitaNocheNatyDormitorio_Toggle "Conmutador" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:toggle"}
Color LMaparaMesitaNocheNatyDormitorio_RGBColor "Color RGB" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:rgbColor"}
String LMaparaMesitaNocheNatyDormitorio_Name "Lámpara mesita noche Naty" (Home, FF_PrimeraPlanta, FF_Dormitorio, FF_LucesDormitorio) {channel="miio:basic:color1:name"}

* Sitemap configuration related to the issue

Frame label="Lámpara"
                Default item=LMaparaMesitaNocheNatyDormitorio_Power
                Setpoint item=LMaparaMesitaNocheNatyDormitorio_Brightness label="" icon="light" minValue=1 maxValue=100 step=1
                Selection item=LMaparaMesitaNocheNatyDormitorio_Brightness label="" icon="light" mappings=[1="1",5="5",10="10",30="30",50="50",80="80",100="100"]
                Slider item=LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer
                Default item=LMaparaMesitaNocheNatyDormitorio_ColorTemperature
                Default item=LMaparaMesitaNocheNatyDormitorio_ColorMode
                Default item=LMaparaMesitaNocheNatyDormitorio_Toggle
                Default item=LMaparaMesitaNocheNatyDormitorio_RGBColor
                Default item=LMaparaMesitaNocheNatyDormitorio_Name
 
* Rules code related to the issue

rule "Pulsador entrada dormitorio apagar luz lámpara Naty"
when
    Channel "mihome:86sw2:158d0001712ea0:ch2" triggered SHORT_PRESSED
then
        if(LMaparaMesitaNocheNatyDormitorio_Power.state == ON) {
        sendCommand(LMaparaMesitaNocheNatyDormitorio_Power, "OFF")
        }
        if(LMaparaMesitaNocheNatyDormitorio_Power.state == ON) {
        sendCommand(LMaparaMesitaNocheNatyDormitorio_Power, "OFF")
        }
end

* If logs where generated please post these here using code fences:

2019-03-05 18:10:30.576 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:11:43.363 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command ON

2019-03-05 18:11:43.380 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Power predicted to become ON

2019-03-05 18:11:43.426 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from OFF to ON

2019-03-05 18:11:43.936 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:11:53.547 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 50

2019-03-05 18:11:53.573 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness predicted to become 50

2019-03-05 18:11:53.595 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 100 to 50

2019-03-05 18:11:53.609 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:06.801 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 43

2019-03-05 18:12:06.813 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness predicted to become 43

2019-03-05 18:12:06.830 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 50 to 43

2019-03-05 18:12:06.869 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:06.990 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:19.789 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 5

2019-03-05 18:12:19.798 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness predicted to become 5

2019-03-05 18:12:19.813 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 43 to 5

2019-03-05 18:12:19.856 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:33.345 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:33.507 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 50

2019-03-05 18:12:33.525 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness predicted to become 50

2019-03-05 18:12:33.528 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 5 to 50

2019-03-05 18:12:33.740 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:46.438 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command OFF

2019-03-05 18:12:46.447 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Power predicted to become OFF

2019-03-05 18:12:46.463 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from ON to OFF

2019-03-05 18:12:46.705 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:46.715 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:12:59.744 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:13:13.034 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command ON

2019-03-05 18:13:13.039 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_Power predicted to become ON

2019-03-05 18:13:13.050 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from OFF to ON

2019-03-05 18:13:13.078 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:13:13.204 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:13:49.325 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:14:02.759 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from ON to OFF

2019-03-05 18:14:09.728 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:14:42.398 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format '%.0f': f != java.lang.String

2019-03-05 18:16:41.500 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:16:56.078 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:18:48.395 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:18:49.978 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:18:53.811 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer' received command 50

2019-03-05 18:18:53.825 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer predicted to become 50

2019-03-05 18:18:53.831 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '50' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:18:53.824 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:18:53.841 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer changed from 0 to 50

2019-03-05 18:18:53.905 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer changed from 50 to 0

2019-03-05 18:18:53.954 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:18:54.041 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:19:16.323 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer' received command 0

2019-03-05 18:19:16.332 [nt.ItemStatePredictedEvent] - LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer predicted to become 0

2019-03-05 18:19:24.615 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:37:38.778 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:38:09.304 [WARN ] [ui.internal.items.ItemUIRegistryImpl] - Exception while formatting value '0' of item LMaparaMesitaNocheNatyDormitorio_ShutdowmTimer with format ':%.0f': f != java.lang.String

2019-03-05 18:44:11.155 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command ON

2019-03-05 18:44:11.173 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from OFF to ON

2019-03-05 18:44:13.210 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command OFF

2019-03-05 18:44:13.225 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from ON to OFF

2019-03-05 18:44:14.770 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command ON

2019-03-05 18:44:14.782 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from OFF to ON

2019-03-05 18:44:17.729 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 86

2019-03-05 18:44:17.739 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 50 to 86

2019-03-05 18:44:18.183 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 86

2019-03-05 18:44:21.841 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 0

2019-03-05 18:44:21.855 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 86 to 0

2019-03-05 18:44:30.820 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 54

2019-03-05 18:44:30.838 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 0 to 54

2019-03-05 18:44:31.879 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 52

2019-03-05 18:44:31.896 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 54 to 52

2019-03-05 18:44:32.246 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 52

2019-03-05 18:44:32.816 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 51

2019-03-05 18:44:32.839 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 52 to 51

2019-03-05 18:44:33.272 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 51

2019-03-05 18:44:34.465 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 49

2019-03-05 18:44:34.477 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 51 to 49

2019-03-05 18:44:34.887 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 49

2019-03-05 18:44:35.576 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 50

2019-03-05 18:44:35.589 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 49 to 50

2019-03-05 18:44:36.517 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Brightness' received command 51

2019-03-05 18:44:36.529 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Brightness changed from 50 to 51

2019-03-05 18:45:08.011 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command OFF

2019-03-05 18:45:08.032 [vent.ItemStateChangedEvent] - LMaparaMesitaNocheNatyDormitorio_Power changed from ON to OFF

2019-03-05 18:45:08.044 [ome.event.ItemCommandEvent] - Item 'LMaparaMesitaNocheNatyDormitorio_Power' received command OFF

I have to rectify my doubt because finally I found the mistake. It was here:

Channel "mihome:86sw2:158d0001712ea0:ch2" triggered SHORT_PRESSED
then
        if(LMaparaMesitaNocheNatyDormitorio_Power.state == ON) {
        sendCommand(LMaparaMesitaNocheNatyDormitorio_Power, "OFF")
        }
        if(LMaparaMesitaNocheNatyDormitorio_Power.state == ON) {
        sendCommand(LMaparaMesitaNocheNatyDormitorio_Power, "OFF")
        }
end

Both were the same state === ON/ state === OFF. Now it’s working the rule.
I was very tired and I didn’t realized that I wrote the same :sweat_smile:
But I’m having problems with some items of the Yeelight bulb and the sitemap. If someone knows how to solve I would be very glad. Thank you very much for your attention :grin: