Air con and cron

rules
openhab2
items
Tags: #<Tag:0x00007f51ecbafaf0> #<Tag:0x00007f51ecbaf258> #<Tag:0x00007f51ecbaea38>

(Pete Stanley) #1

I have been trying to get this to work for ages and its annoying me.

so i have an air con unit controlled by OH2 it works relatively well but i want it to come on at x time 2am or whatever and dry the room out. then go off x time later, but only when DEHU (switch) is on and the outside temp (ostemp) is 5 degrees or higher. To be fair i would like it to turn off if it dips below 5 as to protect the air con unit. Cant get it to work, can some one point me in the right direction, as i know its a syntax error. The time is not important more the interaction between cron and the items osTemp and DEHU

rule “dehumidify at 2am”

when
Time cron " 0 5 18 1/1 * ? *"
then

if ((Item DEHU.state == ON) && (osTemp.state >= 5)) {
sendCommand(AirconPower, ON)
Thread::sleep(700)
sendCommand(AirconMode, 2)
Thread::sleep(700)
sendCommand(AirconTemp, 16)
Thread::sleep(700)
sendCommand(AirconSwingVertical, 1)
}
end

thanks in advance.


(Pete Stanley) #2

i worked it out it turns out the " " are not in fact " " not sure i understand it, they look like " to me… anyhow deleted them and retyped and all started to work.


(Lou Erickson) #3

Look very carefully: The bad quotes are curved, and the leading and trailing quote are different. The good quotes are just straight up and down.

Programming interfaces almost always want the “plain” quotes, not the curly ones. The curly ones are more correct for use in writing, and match better what we’re taught to do by hand and will look better when printed, but they’re different characters and the programming languages aren’t recognizing them as quotes.

Little things like this matter to the computer, because the computer is stupid.

Working in a program designed to write words - such as Microsoft Word - is likely to get you the “smart quotes”. Working in a text or programming editor is more likely to get you the correct older straight quotes.

Glad you figured it out! Good luck!