How to reset a collecting sensor helper daily at a fixed time

Hi,

I have two issues with tbe collecting sensor in Home Assistant Core 2022.5.4

  1. created a collecting sensor helper via the UI. But once created I can not see or edit all parameters set during creation anymore. I didn’t figure out what the offset line in the UI means, when setin repeat to daily the offset still has the unit days.

Via the developers menue entity tab I get a Yaml overview that looks like this:

state_class: total_increasing
source: sensor.regenmesser_rainabs
status: collecting
last_period: '10.50'
meter_period: daily
cron pattern: 31 7 * * *
last_reset: '2022-05-20T22:00:00.022962+00:00'
unit_of_measurement: mm
icon: mdi:counter
friendly_name: Regenmenge 24h seit 7:31
  1. I can’t figure out how to reset the counter daily at 7:31:00 am. The cron pattern listed above does not work. Having a look at the source the cron pattern does not support seconds.

I tried:
31 7 * * *
31 7/24 * * *
00 31 7/24 ? * * *

I noticed that when a count event occurs the cron pattern gets overwritten to 0 0 * * *

Any hints how to reset the collecting sensor helper daily with an offset to midnight?

If this doesn’t work:

0 30 07 ? * *

Then you can use an automation to reset it:

trigger:
  - platform: time
    at: '07:30:00'
action:
  - service: utility_meter.reset
    entity_id: utility_meter.your_utility_meter_here

You’ll have to use a cycle longer than a day as that will also reset at midnight.

Hi Tom,
thanks for the very fast response. I did some tests with an energy meter wihich is triggering with high frequency.

Every time a count event occurs the cron pattern gets over written by a value determined from the meter_period parameter. For exampe quarterly_hour results in 0/15 * * * * or daily in 0 0 * * *. The cron pattern definitely does not support seconds. But nevertheless it makes no sense to set it manually because it gets overwritten with every count event. When having no period set the cron pattern gets deleted with every count event.

I will set meter_period to none and go with your automation suggested.

Thanks a lot.

Unfortunately the automation did not work as expected, because the collecting entity is created as sensor. The service utility_meter.reset does not work with sensors. I had to use calibrate instead.

Then a script to call looks lihe this

sequence:
  - service: utility_meter.calibrate
    data:
      value: '0'
    target:
      entity_id: sensor.regenmenge_automation
mode: single
alias: Regenmenge Automation zurücksetzen
icon: mdi:null

I have the same problem as DonKracho. .reset is not working for my utility_meters, (because they are generated as sensors?) or in general. Is this expected behavior and I should file an issue?

I have a similiar issue with a power meter sensor I had to create from current x voltage to then build another sensor based power over time as a Riemann Integral sensor I now have to reset and can not.

I am not sure what your code has to be used but I could not get that into my script section.

alias: Reset
sequence:
  - service: utility_meter.calibrate
    data:
      value: '0'
    target:
      entity_id: sensor.pv_balkon_energy_today
mode: single
icon: mdi:null

Where do I have to put this code , script or automation ?

Thanks a lot