Stuck with Utility Meter configuration

Hello,

New with home assistant but i am getting stuck with the config of the utility meter.
I followed this topic Energy, Gas and Water consumption overview for creating an energy and gas consumption overview

I have checked my files and codes on errors but there everything looks good.
Now everytime when i try to restart home assistant i get the error below.

The system cannot restart because the configuration is not valid: Invalid config for [utility_meter]: [hourly_energy_offpeak] is an invalid option for [utility_meter]. Check: utility_meter->utility_meter->utility_meter->hourly_energy_offpeak. (See /config/configuration.yaml, line 13).

i have checked the documentation regarding the utility meter and every parameter i have used is a valid one.

Search this forum and the internet but i just cant find the reason why it is failing

This the code i used for the utility meter

utility_meter: 
  hourly_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: hourly
  hourly_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: hourly
  hourly_gas:
    source: sensor.gas_consumption
    cycle: hourly

  daily_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: daily
  daily_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: daily
  daily_gas:
    source: sensor.gas_consumption
    cycle: daily

  weekly_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: weekly
  weekly_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: weekly
  weekly_gas:
    source: sensor.gas_consumption
    cycle: weekly

  monthly_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: monthly
  monthly_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: monthly
  monthly_gas:
    source: sensor.gas_consumption
    cycle: monthly

  yearly_energy_offpeak:
    source: sensor.energy_consumption_tarif_1
    cycle: yearly
  yearly_energy_peak:
    source: sensor.energy_consumption_tarif_2
    cycle: yearly
  yearly_gas:
    source: sensor.gas_consumption
    cycle: yearly

in the confguration.yaml i point to this config via
utility_meter: !include utilitymeter.yaml

Now the error shows it is failing on hourly_energy_offpeak but if i remove this it will fail on the next line and so on.

Running HASS on a docker environment version: core-2021.8.6

Hopefully i have explained it correctly and somebody can help me out.

Remove the first line of your utilitymeter.yaml file, utility_meter: as this is already in your configuration.yaml file, when your write:

utility_meter: !include utilitymeter.yaml
# ^^^^^ already exists. 

The way you have it now the include resolves to:

utility_meter:
  utility_meter:
    hourly_energy_offpeak:
      source: sensor.energy_consumption_tarif_1
      cycle: hourly

Too many utility_meter: s

As well as removing the first line, shift your config to the margin so your utilitymeter.yaml file contents look like this:

hourly_energy_offpeak:
  source: sensor.energy_consumption_tarif_1
  cycle: hourly
hourly_energy_peak:
  source: sensor.energy_consumption_tarif_2
  cycle: hourly
hourly_gas:
  source: sensor.gas_consumption
  cycle: hourly

daily_energy_offpeak:
  source: sensor.energy_consumption_tarif_1
  cycle: daily
daily_energy_peak:
  source: sensor.energy_consumption_tarif_2
  cycle: daily
daily_gas:
  source: sensor.gas_consumption
  cycle: daily

weekly_energy_offpeak:
  source: sensor.energy_consumption_tarif_1
  cycle: weekly
weekly_energy_peak:
  source: sensor.energy_consumption_tarif_2
  cycle: weekly
weekly_gas:
  source: sensor.gas_consumption
  cycle: weekly

monthly_energy_offpeak:
  source: sensor.energy_consumption_tarif_1
  cycle: monthly
monthly_energy_peak:
  source: sensor.energy_consumption_tarif_2
  cycle: monthly
monthly_gas:
  source: sensor.gas_consumption
  cycle: monthly

yearly_energy_offpeak:
  source: sensor.energy_consumption_tarif_1
  cycle: yearly
yearly_energy_peak:
  source: sensor.energy_consumption_tarif_2
  cycle: yearly
yearly_gas:
  source: sensor.gas_consumption
  cycle: yearly

serious i will never forget this mistake :slight_smile:
didn’t know it worked that way, so simple afterwards and was messing with it for hours :frowning:

many many thanks!!

1 Like

Hello,

I am trying to implement this, however i would like to have the utility meters in a seperate map/files.

In my configuration.yaml, this works:
utility_meter: !include entities/utilitymeters/energy.yaml

But this, does not work:
utility_meter: !include_dir_named /entities/utilitymeters

I have no idea why, al other includes maps do work with !include_dir_… ?

Hi there,

just for everyone who is also trying and dying:

there are no capital letters allowed in the names of the variables:
so this does work:

  utility_meter:
    hourly_energy_offpeak:
      source: sensor.energy_consumption_tarif_1
      cycle: hourly

but this not:

  utility_meter:
    Hourly_Energy_Offpeak:
      source: sensor.energy_consumption_tarif_1
      cycle: hourly

Maybe I can save someone some time :wink:
Greetings,

Alex

5 Likes

Thank you very very much @axel_schweiss to have taken your time to write about it. I almost spent the whole morning trying to figuring this out!

1 Like

Just here to tell you, you just did :slight_smile:

1 Like

many, many thanks!
I never would have figured it out

I have spent too many hours trying to figure out the issue and the difference between the ones working and those not, thanks!