[SOLVED] A simple rule for turning off power (=heating)


(Per Dypvik) #1

Hello,

I am running Openhabian on a RPi 3 B+.

The following is my first rules attempt to turn off the power on my home office at 10 PM. The variable GF_Office_Power variable is an ON/OFF switch defined in items as well as sitemap

 import java.util.Random
/* This is a test rule which will turn off office power if time > 22:00 
rule "Office Off"
when
    Time cron "45 22 * * * ?"
then
	GF_Office_Power.sendCommand(OFF)
end

My question is what in this short test rule that is incorrect. Thank you!


(Vincent Regaud) #2

Please use the code fences when publishing code:


(YvesHanoulle) #3

What is your question?


(Vincent Regaud) #4

You cron statement is incorrect.
openHAB uses a cron format that includes seconds
so everyday at 22:45 would be: "0 45 22 ? * * *"

Please see:

https://www.freeformatter.com/cron-expression-generator-quartz.html


(Per Dypvik) #5

@vzorglub: Thank you!! It worked at 22:55 with your help!


(Per Dypvik) #7

@yves I tried to make it clearer in the update