HowTo add/remove a Item in/from a group in a rule

Hello,

I have a lot of timers, do there work on day per week (with random ON/OFF etc.). AND i can add/remove items to the timer-groups (1…10) with habmin. So far so good!

Now i will add/remove itmes to the timergroups not with habmin but rather via rules (triggert from my sidemap).
Is there any possibility for it?

Thanks all for your support!

I don’t think this is documented anywhere and I don’t know if it does what I think it does (you may need to look at the code) but there is addMember(Item p0) and removeMember(Item p0) methods on the Group class. You can try to use those methods and see if it works. If not then the answer is probably no.

1 Like

Thank you Rich!

  1. you respond early to many posts - and have good tipps for us: Thank you for your excellence service!

  2. to the post: i will try it. The next question which reminds me: can i persist the item <> group membership over a restart of OH? My first idea was to change the items file - but i think that’s not the best way.

BR
Hubertus

If you want it to persist over a restart you will need to edit the Items file.