Subtract energy by hour or "live"

Hi all.

For some time I have been using the Energy Dashbord with my Home Assistant Glow and calculating the cost from a Nordpool plugin (kWh price change every hour here).

Now I got a new contract with my PEV Charger provider, so I pay flat rate for home charging. The power for the PEV charger runs through my meter so I got an Schneider Electric PowerTag sensor for the PEV charger so I get the total kWh and W from it.

Ideally I would like to subtract the power usage for the PEV charger from the total energy consumption so I somehow can calculate my real cost.

It’s not just a simple subtraction as the price change by hour.

Can I somehow, hour by hour, or “live” subtract the PEV charger from Home Assistant Glow total?

I’m not really sure what a “Home Assistant Glow” is. But sounds like you’re describing a template sensor. Probably something like this:

  - sensor:
      - name: Total energy consumption minus charger
        state: >-
          {{ states('sensor.total_home_energy') | float -
            states('sensor.pev_charger_total_energy') | float }}
        unit_of_measurement: kWh
        state_class: total

Obviously I’m kind of guessing on things. But a template sensor will recalculate its state any time any of the entities it depends on change state. So if you have two total energy sensors you can make a new one that is always equal to one minus the other this way. Or whatever formula calculates it correctly for your use case, just make it into a template.

This is a Home assistant Glow:

it’s quite nice if your meter don’t got a data port :smiley:

ahh…completely forgot the states :smiley: tnx for the help.

Btw., is there a way to modify it, so I can use it as a Grid consumption sensor?

1 Like

Oh, I forgot the device class :man_facepalming: . Add device_class: power to the config and it should show up.

1 Like

Sweet…tnx :smiley:

Hello, how are you getting the values from the powertag? I’m looking for some information about it. Thank you

Powertag is supported in Zigbee2mqtt :smiley: