User-based utility meter?

I’m sharing my EV Charger with my tenant, and I’m looking for a way to calculate how much electricity is used by myself and the tenant, respectively. I can My plan is to give the tenant a Zigbee switch, and everytime he starts to charge EV he needs to press the button(otherwise the charger won’t turn on). And when I charge my EV I’ll press my own Zigbee button. I guess an entity in HA can be used to record who pressed the button the last time.

However, the utility_meter helper can only track the electricity usage unconditionally. May I ask for some brainstorming how this can be done easily and reliably?

Thanks!

There might be smarter solutions out there, but here’s the approach I use for a utility meter that only registers the kWh I use from the grid during peak hours.

I’m relying on a power reading, though.
Not sure, if your EV Charger integration ahs one.

Step 1:
I have a sensor that only shows values during peak times called Power - Grid Power during peak:

{% if is_state('binary_sensor.tep_peak', 'on') %}
  {{ max(0, (states('sensor.tesla_pw2_site_power') | float(0) * 1000) | round(3)) }}
{% else %}
  0
{% endif %}

Step 2:
This drives an overall energy sensor through an Integral Sensor:

Step 3:
I use the Utility Meter to get a total per day:

Hope that helps .

I have an Aotec whole house meter and a lot of smart plugs. With the smart plugs power metering I can get fairly close to the whole house power, so I know when something’s drawing significantly more power than before I started charging my EV. I take the difference & assume it’s pretty close to what my car’s taking. I can add the difference to my utility meter (daily, weekly, & monthly) & track my usage. Which comes pretty close to what my car thinks.

Tape a NFC tag to the vehicle and your charger plug and detect when it is plugged in. Record the usage to different entity for amount since connect event till disconnect event. A different entity for each NFC tag. Compare the total against the sum of each entity for sanity check. You then have undisputed figures to discuss rationally, and they should show up on your dashboard correctly. Your entities should be appropriately configured so the totals are not counted twice, once for overall, and once per charger user.

You are monitoring electricity flow at the charger, not whole of house, otherwise your household net consumption during charging times might not be something your tenant wants to pay. If you have everything else monitored, it becomes a simple mathematical subtraction exercise to ascertain the difference.
Even if you just take a snapshot of the power values at connect and disconnect event, you should be able to work it out retrospectively at time of disconnect using the last connect value for that tag, the critical differentiator.