Error when splitting up my config. Component utility_meter cannot be merged. Expected a dict

Like others I am following @frenck’s example and I am splitting up my config even more than I have done previously.

I’ve made good progress but I’m getting hung up on the config for my utility meters.

In …/integrations/ I have a file called utility_meters.yaml which contains…

utility_meter: !include_dir_list ../entities/utility_meters

To keep troubleshooting simple I cut it down to a single utility meter file config, but multiple also fail.

In …/entities/utility_meters/ I have a file called network_utility_meter_daily.yaml which contains…

network_utility_meter_daily:
source: sensor.network_energy
cycle: daily

When I check my config, I get the following error:

Package utility_meters setup failed. Component utility_meter cannot be merged. Expected a dict.

I’ve tried different indentations, no luck…

network_utility_meter_daily:
  source: sensor.network_energy
  cycle: daily
  network_utility_meter_daily:
  source: sensor.network_energy
  cycle: daily
2 Likes

For a single file:

In configuration.yaml:

utility_meter: !include utility_meters.yaml

In utility_meters.yaml

network_utility_meter_yearly:
  source: sensor.network_energy
  cycle: yearly

network_utility_meter_monthy:
  source: sensor.network_energy
  cycle: monthly

network_utility_meter_daily:
  source: sensor.network_energy
  cycle: daily

etc...

Yea, that is exactly how I previously had it configured (and working), but it fails when I use the approach outlined by @frenck.

Because it isn’t a list, but a named dictionary:

utility_meter: !include_dir_merge_named ../entities/utility_meters

5 Likes

a bit late reaction, but i have the same problem.

i added in configuration.yaml

utility_meter: !include_dir_merge_named entities/utility_meters

then in the one of the files in utility_meters dir looks like this

utility_meter:
daily_gas:
  source: sensor.gas_consumption
  name: Dagelijks gas verbruik
  cycle: daily
monthly_gas:
  source: sensor.gas_consumption
  name: Maandelijks gas verbruik
  cycle: monthly
yearly_gas:
  source: sensor.gas_consumption
  name: Jaarlijks gas verbruik
  cycle: monthly

But when checking the configuration it says there is an error and i can’t figure out what that error is.
tryed different indentations but that doesn’t do it.

I ended up with having a file per utility meter. I actually prefer it that way.

configuration.yaml

default_config:

homeassistant:
  packages: !include_dir_named integrations

…/integrations/utility_meter.yaml

utility_meter: !include_dir_merge_named ../entities/utility_meters

…/entities/utilitiy_meters/office_computer_daily_utility_meter.yaml

office_computer_daily_utility_meter:
  source: sensor.office_computer_energy_meter
  cycle: daily

i don’t get it.
what you did i wan’t it to, a seperate file for gas, electricity, water

what should be in the directory intergrations ?

i solved it, had to delete utility_meter: from the files

1 Like

I have a seperate file per integration in the integration folder. This is not required, just something I did to organize and keep my configurationl.yaml small.