- Platform information:
- Hardware: _CPUArchitecture/RAM/storage_Rpi 3B, 16 GB SD-card
Openhabian 2.3.0 build #1209
- Hardware: _CPUArchitecture/RAM/storage_Rpi 3B, 16 GB SD-card
I have a rain gauge reporting rain every five minutes. The amount is reported in the item Number Fryk_Rain via an MQTT message. The message is sent every five minutes no matter if there is rain or not.
These are the item definitions
Number Fryk_Rain "Regn 5 min. [%.2f mm]" <rain> (gFrykin, gRain) {mqtt="<[ib9sensors:ib9sensors-out/43/1/1/0/6:state:default]"}
Number Fryk_Rain_Acc "Regn under dygnet [%.1f mm]" <rain> (gFrykin)
Number Fryk_Rain_Last "Regn förra dygnet [%.1f mm]" <rain> (gFrykin)
I try to accumulate the rainfall during the day with the following rule(s):
// Accumulate rain readings
var Number rainThisDay = 0
var Number rainLastDay = 0
rule "Reset rain this 24 hrs"
when
Time cron "0 59 23 * * ?"
then
rainLastDay = rainThisDay
Fryk_Rain_Last.postUpdate(rainLastDay)
rainThisDay = 0
end
rule "Accumulate rainfall"
when
Item Fryk_Rain received update
then
rainThisDay = rainThisDay + Fryk_Rain.state as DecimalType
Fryk_Rain_Acc.postUpdate(rainThisDay)
end
The issue is that if the rainfall during a number of 5 minute periods is the same, the rule does not fire. The MQTT does report a new measurement but if the reported value is the same, for some reason this is not perceived as an update it seems. If every MQTT message is different, the accumulation works.