Rules with widget on off

Hi gurus,
I had created rules where by if the sensor is detected it send me alert. However, I would only want it to send to me when I’m out of home… Is there a way I can create a widget to switch the rules on and off rather than manually clicking each rule to enable it?

Everthought of a proxy item of type switch that you can control with you widget ?

Then just add a but only if to all rules that shall only run when the proxy item is on (or off, just like you want it).

Thanks hmerk. Could you let me know what is proxy item is?

So just to help me understand more…it means I create a proxy item… Link all then sensor I want to… And create a widget on that proxy item?

There is very little to go on here so these are just guesses.

  1. In the UI, add a “But only if…” condition to the rule to test and only run the rule if the Switch Item showing your presence is OFF.
  2. If using text based rules, add an if statement to the top of the rule to return if the Switch Item showing your presence is OFF.
  3. Create two rules in the UI. The first rule will trigger when the Presence Item changes to ON and disable the rule the reports the sensor reading. The second rule triggers when the Presence Item changes away from ON and enables the rule that sends the sensor report alerts.

In all of these cases though you need to create that Switch Item that represents your presence. Once you have the Item, you can manipulate it through a widget. That Switch Item need not be a proxy Item. It can be linked to something that detects your presence.

As he wanted to have a switch to enable/disable the rules, I was referring to a proxy item.

@Calvin_Chin A proxy (unbound) item is e.g. just a switch item without any thing channel linked to it.

Thanks any idea how I create the proxy item? When I go to items it binds items?

In items, just hit the plus button, give it a nane and set type switch.
Don‘t link it to a thing/channel.

Tested and works like charm … Thanks everyone

Hi… I wanted to go next step further… I saw the demo in openhab that they have home and away button…where you click home…you need to enter password… I believe this is for their security… Currently I’m using proxy switch to enable and disable alarm… How do I made it password just like the demo? So no when I disarm the security it asked for password?

What demo?!!

The demo when you open

Ah, that‘s quite simple.
Log into the demo site (demo:demo), go to settings/pages and select the overview page.
Now you can see how the home button is configured.

Thanks I didn’t know can see it… now I got my keypad widget setup and arm and disarm widget. How do I set a password on disarm . Say password is 1234 and when I click the disarm the keypad pop up and enter password and if it matches 1234, it disable notification on all my sensor send to my phone… Currently I have use proxy item to switch on off as per above… but I wanted to go 1 step further to improve so that when I disarm, it asked me for password

What about reading the documentation for the keypad widget

You need two items holding the pin, one for arm and one for disarm and configure them in the widgets.
Within your rules, check is the entered pin matches your expected input. If it does not, reset the pin item.

Awesome… Got it work… Thanks a lot

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