Can not include utility_meter in dir

Hello,

I am trying to implement the utility_meter function to calculate energy and gas.
This is the code:

---
###### DSMR METER READINGS ######
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

When I put it in the configuration.yaml it all works.

When I put in as an include like this:

utility_meter: !include entities/utilitymeters/energy.yaml

It works.

When I do this:

utility_meter: !include_dir_named /entities/utilitymeters  (with the file energy.yaml in it)

It does not work…

How can I include utility_meter in a folder where I can put files in. So i do not need to place all the utility_meter settings in the main configuration.yaml?

You want include_dir_merge_list, I think

I tried both, but then the entities in the file are “not available”. Its like he ignores the files in the folder.

Seems it had to be utility_meter: !include_dir_MERGE_named /entities/utilitymeters

It works now :slight_smile:

1 Like