Rules are sometimes not completely executed (christmas lights)

our christmas lights have various lights via mqtt and mystrom switch.
Sometimes not all lights are switched on. i have no idea what could be the reason :frowning:


rule "cmdChristmas Global ChristmasLightsOutdoorOn"
    Item cmdChristmas received update "ChristmasLightsOutdoorOn"
    if(ChristmasMode.state == ON)
        // State Christmas Lights
        sendCommand(StateChristmasLights, ON)

        // Christbaum Outdoor, Sternen, Terasse
        if(MyStrom05_Switch.state != ON) sendCommand(MyStrom05_Switch, ON)

        // Gartenhaus
        if(OdGh_SteckdoseAussen.state != ON) sendCommand(OdGh_SteckdoseAussen, ON)

        // Buxus Haustuer
        if(OdGh_SteckdoseHauswand.state != ON) sendCommand(OdGh_SteckdoseHauswand, ON)

        // Christbaum Zimmer Samuel
        if(MyStrom06_Switch.state != ON) sendCommand(MyStrom06_Switch, ON)

        // Stern Zimmer Noah
        if(MyStrom03_Switch.state != ON) sendCommand(MyStrom03_Switch, ON)

        // Stern Entree
        if(MyStrom07_Switch.state != ON) sendCommand(MyStrom07_Switch, ON)

        // Stern Büro
        if(MyStrom08_Switch.state != ON) sendCommand(MyStrom08_Switch, ON)

        // Stern Sofa
        if(MyStrom10_Switch.state != ON) sendCommand(MyStrom10_Switch, ON)

        sendNotification("", "Christmas Outdoor On (" + new DateTimeType().format("%1$tH:%1$tM %1$tA") + ")")  
        logInfo("rules","Christmas Lights Outdoor On")


Switch StateChristmasLights

Switch OdGh_SteckdoseAussen "Steckdose Gartenhaus Aussen" <switch>
    mqtt="  >[mosquitto:Haus/OD/Gartenhaus/cmnd/Sonoff4Ch/POWER3:command:ON:ON],

Switch OdGh_SteckdoseHauswand "Steckdose Hauswand" <switch>
    mqtt="  >[mosquitto:Haus/OD/Gartenhaus/cmnd/Sonoff4Ch/POWER4:command:ON:ON],

Switch MyStrom03_Switch  "ZMystrom 03: Switch"             <switch>	{mystromecopower="03-Mystrom"}
Switch MyStrom05_Switch  "ZMystrom 05: Switch"             <switch>	{mystromecopower="05-Mystrom"}
Switch MyStrom06_Switch  "ZMystrom 06: Switch"             <switch>	{mystromecopower="06-Mystrom"}
Switch MyStrom07_Switch  "ZMystrom 07: Switch"             <switch>	{mystromecopower="07-Mystrom"}
Switch MyStrom08_Switch  "ZMystrom 08: Switch"             <switch>	{mystromecopower="08-Mystrom"}
Switch MyStrom10_Switch  "ZMystrom 10: Switch"             <switch>	{mystromecopower="10-Mystrom"}

Sometimes the MyStrom05_Switch doesn’t turn on, sometimes the OdGh_SteckdoseAussen doesn’t turn on. the other items works normally fine.

i have also 12 blinds controlled via z-wave. with these it can happen that simply one blind does not close. but normally everything works correctly.

in another article i read that logging to myspql has caused a problem. can that be? i have logged various temperature sensors to mysql via persist function.

MySQL has been reported to cause a few issues that go away when another arrive is used.
However, in your case you may simply asked to many commands in too short of a time. I have been running into similar issues with other bindings. Try to add a few ‘’’ thread::sleep(50)’’’ statements in between the send commands (say every four or five statements ) and see if that makes it more reliable. The number in parenthesis is the time your rule will pause in milliseconds. But be careful to not make your rule taking too long in the end. See here as for the why

On another note, you should be using the other syntax for commands:
You are currently using:

sendCommand(StateChristmasLights, ON)

Change the syntax to:


It is more efficient.