martinarva / dynamic_energy_cost

35 stars 9 forks source link

Allow configurable daily reset time #9

Closed dunxd closed 2 months ago

dunxd commented 2 months ago

When measuring overnight charging (e.g. an EV) it makes sense to reset the counters at a time other than 0:00. Allow option to change this but keep midnight as default.

martinarva commented 2 months ago

I would like to keep the integration simple and do only daily, monthly, yearly costs.

If you want to have a sensor with different periods and resets I recommend to use home assistant Utility Meter integration.

Feed in your daily cost sensor from my integration to Utility Meter for example like this if you want it to reset 7am:

Add this to configuration.yaml

utility_meter:
  overnight_ev_cost:
    source: <your ev daily cost sensor>
    name: Overnight EV Charging cost"
    cron: "0 7 * * *"

Explanation of the cron fields field: