I am trying to create a kwh utility meter sensor based on the value of another sensor but I am not getting much luck with it working.
Ideally this new sensor will increase and then reset when a new month starts.
Created like this:
So I never want the helper utility meter to “decrease” only to go up by the amount of kwh the battery decreases by, if that makes sense.
Is there an easier template sensor to be created instead of this helper perhaps?
@tom_l thanks but I am still unsure how to deal with the kwh discharged sensor because I technically don’t have one and for the utility meter helper you can only provide one sensor not two.
I only have the battery left one which is kwh and increases and decreases.
I do have a monthly kwh sensor which comes directly from a shelly on the EV circuit which would give me an increasing value.
Or am I misunderstanding something here?
HA creates three new sensors for you. One that shows you the amount the battery’s charges every month and one for discharging.
The third is a sensor to toggle whether you are charging or not. This is what Tom told you to automate. If the car isn’t charging, set it to not charging and visa versa. When set to not charging the utility meter sensor.utilitymetername_not_charging will show you the amount of discharge!
The utility meter “charging” sensor should always increase. The utility meter “not charging” sensor should always be decrease. However it took some time for you to get the tariff switching automation set up correctly, so that could account for the short negative value in the charging sensor.
You can use the Developer Tools → Services page to call the utility meter calibrate service if you need to tweak the current totals.
Ok so if that’s just because of the initial setup it’s fine, as it will be correct from the start of the new month anyway.
Thanks again @tom_l, much appreciated
Thanks on all for the perfect instructions.
How can i split the ‘used this month charging’ for charging when state ‘car postion’ is ‘not_home’.
That’s because I usually charge at home and I want to know how much I’m charging externally.
You need some more logic in your ‘option’ line - I don’t know the answer and without your sensors to test I’d never get it right!
the outline is
if
home charging - charging is on AND car position is home
elseif
away charging - charging is on AND car position is not_home
else
not charging - charging is off (as it is now)