[SOLVED] Using a group or multiple items in a Rule

Hey Guys,

I would like to have 2 lamps go on in my “then statement”.
Is there a way for just putting multiple items after eachother and is there a way for using a group here?
Either way i would love to know both answers if possible.
Can not find this back in the documentation.

does it work by changing the Itemname to groupname without anything else?

ItemName.sendCommand(STATE)

i created a group in my items file and added this in to those 2 lamps, called “Timeroutdoor”

    Group Timeroutdoor "Timer Buitenverlichting" (Home)  
    Switch Buitenvoordeur "Lichtpunt Voordeur" <light> (Buiten, Timeroutdoor, Lichten) {channel="nikohomecontrol:onOff:440e003a1939:40:switch"}
    Switch Buitenzijgevel "Lichtpunt Zijgevel" <light> (Buiten, Timeroutdoor, Lichten) {channel="nikohomecontrol:onOff:440e003a1939:42:switch"}

would this work:

rule "Sunset Buitenverlichting aan"
when
      Channel 'astro:sun:home:set#event' triggered START
then 
      Timeroutdoor.sendCommand(ON)
      
end

or this:

rule "Sunset Buitenverlichting aan"
when
      Channel 'astro:sun:home:set#event' triggered START
then 
      Buitenvoordeur.sendCommand(ON)
      Buitenzijgevel.sendCommand(ON)
      
end

Thx

I don’t understand the question :slight_smile: You have already found the (correct) ways for both cases :slight_smile:

Maybe you want to understand the difference and to see which case is better? There is no difference… it’s just easier to use a group (imho)

Yes

Hint: use gName for your groups to be able to identify them easier in your items and rules files

1 Like

Hey Angelos,

Thank you for your swift reply :slight_smile:
maybe i was a bit quick with my question then.
Wasnt sure if anything made sense what i was doing for multiple items and or grouping them in a rule.
I guessed this would not work.

Been testing for 2 days now, this astro makes me able to test twice a day :stuck_out_tongue: and today was the first time my test lamp turned on.
But the idea was controlling 2 lights with this.
So i thought… les make a post before waiting till tomorrow morning to see if this works.

Great tip for name these group, i’ll change this right away.

:slight_smile:
Tip: you can test your rule by creating a dummy item and toggling it manually to fire the rule when condition

Switch Test_Fire "Testing Rules"

place it in your sitemap and toggle it on/off

for your rule:

when
	Item Test_Fire changed from OFF to ON
...
1 Like

Actually, as you mention testing, i suggest to make an item “testswitch”, a basicUI test.sitemap with only that switch, and for testing replace the astro-trigger with (or add using an “or” in the trigger) with the “when testswitch changed to ON” or so. No need waiting for sunset, can test as often as you need.

2 Likes

Wow thanks guys.
Both really helpfull info!
If only i had that info 2 days ago :stuck_out_tongue:

Or you can activate the Astro’s trigger channel through the REST API if you don’t want to use a test Item.

1 Like