if(Modbus_Energy_Waermepumpe.previousState(true) !== null)
Code: Alles auswählen
rule "DAY_ENERGY_WAERMEPUMPE"
when
Item Modbus_Energy_Waermepumpe changed
then
//if(Modbus_Energy_Waermepumpe.previousState(true) !== null) {
val nTotal = (Modbus_Energy_Waermepumpe.state as Number).floatValue
val nHistoric = (Modbus_Energy_Waermepumpe.historicState(now.with(LocalTime.MIDNIGHT).minusHours(1)).state as Number).floatValue
//logInfo("fronius","Total: {} Historisch: {} Tagesertrag: {}",nTotal,nHistoric,nTotal-nHistoric)
Modbus_Energy_Waermepumpe_DAILY.postUpdate(nTotal - nHistoric)
//}
end