I have had Home Assistant for a bit over two years now and there does not seem to be a way to make an accurate (Monthly) rain graph, from the data given from my Netamo Rain Sensor.
I have also found very few posts directly relating, to what you would think being a simple task to create a rain graph in Home Assistant. I may also be a Luddite.
I have put this post together to capture the code I have used for any other Newbies that need a template to start with but would also like any advice you can give to make my graphs more accurate. I have tried utility meters to no avail. The Monthly Data is what I really need help with.
The Netamo Rain Sensor reports the following sensors.
- Rain Rate (mm/h)
- Rain Per Hour (mm)
- Rain Accumulated Per Day (mm) - Resets and Midnight
9am prefered to align with the weatherman in Australia.
This is a snip of how those sensors look in history stats, during a rainfall event.
SmartMixn Phone and Web App
SmartMixin is an application that provides access to your weather station and 40K+ other stations worldwide. It helps you see and understand weather data.
I have all My Weather Station Data recorded there for over two years now, you can click on the link and see the data.
I have added the Web App as a Web Page Dashboard and gives me access to all my graphs and accurate data.
The Mobile App give you more access to historical comparisons, charts and exporting csv files of your data. I wish they had an open API so I could import that data straight into Home Assistant, or an Integration.
The below image shows 87.7mm for January.
APEX CHARTS Monthly Rain Fall Graph
I am using the Rain Per Hour Sensor. It is close but not quite right because of the uneven shift of data over the month. Using the long term statistics option in this card is key.
The below graph shows 82.3 for January, because of the shift in data, and being on the 12 June Currently (Last 30 days is not in line with the months)
- type: custom:apexcharts-card
graph_span: 365d
header:
show: true
title: Monthly Rainfall
show_states: false
apex_config:
fill:
type: gradient
gradient:
type: vertical
shadeIntensity: 0.0
opacityFrom: 1
opacityTo: 0.5
stops: 10
chart:
height: 150px
grid:
show: false
borderColor: darkslateblue
strokeDashArray: 2
dataLabels:
background:
borderWidth: 0
opacity: 0
foreColor: white
offsetY: -10
plotOptions:
bar:
borderRadius: 0
dataLabels:
position: top
span:
start: month
offset: '-334.5833333333333d'
series:
- entity: sensor.netatmo_devonport_tas_indoor_rain_rain_last_hour
color: deepskyblue
type: column
group_by:
func: sum
duration: 30.41666666666667d
fill: zero
statistics:
type: state
period: hour
align: end
show:
name_in_header: false
datalabels: true
APEX CHARTS Daily Rain Fall Graph 30 Days
I am using the Rain Accumulated Per Day sensor. Using the MAX function and duration of 1d. when trying to use the same sensor in the above card it does not work properly. Using the long term statistics option in this card is key.
This one seems close to accurate
- type: custom:apexcharts-card
graph_span: 30d
header:
show: true
title: Daily Rainfall
show_states: false
span:
end: day
apex_config:
fill:
type: gradient
gradient:
type: vertical
shadeIntensity: 0.0
opacityFrom: 1
opacityTo: 0.5
stops: 10
chart:
height: 150px
grid:
show: false
borderColor: darkslateblue
strokeDashArray: 2
dataLabels:
background:
borderWidth: 0
opacity: 0
foreColor: white
offsetY: -10
plotOptions:
bar:
borderRadius: 0
dataLabels:
position: top
series:
- entity: sensor.netatmo_devonport_tas_indoor_rain_rain_today
color: deepskyblue
type: column
group_by:
func: max
duration: 1d
statistics:
type: state
show:
name_in_header: false
datalabels: true
MINI GRAPH CARD Last 7 Days Rain
I am using a template, statistics sensor to Accumulate the last 7 Days (10080mins) of Data.
This one seems close to accurate and drives my sprinkler system
Sensor:
# Rain Last 7 Days
-platform: template
sensors:
- platform: statistics
name: "Rain last 7 days"
unique_id: afe4b9f2-d0a6-4c42-86eb-786737f2ea14
entity_id: sensor.netatmo_devonport_tas_indoor_rain_rain_today
state_characteristic: sum_differences_nonnegative
max_age:
minutes: 10080
precision: 1
keep_last_sample: true
Card:
- type: custom:mini-graph-card
entities:
- entity: sensor.rain_last_7_days
color: lightblue
name: Rain Last 7 Days
group_by: date
show:
graph: bar
extrema: false
hours_to_show: 168
points_per_hour: 1
cache: true
animate: true
aggregate_func: last
MINI GRAPH CARD Rain Last 24Hrs
Directly reads the Rain Per Hour sensor and gives a good appreciation of the rain fallen in the last 24hrs.
This one seems accurate
type: custom:mini-graph-card
entities:
- entity: sensor.netatmo_devonport_tas_indoor_rain_rain_last_hour
color: lightblue
name: Rain Last 24hrs
group_by: hour
show:
graph: bar
extrema: false
hours_to_show: 24
points_per_hour: 1
cache: true
animate: true
agregate_func: last
RAIN GAUGE CARD Rain Last 24Hrs
Directly reads the Rain Accumulated Per Day sensor and gives a good appreciation of the rain fallen in the last 24hrs.
This one seems accurate
- type: custom:rain-gauge-card
entity: sensor.netatmo_devonport_tas_indoor_rain_rain_today
hourly_rate_entity: sensor.netatmo_devonport_tas_indoor_rain_rain_last_hour
name: Daily Rain
show_warning: false
show_error: false
Any advice you can give to make my graphs more accurate would be much appreciated.