433mhz outlets, too many commands at once (RPi_utils)

Hi all.

I have my OpenHAB setup to control many 433mhz outlets around the house, I like these because they are easy to make any low power appliance controllable and smart.

I have set up scenes, 2 of which are ‘TV’ and ‘OFF’. TV turns on a strings of LEDs in the fireplace (and also is used by other rules to sense if we are home (TV scene = ON = people home)), OFF is used to turn off all lights in the house for bedtime or when we go out.

The problem is when i click scene OFF, the 433mhz outlets do not turn off I think this is becasue there are too many commands being sent at 1 time. Before i have managed to get some of the outlets to turn off by placing the command inbetween other commands such as turning off ESP8266 relay boards. but i cannot use the ‘Lights’ group to turn off all at the same time.

Items-
Switch Light_Remote1 "Fireplace" (Tests, GF_Living) {exec=">[OFF:sudo /opt/openhab/custom_scripts/433/1switch0.sh 1] >[ON:sudo /opt/openhab/custom_scripts/433/1switch1.sh 1]"}

Script -
#!/bin/bash for run in {1..5} do sudo ~/433Utils/RPi_utils/rfoutlet/codesend 1135932 done
Scene rule- (none of the last 4 commands will work unless slotted inbetween any of the other commands.
`rule "Activate Scene OFF"
when
Item Scene_General received command 4
then
logInfo(“Scenes”, “House - OFF”)
sendCommand(Lights, OFF)
sendCommand(MoodLights, OFF)
sendCommand(Light_GroundfloorN, OFF)
sendCommand(Light_CoolWarm1B, OFF)

    sendCommand(Light_Remote1, OFF)
    sendCommand(Light_Remote3, OFF)
    sendCommand(Light_Remote4, OFF)
    sendCommand(Light_Remote5, OFF)

end`

Maybe not of much help, but I had the a similar issue (multiple RF433 power plugs in one group) and solved it by adding a delay between every send:

RF433Lights.members.forEach[rfLight,i|
    logInfo("Lighting.rules", "Switching RF433 light " + rfLight.name)
    createTimer(now.plusMillis(i*2500)) [|
            rfLight.sendCommand(AllLights.state as OnOffType)
    ]    
]

Thanks Dominic,

It did it.

Heres the code for anyone who is having the same issue in the future-

`rule "Activate Scene OFF"
when
Item Scene_General received command 4
then
logInfo(“Scenes”, “House - OFF”)
sendCommand(Lights, OFF)
sendCommand(MoodLights, OFF)
sendCommand(Light_GroundfloorN, OFF)
sendCommand(Light_CoolWarm1B, OFF)

    sendCommand(Light_Remote1, OFF)


createTimer(now.plusMillis(2500)) [|
    sendCommand(Light_Remote3, OFF)
] 
                
createTimer(now.plusMillis(5000)) [|
    sendCommand(Light_Remote4, OFF)
] 
                
createTimer(now.plusMillis(7500)) [|
    sendCommand(Light_Remote5, OFF)
] 

end`

You might like to try @rlkoshak’s Group and Filter design pattern.

He wrote an example of using timers and this pattern in this post, which is more complex than your current problem, but could make any future changes easier.