How to create a counter every 1000kw

Hello, I would like to receive a notification when my solar panels have produced 1000kw.
The Addon SBFspot has created MQTT integration where I can see an entity which shows me the total lifetime power my solar inverter has produced and with this sensor I would like to create the automation counter when there is + 1000kw produced it sends a notification to me.
I would appreciate somebody can point me into the right direction.

You are confusing energy and power. These are different things. Power is the instantaneous value, measured in kW. Energy is the total value supplied, measured in kWh.

It sounds like you want to be notified each time your PV array has produced 1000kWh from the current total value. So…

Create a utility meter helper with no reset cycle:

# configuration.yaml

utility_meter:
  solar_energy_counter:
    name: Solar Energy Counter
    unique_id: solar_energy_counter_utility_meter
    source: sensor.your_energy_sensor_here

I think you can do this in the UI but I am not sure if the UI Helpers version supports not supplying a reset cycle. You may have to do that in YAML.

This sensor will count up the total energy produced since it was created. You can trigger an automation when this reaches 1000kWh. Then reset the sensor value to 0 in the actions so it starts counting up to 1000 again, and send your notification.

You can create the automation in the UI Automation Editor or in YAML.

triggers:
  - trigger: numeric_state
    entity_id: sensor.solar_energy_counter
    above: 999.999
actions:
  - action: utility_meter.calibrate # reset action only available for meters with tariffs. So calibrate to 0 instead.
    target:
      entity_id: sensor.solar_energy_counter  
    data:
      value: 0
  - action: notify.your_notification_service_here
    data:
      message: "🌞The solar array has produced 1000kWh since the last time this message was sent."
1 Like

Hello Tom, I’m so gratefull you have given me this information, so I have to put that into the general configuration.yaml from HA? I could also create a seperate helpers.yaml and tell in the configuration.yaml to include helpers.yaml ?

Thank you, Ryan

Good morning Tom

This configuration works very good.
But after updating yesterday evening the HA Core system I noticed the counter went from 565kw to 0 so something has been reset and it’s counting now from 0 again.
Is there a possibility to add a certain value in the automation in such cases once so the counter is going from 565 instead of 0 and the at 999 it resets like usual?
Thanks for your kind support

Please share the history graph of the sensor.

Is there an automation trace for that trigger?

And did you get the message?

Yes there is an automation but now i did not got the message because it went down to 0 after it was on 572 and yesterday evening i updated HA Core version. But it would be good if I would be able to add somewhere a start number in such cases.

alias: GST counter
description: ""
triggers:
  - trigger: numeric_state
    entity_id:
      - sensor.solar_energy_counter
    above: 999.999
actions:
  - action: utility_meter.calibrate
    target:
      entity_id: sensor.solar_energy_counter
    data: {}
  - action: notify.your_notification_service_here
    data:
      message: >-
        🌞The solar array has produced 1000kWh since the last time this message
        was sent.
    enabled: false
  - action: notify.ryan
    metadata: {}
    data:
      title: Zonnepanelen hebben 1000kwh geproduceerd, vraag het certificaat aan
      message: Ga naar MyFluvius en registreer de opbrengst.

You can calibrate the utility meter manually in Developer Tools → Actions using the utility_meter.calibrate action.

1 Like

Also given that you have this in your automation:

I don’t see how you ever received a notification.

Can you go to Developer Tools → States, find sensor.solar_energy_counter and take a screen shot of the right hand column then paste it here.

Haha, Yes I have added my own notify see in the automation above and have put yours as not active “false”

1 Like

That’s great Tom !

Ok this is weird. This says it last rest at 8 minutes past 9 pm on the 10th.

But this looks to me like it was a lot closer to midnight on the 10th.

I have no idea what is going on.

Yes Tom, that was the time I updated the HA Core version from 2025.6 to 2025.9.1

They are two separate times.

For me it was weird too because everything else was updated fine with the Core update, only one sensor was outdated like Telegram bot I had to remove from the config.yaml and is now editable in the settings.

But many Thanks Tom for your help and tips how to edit the value by using the developer tool action.

I must say, it is a very very very difficult thing to update my HA Core and OS but that’s related to other topics and which I read from other users too.

Tom, is this something I could add as a script or something on my homescreen if I need to adjust the counter?