A simple event limit question, that I am assuming I’ve missed something very obvious.
Background (skip if TL;DR)
I’ve built an ESP32, with a 16x2 screen and 2 DHT11 humidity/temperature sensors. They are to monitor the environment I store my 3D printing filament in. The ESP32 communicates back to OH via MQTT. This all works well and I receive regular updates to the OH console.
The problem
When the humidity exceeds a nominated threshold, I want OH to notify me via email. The problem I have is that it continues to email me each time the humidity value changes. I want to limit the notifications to once per day.
I’ve changed my approach to match the design pattern here: Design Pattern: Event Limit and continue to experience the problem so I think it is something in the nested ‘IF’ statements I’ve put together.
Extract from .items file:
Number Filament1_Humid "humidity [%.1f%%]" {mqtt="<[mqttbroker:home/office/filament1humid:state:default]"}
Rules:
var boolean humidityalerted = false
rule "High Humidity for Filament 1"
when Item Filament1_Humid received update
then
if (Filament1_Humid.state as DecimalType > 70){
if (!humidityalerted){ sendMail("<email address>", "Filament Humidity Alert", "Filament #1 Humidity now exceeds 60%")
humidityalerted = true
}
}
end
rule "Reset Filament alert" when Time Midnight then humidityalerted = false end
Any suggestions?
TIA.