zeronounours / HA-custom-component-energy-meter

Provides extended features on top of utility-meter to track costs for each tariff as well as total costs
MIT License
19 stars 2 forks source link

Add option for daily standing charge #50

Closed alfwro13 closed 11 months ago

alfwro13 commented 1 year ago

It would be great if there was an option to add (either static or from a sensor) daily standing charge to the cost. Thanks

zeronounours commented 11 months ago

This integration rely on the builtin Energy sensor and utility meter. I won't add features that is not already supplied by them. As of today, it is not supported by the Energy sensors, even if a feature request is opened for that: https://community.home-assistant.io/t/energy-add-fixed-daily-cost/330609/62

If/when implemented, I might add the same thing to this integration. Feel free to comment / reopen the issue if this is finally implemented.

If you want to add a standing charge, you'd better use a template entity for that:

energy_meter:
  daily_energy:
    source: sensor.energy
    name: Daily Energy
    cycle: daily
    price_entity: sensor.current_energy_price
    tariffs:
      - peak
      - offpeak

template:
  - sensor:
      - name: "Daily Electricity Cost"
        unit_of_measurement: "USD"
        state: >
          {% set peak = states('sensor.daily_energy_cost_peak') | float %}
          {% set offpeak = states('sensor.daily_energy_cost_offpeak') | float %}
          {% set standing_charge = states('sensor.daily_standing_charge') | float %}

          {{ peak + offpeak + standing_charge }}