I’m trying to get a really simple rule working which switches my tellstick nexa switch on and off everyday, but I don’t seem to be getting something right. My rule is below
rule “Switch on”
when
Time cron “0 55 7 1/1 * ? *"
then
sendCommand(bedsw,ON)
end
rule “Switch off”
when
Time cron “0 0 8 ? * MON-FRI *”
then
sendCommand(bedsw,OFF)
end
I have been watching the logs and I see the rule refreshes, but there is nothing being triggered in the logs
First add some logging messages to the THEN clauses of your rules to see if they are even being triggered. (ie to see if your cron clauses are correctly formed).
If the rules are being triggered correctly via cron, then look to your item definition. Can you manipulate “bedsw” as defined thru a UI widget ?
Thanks for the reply, I have the switches already working in the openhab web UI just fine, so I’m slightly confused as to why the rule isn’t working? I have running openhab on a rasperberrypi 2 with the latest version of Rasbian jesse.
Are you able to tell me how to add logging messages? or is there a good guide somewhere? Thanks
Just to clarify @sam 's comment, the first phrase in the LogInfo command must match the name of a logger defined in logback.xml…a literal “My switch rule” may lead to (cough) “perplexing behavior”. Personally I have 8-10 loggers defined which route messages to different logfiles based on this behavior. NB you need both <appender…> and <logger…> definitions…
you can direct message to the appropriate log via the first argument to your logInfo (or logDebug etc) statement. E.g. logInfo(“KITCHEN”,“foobar”) will write “foobar” to the logfile described by appender and logger elements for “KITCHEN”.