Hello all.
I have a new rule that I need to implement, but it just dont work.
Values Pmon_V, Pmon_A… Pmon_K are all well updated, but the PowerAccu item is never updated
Can you help me?
Thanks
Items:
Number PowerAccu “Acumulado Consumo Mês [%dW]”
rules:
rule “192.168.1.199 rec … Power Monitor"
when
Item PMon1_send changed
then
if (PMon1_send.state.toString.contains(“Monitor”)) {
var String[] buffer= PMon1_send.state.toString.split(”,")
var Double valor = new Double(buffer.get(4))
postUpdate(Pmon1_V,new Double(buffer.get(1)))
postUpdate(Pmon1_A,new Double(buffer.get(2)))
postUpdate(Pmon1_W,new Double(buffer.get(3)))
postUpdate(Pmon1_K,valor)
if ( valor > (PowerAccu.state as DecimalType).intValue ) {
postUpdate(PowerAccu,valor)
}
else {
postUpdate(PowerConsDay,((PowerAccu.state as DecimalType).intValue))
postUpdate(PowerAccu,valor)
}
}
end