[SOLVED] How to create a Timer to switch off a light?

First of all, please use code fences:

You are not saying whether you see any errors in your log file:
https://www.openhab.org/docs/tutorial/logs.html

Do you use VSC?

Does it show you any errors?

Please check that you are using straight " (in your post they were the curvy ones”, but that may be a copy paste problem.

What is very helpful in troubleshooting is adding a logInfo statement immediately after the then line of your rule, that will log when the rule triggered. Doing so will allow you to determine whether the rule triggered at all:

rule "switch on"
when 
     Time cron "51 0 22 ? * * *"
then
     logInfo("Switch on","My switch on rule triggered")
     SmallAquariumLight.sendCommand(OFF)
end

Please note that the syntax <item_name>.sendCommand(command) is much preferred over the syntax you have used. read here if you are interested in the why:

And almost forgot: can you switch your light on and off through a user interface? If not, check your Item or Thing definition.

1 Like