[SOLVED] Rules with timers or virtual/dummy switches

Hello Friends,
I’m using OpenHAB 3.1 running on Raspberry Pi 4 4GB with Raspberry Pi OS.

In my smart home system I have Z-Wave wall switches panels I use to control lights, ceiling fans, a bathroom heater and a water boiler Items.

In order to conserve energy, I would like to setup the bathroom fan, heater and water boiler to automatically shut-off after 1 hour. However, when I tried to use the Expire metadata command with them, they did not shut-off properly.

I’ve been told by other forum users, that using the Expire command for longer periods of times with Z-Wave things tends to fail due to limitations of how Z-Wave things communicates with OpenHAB and sends status reports (Expiration timer sometimes fails - #7 by rossko57).

To solve this issue, @rossko57 suggested I use rules with a timer,
whereas @ubeaut suggested I use a virtual/dummy switch.

Can anyone, please, explain how I should setup these two solutions?

Unfortunately, I’m not a programmer, so I didn’t understand how I should tackle this issue based on previous forum topics.

Many thanks in advance.

I would go for @rossko57 ‘s suggestion, you can find many examples on how to use timers in a rule.
Just search for rule timer.
Basically, your rule should be triggered when one of the items changes its state to on.
Now your timer will start counting down for 1h and when finished, sends OFF to the desired item.

So as you described, you will start with three rules…

1 Like

If you are not a programmer and just want to point and click then virtual dummy switch should work.

The issue you are having with z-wave is the metadata timer is reset every time z-wave updates. To get around that problem you use a virtual switch which will not be affected by the z-wave updates.

You would need a rule to turn the virtual switch on when the z-wave was set to on.
The another rule to turn turn the z-wave off when the virtual switch was turned off.
The metadata timer is set in the virtual switch.

All of the above can be done without writing one line of code.

If you want to get into writing the code then go with the timer coding.

I just use expire metadata. Works fine and even works if OpenHab is rebooted.

The choice is yours.
image

4 Likes

Many thanks, Hans and Greg :pray::pray:
For simplicity, I will try to follow Greg’s explanation.

Let me know if it works for you.

1 Like

Based on a short test, it seems your suggestion works great :slight_smile:
Thank you very much :pray::pray: