One rule for differents items

Dear all,
I would like to factor my rule. Is it possible to transmit a value from sitemap to a rule ?
For example :
Items :

Switch test1 (groupA)
Switch test2 (groupA)

Sitemap :

Switch test1 mappings=["var1"="ON"]
Switch test2 mappings=["var2"="ON"]

I would like to use var1 or var2 in a rule. Is it possible ?
When I click on test1 I would like to trigger rule “action” and I would like to use var1.
When I click on test2 I would like to trigger rule “action” and I would like to use var2.
It should be the same rule.
Thanks

Perhaps you want to trigger from Member of

If you want the text from the mappings you need to use a String Item and define the mappings as ["actiontest1"="actiontest1"].

And your Rule is a whole bunch of nonsense. There is no such thing as a Group trigger. sendCommand takes two arguments, an Item and the command.

Over all this looks a whole lot like an XY Problem. What are you actually trying to achieve?

I have edited my post in order to explain a little more :slight_smile:

My solution is still the same.

But why have two Items? Why not mappings["var1"="var1", "var2"="var2"]?

Trigger the Rule with the one test Item and look at test.state to see which “button” was pressed?

1 Like