Popp Z-rain not returning to zero

Hi all
I’ve been playing around with the Z-rain sensor and Hassio 3.12. Adding the sensor is a bit tricky since it almost immediately goes into sleeping mode and HA doesn’t have time to finish with the setup. I have to push the inclusion button on the Z-rain a few more times until it’s listed as Query Stage Complete.
Now, the thing is: After it’s been raining the HA still reports the last mm count for the Z-rain rain amount. Like we got 1mm yesterday and that’s still showing on the dashboard. I used to run Domoticz and don’t remember having this issue with the Z-rain before.
Any ideas?

Regards
/Fredrik

Bump.
I realize the Popp Z-rain isn’t the most common device but what about general terms. Has anyone had this issue with another sensor? Reported value stuck?

/Fredrik

Hi all
I’ll reply to this myself with my workaround if anyone else run into the same problem. After contacting the Popp support, which landed me at aeotec, I got the suggestion to send the Rain Counter 0 command to the Z-rain. This worked and the Z-rain is reporting 0 rain even after rebooting HA.
Thankfully there is a suitable action to call in automation which led me to set up the following which has worked fine.

automation
  alias: ZeroRain
  description: ''
  trigger:
  - platform: template
    value_template: '{{ as_timestamp(strptime(states(''sensor.date_time''),''%Y-%m-%d,
      %H:%M'')) - (as_timestamp(states.sensor.popp_co_popp_z_rain_rain_sensor_general.last_changed))>1000}}'
  condition:
  - above: '0'
    below: '90'
    condition: numeric_state
    entity_id: sensor.popp_co_popp_z_rain_rain_sensor_general
  action:
  - data:
      node_id: 23
      parameter: 1
      size: 2
      value: 0
    service: zwave.set_config_parameter

Hi @TheHoff.
I am thinking of getting a Popp Z-Rain gauge and connect it to my raspberrypi 3b and get the statistc into home assistant. Can you recommend it? How are you running it? Please guide me!

Hi Zkaning
No probs, I’ll try to offer as much insight as I can. I got mine in December 2019 when my Oregon 433mhz rain gauge broke after years on the roof top. Like I’ve been “droning on” in my posts I used Domoticz until I switched to Home Assistant a month ago and there seems to be something differing between these two in how the data from the Z-rain is being processed.
Anyway. The Z-rain as a unit is a good build and I recommend it for the price it has, it’s plastic but compared to Oregon the parts looks like they will last longer.
Inclusion with Home Assistant is pretty easy if you follow whats written under https://www.home-assistant.io/integrations/zwave/. I use the Aeon Z-stick Gen5. What took me a while to understand was how a battery powered Z-wave device, like the Z-rain, communicates compared to a powered device like a wall switch. The Z-rain only communicates by itself at a set interval which by default is once every 24h and it’s only at these times you can send commands, like rain amount reset, to the device. This communication interval can be changed in the HA Z-wave section but an interval of 10 minutes drained my lithium batteries in two months.
I basically use the default Lovelace card on my dashboard as seen below. Something one needs to handle somehow is the Rain amount value sent by the Z-rain, it’s not shown properly on my screenshot but at the moment it was 16.5mm which was one days worth of rain, but it was three days ago and is still being sent by the Z-rain. But Popp I’m told this is by design. The Rain Rate value goes back to 0 as soon as the rain stops but amount continues to accumulate until you factory reset the sensor or have HA send a reset command, which can only be done during the communication intervals. Something of a caveat I would say.
zrain

Thank you sooo much!! I will dig deeper into this when I have the time but if I understand it correct it is possible to reset the rain amount every 24h and then get that 24h accumulated per day and have a graph showing the last week amount divided per day? That is what I want to know to be able to watering my lawn when the last 7 days is below lets say 25mm rain :slight_smile:

Think nothing of it.
I ended up with this automation which resets the counter in HA just after midnight. The caveat here is the “zwave.set_config_parameter” command, if your HA restarts before the reset command is received by the Z-rain, which depends on the communication interval, the Z-rain will report back the last known rain amount to HA which might mess up any depending automation. Like your lawn watering logic. In my case I got lousy graphs in Graphana with the rain amount graphs jumping back an forth and made it next to impossible to read if there had been any actual rain or not.

/Fredrik

alias: ZeroRain
  description: ''
  trigger:
  - at: 00:01:00
    platform: time
  condition:
  - above: '0'
    below: '90'
    condition: numeric_state
    entity_id: sensor.popp_co_popp_z_rain_rain_sensor_general
  action:
  - data:
      node_id: 24
      parameter: 1
      size: 2
      value: 0
    service: zwave.set_config_parameter
  - data:
      entity_id: sensor.popp_co_popp_z_rain_rain_sensor_general
      state: 0
    service: python_script.set_state

So for quick rain detection this device is not good, correct?

Hi PuckStar
Actually, quick detection of rain is where it’s best at. It has a feature which gives an instant notification of “rain activity”. My problem is still the accumulation feature where the sensor remembers the total rainfall instead of leaving it to HA.

/Fredrik

thanks
anyway i making a package for manage rain rate and rain volume.

your template is ok but need utcnow() and not sensor.date_time, like this:

{{ (as_timestamp(utcnow()) - as_timestamp(states.sensor.popp_co_popp_z_rain_rain_sensor_rain_rate.last_changed)) | int > (states(“input_number.atmospheric_events_rain_rate_reset_value_wait_rain_management”) | int * 60) | int }}

and you can use an input number for select the right time difference between sensor last_changed and now. * 60 if you set “minutes” as u.m. in the input_number options.

i created an automation that write the sensor in an input_text box only if it changes, so i can do double check…

The difference between domoticz and hassio causing the behaviour you see is that domoticz keeps track of the value at 0:00 and reports both the value returned by the z-rain as the total rainfall, plus the difference between the current value and the value at 0:00 as today’s rainfall. Hassio apparently only shows the value reported by the device.

1 Like

Hi Frederic,
please how to get the quick detection of rain from Z-rain?
Pavel

Hi
I don’t know how you define “quick” but if there is heavy rain which causes the tipping cup inside the Z-rain to move it’s pretty quick at sending a Z-wave message. After that it’s up to the receiving logic, in my case Home Assistant, to calculate the daily difference. Light rain or if it’s dirt inside the funnel might cause the Z-rain to be slow in triggering on rain, I’ve also had to lubricate the tipping cup a few times.

On a side note I’ve tossed around the idea of using a moisture sensor and a towel as a sort of “is it raining yes/no?”-sensor.

/Fredrik

I’m reviving this thread since I can’t find any answer to this.

I have similar issues with my Popp Z-Rain, but it’s the value that show how much it rains right now that doesn’t return to zero. So for the past week couple of weeks it’s been saying that it rains 7mm/h constantly. Rather useless if you ask me :slight_smile:

Does your Popp Z-Rain reset the flow value to 0 when it stops raining?

I’ve tried moving my sensor closer to the Telldus bridge, but even if it’s indoors it still doesn’t reset the value. I’ve also flipped the cradle inside to simulate light rain and then just left it so it’d understand that it has stopped raining but no luck.

Suggestions are highly appreciated.

Hi ,

I have created 3 new utility meters sensors using helpers : hourly , monthly , yearly

pluviometer

1 Like

Sorry for a long post but adding this as it might help others with the same challange.
I am pretty new to HA and came across this challange of having the Popp Z-rain device reporting daily rain instead of total accumulated rain. I also wanted to have rain reported in mm instead of in m3.

I asked ChatGPT for guidance to design an automation with a helper and a template sensor “Daily rain” that resets at midnight, and is incremented with what is reported by Popp Z-rain during next 24 hours. Here is the ChatGPT response:

Certainly! Using a helper created through the Home Assistant UI under “Settings → Devices and services → Helpers” to regularly reset the daily rainfall measured from the sensor sensor.popp_rain_sensor_water_consumption_cubic_meters is a straightforward process. Here’s how you can do it:

Steps to Create and Use a Helper to Reset Daily Rainfall

  1. Create the Input Number Helper :
  • Navigate to Settings > Devices & Services > Helpers.
  • Click on + Create Helper and choose Number.
  • Configure the helper with the following details:
    • Name: ‘Daily Rain Reset’
    • Initial Value: ‘0’
    • Minimum Value: ‘0’
    • Maximum Value: (set to a reasonable maximum rainfall value you expect)
    • Step Size: ‘0.01’ (or any precision you require)
  • Click Create.
  1. Set Up the Automation to Reset the Helper :
  • Go to Settings > Automations & Scenes.
  • Click on + Create Automation and choose Start with an empty automation.
  • Trigger :
    • Add a trigger with:
      • Trigger Type: Time
      • At: 00:00
  • Action :
    • Add an action with:
      • Action Type: Call Service
      • Service: input_number.set_value
      • Service Data:
entity_id: input_number.daily_rain_reset # replace with your helper ID
value: "{{ states('sensor.popp_rain_sensor_water_consumption_cubic_meters') | float }}"

This action sets the helper’s value to the current reading of the rain sensor at midnight, effectively capturing the cumulative value to subtract the next day.

  1. Create a Template Sensor for Daily Rainfall in mm :
  • This template sensor will calculate the daily rainfall by subtracting the value in the helper from the current sensor value.
  • Go to Configuration > YAML configuration (or use the File Editor if you manually edit your configuration files).
  • Add a template sensor in your configuration.yaml:
sensor:
  - platform: template
  sensors:
    daily_rainfall:
      friendly_name: "Daily Rainfall"
      unit_of_measurement: "mm" # Daily rainfall displayed in mm
      value_template: >
        {{ ((states('sensor.popp_rain_sensor_water_consumption_cubic_meters') | float) - (states('input_number.daily_rain_reset') | float)) * 1000 }}
  1. Restart Home Assistant :
  • After modifying the configuration.yaml, go to Settings > System > Server Controls and click Restart to apply the changes.

Explanation

  • Helper : Stores the rain sensor’s value at midnight.
  • Automation : Resets the helper to the current rain value at 00:00 each day.
  • Template Sensor : Displays the daily rainfall by calculating the difference between the current rain sensor value and the stored midnight value.

This approach leverages the helper for easy manipulation and UI-based configuration in Home Assistant, ensuring that the daily rainfall value is reset and accurately displayed each day.