Weekly rainfall overview per day send by SMTP mail

Every Friday, I would like to receive an overview by email with the day by day rainfall, like:

Saturday: 9mm
Sunday: 2mm
Monday: 1mm
Tuesday: 3mm
Wednesday: 5mm
Thursday: 0mm
Friday: 0mm

Sending mail by SMTP, configuration of the automation etc. I can manage. My question is, how do I get the daily amount of rain where I have these sensors from my weather station:

  • total daily rain
  • total monthly rain
  • total rain

I’m thinking to use “Utility Meter”, but I’m not sure how to config it (if it’s even possible).

If Linux, you can set up a chron job to call a simple program to send the email - it does not have to even be in HA - same with Windows, using Windows scheduler - unless you need some kind of statistics temporarily stored in a dashboard in HA to say yes the email was sent, etc. (in which case you could have your program make a log antry and then have HA pick up on that from the log) -

I prefer to have HA do the job for me, since everything is already there. I just want to configure once and then forget :slight_smile:

Would it be possible to make an automation that stores the daily (for each day) rain counter just before it resets at 23:59? Then reset these counters on a weekly base?

Solution found :slight_smile:

First you have to create 7 helper numbers. Then create these automations:

2 automations:

alias: Save daily rain
description: ""
trigger:
  - platform: time
    at: "23:59:00"
condition: []
action:
  - if:
      - condition: time
        weekday:
          - mon
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_maandag
  - if:
      - condition: time
        weekday:
          - tue
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_dinsdag
  - if:
      - condition: time
        weekday:
          - wed
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_woensdag
  - if:
      - condition: time
        weekday:
          - thu
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_donderdag
  - if:
      - condition: time
        weekday:
          - fri
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_vrijdag
  - if:
      - condition: time
        weekday:
          - sat
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_zaterdag
  - if:
      - condition: time
        weekday:
          - sun
    then:
      - service: input_number.set_value
        data:
          value: "{{ states(\"sensor.easyweatherv1_6_4_daily_rain_rate\") }}"
        target:
          entity_id: input_number.regen_op_zondag
mode: single

And one to reset the day values on weekly base:

alias: Reset daily rain values
description: ""
trigger:
  - platform: time
    at: "00:00:00"
condition:
  - condition: time
    weekday:
      - fri
action:
  - service: input_number.set_value
    data:
      value: 0
    target:
      entity_id:
        - input_number.regen_op_dinsdag
        - input_number.regen_op_maandag
        - input_number.regen_op_woensdag
        - input_number.regen_op_donderdag
        - input_number.regen_op_vrijdag
        - input_number.regen_op_zaterdag
        - input_number.regen_op_zondag
mode: single

Then you can use these input number to sent by SMTP mail.