[SOLVED] Iron of after X minutes

I have connected my iron with a z-wave switch.
I only turn this switch on by hand.
but I sometimes forget to turn it off.

I want to make sure he is not on for more than 20 minutes after I switch it on.

Ideally I would also make a button that only has the function to turn off the z-wave switch.
I have looked at examples of a timer, but I do not get it.

This is what I have done so far:

I have a physical switch called E2_Strijkijzer
I have a virtual switch called E2_StrijkijzerOff

and the rules below.
Some parts are missing and maybe there is a better / more stable way to do this.

Any advice and code examples are welcome.

rule "strijkijzer uit na x minuten"
        when   
           Item E2_Strijkijzer changed from OFF to ON
        then   
            {
              ????If x minutes have passed????
              E2_Strijkijzer.sendCommand(OFF)
            }
end

rule "strijkijzer uit"
        when
          Item E2_StrijkijzerOff changed
        then
            {
               E2_Strijkijzer.sendCommand(OFF)
            }
end

Use the expire binding:

Switch E2_Strijkijzer "label" { channel="zwave-sdasdgsdg", expire="20m,command=OFF")

The switch will automatically turn off after 20m

Hi Vincent,
Thanks for your response.

I gues this example is for a switch on a sitemap?

this iron becomes very hot and for security reasons I never want to turn it on via the sitemap. I only want to turn it on when I’m standing next to it.

I want to be able to use the sitemap to turn it off and if I forget this automatically after 20 minutes.

Can I use the “expire binding” in a rule with a IF statement? (I don’t see this in the documentation https://www.openhab.org/addons/bindings/expire1/#binding-configuration )

You don’t need an if statement in a rule.
You need to define your item in an items file and add the relevant bindings.

A lot of zwave switches are able to switch off the power after a predefined time, for example the Fibaro’s:

This would even allow to have the iron switched off if your homeautomation fails.

Hi @micware

You need to define your item in an items file

  1. Unlink the item in paperUI
  2. Make a note of the zwave channel the item was linked to
  3. Create a file called myitems.items in the /conf/items folder
  4. Write the following in the file:
Switch E2_Strijkijzer "label" { channel="your z-wave channel", expire="20m,command=OFF")
  1. Save the file
  2. Install the expire binding
  3. You are done. The switch will turn off 20 minutes after being turned on.

Thanks for the idea Sihui.

1 Like

Thanks Vincent,

It took a while before I realized how simple it was. I only needed to add “expire =” 20m, command = OFF “” to an existing item in one of my item file.

And ofcourse install the expire binding

Thanks.