Attempting to use the History_Stats sensor to derive daily rainfall measurements. Currently, the rain guage just keeps incrementing any time rainfall occurs. As the measurement is in mm, it is a floating point value with one decimal place. My current sensor definition always returns “Unknown value” and I suspect it has to do with the state:
definition. I verified this definition returns that float value, using Developer Tools / Template. I’ve also tried both type:time
and type:count
but neither succeeds.
I would appreciate any suggestions from you great and infinitely more experienced HA wizards. Thank you!
sensor:
- platform: history_stats
name: 'rain_mm_today'
entity_id: 'sensor.cotech_367959_121_rain_mm_today'
state: '{{ states("sensor.Cotech-367959-121-rain_mm") | float(1) }}'
type: time
start: "{{ now().replace(hour=0, minute=0, second=0) }}"
end: "{{ now() }}"