[SOLVED] How do I turn the lights off in 5 Minutes on openhab

hello i’m new here and would like to know how to make openhab keep the lights on for 5 Minutes and then turn them off?

thanks

manu

Assuming you only want this for switching off: create a switch that expires after 5 minutes (using expire binding). Then using a rule make the light go off when this switch toggles to off (by the expire)…

This should work, however, does not include a proper mechanism to cancel the timer, meaning, once triggered it will always switch off the lights. If you do not want this you should add a timing check to the rule that switches off the light: something like: IF timer switch is off (either manual or by timer) check if it was the timer (then switch off light) but if via manual action do nothing

1 Like

hi there thanks for your quick replay I have tryed this Switch TimerOFF { expire=“1m,command=OFF” }
but it do not turn off the switch. I look in the longs and nothing is showing.

Did you install the expire binding?

Thanks. I did just now…

here is my code
Color Lamp01_Color “Office Lamp” [“Switchable”] {channel=“tplinksmarthome:lb130:86FAD9:color” }

can you please show me where i put the code to turn off in 1min.

thank you.
manu

Color Lamp01_Color "Office Lamp" ["Switchable"] {channel="tplinksmarthome:lb130:86FAD9:color",expire="1m,state=0" }
or
Color Lamp01_Color "Office Lamp" ["Switchable"] {channel="tplinksmarthome:lb130:86FAD9:color",expire="1m,command=OFF" }

You already had the code… you use the switch to start the timer.
You create a rule that is triggered by this switch going to OFF state and fro there turn all light off that you want off

thank you for all your replays

but nothing is working it just won’t turn off the lamp.

do i need to reboot the PI? after i install the binding and change the config?

Try your switch example, do you see it going to OFF position after the expire?
If so then expire works and you can continue with the rules the switch off light

thanks for your replay…

I have try the code but nothing works

thanks

Manu

I will reboot the PI and see if it will work

any other Ideas?

I have reboot and still not working

Make sure nothing else is controlling the TimerOFF switch

Switch NOT color
and channel ???

Switch Lamp01_Color "Office Lamp" ["Switchable"] {channel="tplinksmarthome:lb130:86FAD9:???????????????",expire="1m,command=OFF" }

thank you so verry much

It works after i reboot the pi and try again

it then worked

thank you for all your help

:smile:

Don’t reboot after config changes. Not needed, not helpful.

but it worked after i reboot

But it didn’t start working because of your reboot. You eventually need to wait until load has dropped (use ‘top’ or similar to see load), but don’t reboot.