Java Runtime Environment: Zulu, as recommended when installing
openHAB version: 2.1.0 stable
Issue of the topic: I have a rule to turn on my airconditioner that worked on my previous installation (OH 2.1.0, Zulu, windows 7 64bit) but now it is not working on pi. The only difference is only sendtelegram command, that works in another rule in the same rule file.
Please post configurations (if applicable):
myrule.rules
//timer for AC
rule "Turn MasterBedAC on"
when
Time cron "0 5 22 * * ?" // Every day 16:00 hours, evaluate sunset
then
if(VacationMode == OFF) {
sendCommand(Aircon_MasterBedroom_detector_trigger, OFF)
AirCon_SF_MainBed_AirCon.sendCommand(ON)
//BroadlinkRM3_SF_Main.sendCommand("AirCon_SF_MainBed_AirCon_ON") //this is not used anymore
sendTelegram("robot", "Master Bedroom AC turned ON on schedule")
}
end
If logs where generated please post these here using code fences:
I am unable to generate logs because this command on karaf console is not showing any activity on this rule
Add a logInfo statement as the first line that gets executed in that Rule. That will help tell us whether the Rule is executing at all or if there is some problem encountered.
One thing that does stand out. Is VacationMode an Item? If so you need to use
if(VacationMode.state == OFF)
I can’t explain why that may have worked before but fails now. It shouldn’t have worked before either.
thank you for mentioning it out. VacationMode is indeed a switch item.
is there any information of what kind of loginfo should I use? is this line on logging that I get from docs?
logInfo("heating-control.rules", "This is a log entry of type Info!")
and put it inside my rule on then part?
Also, this is what logged every time I update my rule
2017-12-05 18:16:43.367 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'SunsetLampAndACtimer.rules' is either empty or cannot be parsed correctly!
Eclipse SH designer see some error though, it see sendTelegram action, and Channel for my astro binding is wrong while it is running properly.
logInfo is fine and you only need them to help trouble shot, once you’ve got it all running OK you can remove them. You need to put log entries in any part the rule you think will help. So if you don’t think the rule is being run then you should have a logInfo entry as the first line after ‘then’. If you see your loginfo in the logs but nothing else then move it inside the if condiition and so on. You can obviously speed this process up by adding more than one logInfo statement at a time, just ensure the message is unique so you know which logInfo entries happened and which ones didn’t
To speed up testing I would also add another Condition to the when clause so you can trigger the rule from a test switch rather wait until 05:22 each morning.
You should also examine the events.log for the time period when you trigger the rule as you should see entries for Aircon_MasterBedroom_detector_trigger and AirCon_SF_MainBed_AirCon.
This depends on how you’re editting your rule files. It can be a false message due to OH trying to read the changes before the editor has finished saving. To be sure there are no actual errors you should stop OH, tail the openhab.log file and start OH again. Verify that all your things, items, rules, services etc are loaded without errors.