Hello, i have created two rules, to register pulses from my electrical meter, and a second rule to generate hourly totals, the first rule is working, but the second doesn’t work because of syntax. (i always seem to have the same difficulty)
var long PulseCounter = 1
var long PulsePrevious = 1
rule "Pulse energy counter"
//////////////////////////////////////////////////////////////////////////////////////////////////
when
Item NodeEnergy_Pulse received update
then
logInfo("Pulse Counter="," ReceivedValue= YES" ) //########################################################### Send log
PulseCounter = PulseCounter +1
logInfo("Pulse Counter="," Pulse Counter=" +PulseCounter) //########################################################### Send log
end
//////////////////////////////////////////////////////////////////////////////////////////////////
rule "Hourly energy pulse count"
//////////////////////////////////////////////////////////////////////////////////////////////////
when
Time cron "0 0/1 * 1/1 * ? *" // 20 minutes for testing
//Time cron "0 0 0/1 1/1 * ? *" // every hour
then
var long PulseHour = (PulseCounter.floatValue - NodeEnergy_PulseHour.state as DecimalType)
logInfo("Pulse Hourly=",">>>>>>>>>>>>>>>>>>>>>>> Hour Pulse Counter=" +PulseCounter) //########################################################### Send log
// postUpdate(NodeEnergy_PulseHour, (PulseCounter - PulseHour)
//logInfo("Pulse Hourly="," Hour Pulse Counter=" +PulseHour) //########################################################### Send log
end ````
Can anyone point me in the right direction, i've tried different syntax and layouts, but i can't seem to determine the correct format.
Thanks in advance