Hi.
I have tried to make a rule manually in a .rule file. But I could not work this way, I do not get any log in. So I have tried to use the rule designer in HabMIN. But I can not work this either, so I get the following message in log:
2018-11-23 06:35:42.185 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model â(1)_neato_autostart.rulesâ has errors, therefore ignoring it: [13,1]: no viable alternative at input âthenâ
Itâs a simple rule that sends a CLEAN command to my Neato vacuum cleaner. Monday, Wednesday,Thursday, Friday at 8.00, but only if the alarm in the house is armed. (Then, do not start if we go on a day off and sleep long).
Attached is a screenshot from HabMIN and error message from log.
I canât understand, why this has to be that difficult, and what i am doing wrong?
I am not sure, since I donât use HABmin for rulesâŚ
You should restructure your rule and follow this logic:
when time cron is âŚ
then
if AlarmStatus is OFF
set item Neato to clean
Can you switch to </> Source view and post the source code?
By the way: You have 3 main options for building automation rules:
Flat text files (*.rules) with the assistance of VS Code
HABmin rules engine (the one that you are using now)
Habminâs Rule editor has not been updated since before OH 1.x. It does not produce Rules that are compatible with OH 2.x. Since the developer is also the developer for the zwave binding and zibgee binding I wouldnât hold my breath that it will be updated anytime soon.
I tried .rules textfile instead. I created following rule:
rule âNeato Autostartâ
when
time cron â0 55 10 ? * MON,WED,THU,FRI,SAT *â
then
if AlarmStatus_Hus = OFF
sendCommand(Neato_SendCommand,âCLEANâ)
end
But i get this error in the log. Iâm new to this coding, so i think i am missing something somewhere?
2018-11-24 11:27:47.500 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model â(1)_neato_autostart.rulesâ has errors, therefore ignoring it: [4,6]: no viable alternative at input âtimeâ
rule "Neato Autostart"
when
Time cron "0 55 10 ? * MON,WED,THU,FRI,SAT *"
then
if (AlarmStatus_Hus = OFF) {
Neato_SendCommand.sendCommand("CLEAN")
}
end
Thank you very much, it seems to work now. No error message in log file. I changes the time, and now i am waiting to hear the sound of the vacuum cleaner starting - fingers crossed
You can test your rule by setting up a dummy Item, put it in your sitemap and toggle it
*.items
Switch Rule_Trig "Testing Rules"
*.rules
rule "Neato Autostart"
when
Time cron "0 55 10 ? * MON,WED,THU,FRI,SAT *" or
Item Rule_Trig changed from OFF to ON
then
if (AlarmStatus_Hus = OFF) {
logInfo("Neato.rule","Alarm is OFF, Time triggered, sending CLEAN Command to Neato")
Neato_SendCommand.sendCommand("CLEAN")
}
end
Hmm⌠Now i get this, when it time for the rule to trigger:
2018-11-24 11:42:00.339 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule âNeato Autostartâ: An error occurred during the script execution: Couldnât invoke âassignValueToâ for feature JvmVoid: (eProxyURI: (1)_neato_autostart.rules#|::0.2.0.2.0.0.0::0::/1)
2018-11-24 11:50:00.151 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule âNeato Autostartâ: An error occurred during the script execution: Couldnât invoke âassignValueToâ for feature JvmVoid: (eProxyURI: neato_autostart.rules#|::0.2.0.2.0.0.0::0::/1)
rule "Neato Autostart"
when
Time cron "0 55 10 ? * MON,WED,THU,FRI,SAT *" or
Item Rule_Trig changed from OFF to ON
then
if (AlarmStatus_Hus.state == OFF) {
logInfo("Neato.rule","Alarm is OFF, Time triggered, sending CLEAN Command to Neato")
Neato_SendCommand.sendCommand("CLEAN")
}
end
what is the Item definition of AlarmStatus_Hus ? is it a Switch?
then there must be some error with the cron expression
try to remove it and see if the rule fires when using only the dummy Item as a trigger
rule "Neato Autostart"
when
Item Rule_Trig changed from OFF to ON
then
if (AlarmStatus_Hus.state == OFF) {
logInfo("Neato.rule","Alarm is OFF, Time triggered, sending CLEAN Command to Neato")
Neato_SendCommand.sendCommand("CLEAN")
}
end