How to "run a rule" by clicking something in the UI

probably really stupid question: how can I define something like a button in e.g. the iOS App or PaperUI (or any other UI that builds on a Sitemap) that when clicked starts a rule?
Thx, Michael

Create a switch item, display it on a UI and a rule that triggers on command toward this item.

1 Like

thanks, but isn’t a switch meant to turn things on and off? I only want to run a rule …

Items are “meant” to but if you do not link such a switch item to a channel it works that way.
However using such a (virtual) item is not mandatory, the same works for an item that is linked to a channel.

It’s just an Item. You don’t have to link it to anything real. With a sitemap, you can use mappings= to create a widget that shows a single button. That’s just presentation, not how to do the rule part. To do anything from a UI, you must go through an Item.

I want to elaborate a bit on the answers here.

An Item represents one of the following:

  • Actuator: when commanded it causes something to happen
  • Sensor: holds a sensor reading
  • Setpoint/Config: holds a value used to configure behavior, for example a temperature setpoint for a thermostat
  • Collection: a Group of the above

So a Switch could be:

  • Actuator: causes something to happen
  • Sensor: the ON/OFF state indicates some binary state (e.g. this is how the Network binding reports the online status of a device or service)
  • Config: only do something if the Switch is ON (e.g. e.g. only turn on the lights if the Presence Switch Item is ON indicating someone is home)

You are wanting to click on something and cause something to happen, i.e. run a rule. So you want to use a Switch as an Actuator.

Notice how all of this is separate and completely independent from actual devices.

1 Like