Widget action: rule

Hi,

I have a widget, which displays the current state of a thermostat.
It is possible to change setpoint temperature and the mode of the thermostat (auto, manual) and so on.

But:
When I want to increase the setpoint temperature in the hole house, I have to increase the value on all thermostats. So I would like to add a button to the widget to copy specific values to other thermostats on the floor or the hole house. I thought I could do this with an oh-button and the action: rule like the following example:

- component: oh-button
  config:
    iconF7: equal
    action: rule
    actionRule: f7ce3da30d
    actionItem: =props.item
    raised: true
    round: true

When I hit the button, the rule gets fired, but I didn’t find a way to get the “triggering Item” or to pass a parameter to the rule, to know from which thermostat the properties should be copied.

Is there a way to achieve this?

Or is it possible to get the item which was last updated in the rule?
(The rule is an ECMAScript)

Thanks
Thomas

Most people create a Group type Item with all required existing target thermostats or dimmers or whatever as members. Sending a command to the Group automatically distributes to all members.

rossko57 has the answer. But to elaborate on the original question, no you cannot pass information to the rule this way. I believe that actionItem is completely ignored with actionRule. When you click the widget it will run the rule the same way as when you click the play button on the rule itself. When you do that it’s not running based on an Item event and therefore there is no triggering Item.

Therefore the rule Action is useful to trigger rules that don’t care what the triggering Item is (since there isn’t one). One use case might be to activate a scene.

Your use case is best handled by a Group as rossko57 describes. Change the action on the Item to send a command and set the Item to the Group.

Thanks to both for answering my question.
It’s a pity, that it isn’t possible to pass parameter to the rule. This could be useful for many other situations.
But in my case the option with a group item is a good solution. I have to adjust the widget a little bit and then I don’t need a button to copy the values, but I can show an additionally instance of the widget, which acts on the group items.

This is what “real” rules are for, you shouldn’t be doing umm ‘operational’ processing in what is just a UI, a presentation.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.