Utlilty Meter configure timezone for reset

I’m using Utility Meters configured through the GUI with a daily reset. I’m in the UK so we’re currently using BST and the meter resets at 00:00 BST (23:00 UTC).

I’d like to be able to have the meter reset at 00:00 UTC so it remains consistent throughout the year, but there doesn’t appear to be an option to set the timezone just for the reset. I still want it to display the times in my local timezone, so I don’t want to configure my whole system to UTC.

Does anyone know a way to achieve this?

The only way I can think to do this is to set up your utility meter with no reset cycle.

Then use an automation to reset it using the utility_meter.calibrate service at UTC 0:00

e.g.

trigger:
  - platform: template
    value_template: "{{ utcnow().hour = 0 }}"
action:
  - service: utility_meter.calibrate
    target: 
      entity_id: <your utility meter here>
    data:
      value: "0"

That’s certainly worth a try, thanks. I’ll set up a test UM and see if it works ok tonight. It doesn’t look like there’s any way to change the reset cycle once they’re created, but if it works recreating them without a reset isn’t a big issue.

So it looks like I have this working :slight_smile: thanks @tom_l

For anyone else who may want to do this, my final (for now!) value_template is:

“{{ utcnow().hour == 0 and utcnow().minute == 00 }}”

As the automation triggers every minute I found just using utcnow().hour triggered the reset mutiple times, so I’ve also included the utcnow().minute so it only triggeres once. Other than that it’s pretty much as per the example you gave.

It shouldn’t.

The automation should only trigger when the template changes from true to false. That will only happen once a day when the hour changes from 23 to 0. Staying at 0 when the minutes change should not re-trigger this as the template is already true. If it does then it is a bug.

I’ll write a test automation and report back.

EDIT: I know what the problem is. The trigger template should be:

value_template: "{{ utcnow().hour == 0 }}"

= assigns a value (x = y, sets the value of x to the value y)
== tests a value ( y == y, tests if x is the same as y)

I have got to stop making that mistake! Twice in the past week or so.

Thanks Tom. Yes I already corrected that in my template, though it took me a while to figure out why it was throwing an error!