Please help a OH2 Rookie with the most basic function… I’ve been working with industrial automation in 40 years and the last year i have set up one Zipatile system and one Fibaro HC system. Now, I’ve started with a Raspberry Pi 3B+ and OH2 (2.4.0 SNAPSHOT to make my Sonos system work) with Aeon Z-Wave dongle. The system is up and running, two different wallplugs (Nexa and Fibaro) is up and running fine, I have a small sitemap where I can control these two devices via Z-Wave but I’m totally lost on how to get my rule to work.
The function I want is simple:
1: When I turn on one wallplug (either via sitemap or the button on the device) I want to initialize one global variable to the value of f.ex. 60.
2: The variable should count down every minute and I should be able to manually alter the varible to higher or lower value using the sitemap (sitemap works fine).
3: When the variable reaches 0, the wallplug shoult turn off.
This all looks very easy to me but I can’t get my rule-logic to work…
//Items
Switch Wallplug_TV "Wallplug TV" <poweroutlet> { channel="zwave:device:34e0ed8b:node2:switch_binary" }
Switch Rancilio "Rancilio" <poweroutlet> { channel="zwave:device:34e0ed8b:node3:switch_binary" }
Number cdRancilio "Resttid [%s]"
//Sitemap
sitemap default label="Dalatest 3 sitemap"
{
Switch item=Wallplug_TV label="Test TV"
Switch item=Rancilio label="Rancilio"
Setpoint item=cdRancilio label="Resttid" minValue=0 maxValue=30 step=1
}
//Rule part 1
rule "countdown init"
when
item Wallplug_TV changed from OFF to ON
then
cdRancilio = 30
end
…is generating this error:
2018-08-31 11:45:16.201 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'default.rules' has errors, therefore ignoring it: [3,2]: no viable alternative at input 'item'
//And rule part 2:
rule "Minute counter"
when
Time cron "0 * * ? * *"
then
if (cdRancilio > 0) cdRancilio = cdRancilio - 1
end
…is generating this error:
2018-08-31 12:06:00.190 [ERROR] [ntime.internal.engine.ExecuteRuleJob] - Error during the execution of rule 'Minute counter': Unknown variable or command '>'; line 5, column 7, length 14
//Rule part 3
rule "countdown finished"
when
cdRancilio changed to 0
then
Wallplug_TV.sendCommand(OFF)
end
…does nothing…
I’ve read a lot and tried lots of variations on this rule but it seems that some very basic knowledge is missing in my head…