[Solved] Rules conflicting each other

(Torsten Sterntaler) #1

Sorry, for posting crap in my first post, didn’t know this instantly goes online.

OS: Raspbian
Hardware: Raspberry Pi 3b
OpenHAB-Version: 2.3.0

So, christmas is around the corner and I’d like to switch on/off multiple LED-stripes. They are connected to Sonoff S20 running Tasmota - no problems so far.

  1. Basically, all switches can be switched on/off seperately, by using the switches defined. Works.
  2. I defined a rule, that switches on/off every LED-stripe as per Astro-Binding / Cron. Works.
  3. I defined another switch with an underlying rule, that is something like “Switch on/off all LED-stripes synchronously”. Let’s call this switch “All on”. When I push it, it affetcs all LED-stripes. Works.
  4. Now, I’d like to take “All on” notice if any one of the “underlying” switches was switched on/off manually. Guess, I used “All on” to switch off every LED-stripe synchronously, if all (AND-condition) LED-stripes were switched off manually, “All on” should switch off automatically. No problem here - works.
  5. Same as (4), but for switching on. But: I’d like to use an OR-condition, because this makes sense when I leave home. But now, when I switch on one of the LED-stripes manually, “All on” is switched on (which works as intended), but this triggers rules (3).

How can I tell openhab to not trigger every single LED-stripe, but only indicate a change of “All on”?

Thanks in advance.

(Vincent Regaud) #2

Please see:

(Udo Hartmann) #3

To be honest, I’m a bit confused…

Group:Switch:OR(ON,OFF) gChristmasLight "X-mas Lights [(%d)]" <light>
Switch ChristmasLight1 "X-mas 1 [%s]"  <light> (gChristmasLight) {...}
Switch ChristmasLight2 "X-mas 2 [%s]"  <light> (gChristmasLight) {...}
Switch ChristmasLight3 "X-mas 3 [%s]"  <light> (gChristmasLight) {...}

use mappings on sitemap to get buttons instead of a Switch:

Text item=gChristmasLight {
    Frame label="Christmas Lights" {
        Switch item=gChristmasLight label="Switch All" mappings=[OFF="OFF",ON="ON"]
        Switch item=ChristmasLight1
        Switch item=ChristmasLight2
        Switch item=ChristmasLight3

The group item will show the number of lights switched to ON.
You can send a ON or OFF command to all lights whenever you want (other than with a simple switch…)
If switching a light manually ON or OFF, this is immediately recognized by the group item.

(Torsten Sterntaler) #4

I have to admit, I wasn’t aware of these Group-Switches.
Thanks a lot, works perfectly!

(Vincent Regaud) #5

Well done, I am glad you managed to make sense of it.