Hi Dormani,
First of all create an entry in your configuration.yaml:
# Input number
input_number: !include input_number.yaml
Now create a file input_number.yaml .
Contents of input_number.yaml
daily_kwh:
name: Daily kWh
min: 0
max: 1000000
step: 1
unit_of_measurement: kWh
Next restart home assistant to create this value (note they will all be 0 and undefined as to their units of measurement at this stage).
To get your input number to start storing values you need to increment that input_number.daily_kwh; so create an automation in your Configuration/Automations/Add Automation area as follows (yaml provided or use the UI to create yourself).
alias: Increment kWh
description: ''
trigger:
- platform: time
at: '00:01'
condition: []
action:
- service: input_number.increment
target:
entity_id: input_number.daily_kwh
mode: single
Next run the actions on your new automation.
Now that you have a value stored in input number (N.B don’t create your utilities below until you have data stored in your input number), now update your configuration.yaml as follows:
# Utilities
utility_meter: !include utility_meter.yaml
Create a file called utility_meter.yaml
daily_supply:
source: input_number.daily_kwh
name: Daily Supply
cycle: daily
tariffs:
- charge
daily_correction:
source: input_number.daily_kwh
name: Daily Correction
cycle: daily
tariffs:
- count
Restart your home assistant a second time to create the utilities, Run the automation “Increment kWh” to increment the kWh again (your utility meters should now start record data).
Now if you look at the developer area in Home Assistant you should be able to see something like this.
You will now have two utility meters that reset to 0 at midnight and then increment by 1 kwh at 1 minute after midnight each day, after HA energy detects these as available with data (usually 2 hours) you will be able to add them to your Home Assistant energy config as follows noting you can have as many consumption and export sensors as needed:
Grid Consumption
daily_supply charge
add your daily supply charge /standing charge/grid connection fee here (for me 0.96 per kwh)
Return to Grid
daily_correction count
No charge
This fixes your bottom line kWh count and also provides the per day standing charge/grid connection fee/daily supply charge.
Hope this helps.
Warm Regards,
Sean
P.S lessons learnt Home Assistant doesn’t like mixed measurements in it’s recorder so do not create your utilities until you have incremented your input number.