Configuration.yalm and !include

Hi folks,

my question is…

Is it possible to use more than one !include inclusion of sensors or similar and having a sensor:section in the configuration.yaml

Example:

sensor: !include mqtt_sensors.yaml
sensor: !include garden_sensors.yaml

sensor:
  - platform: history_stats
    name: "Solarpump Day"
    entity_id: switch.solarpump
    state: "on"
    type: time
    start: "{{ today_at('00:00') }}"
    end: "{{ now() }}"

Yes, but you can’t repeat sensor: like that

sensor: !include mqtt_sensors.yaml
sensor garden: !include garden_sensors.yaml

sensor other_word_here:
  - platform: history_stats
    name: "Solarpump Day"
    entity_id: switch.solarpump
    state: "on"
    type: time
    start: "{{ today_at('00:00') }}"
    end: "{{ now() }}"

will work

2 Likes

Try this:

sensor mqtt: !include mqtt_sensors.yaml
sensor garden: !include garden_sensors.yaml

sensor:
  - platform: history_stats
    name: "Solarpump Day"
    entity_id: switch.solarpump
    state: "on"
    type: time
    start: "{{ today_at('00:00') }}"
    end: "{{ now() }}"
1 Like

There is a similar example (but using lights) in the documents:

1 Like

What about the mqtt: tag.

mqtt:
  sensor:
    ....
  binary_sensor:
    ....

…and the HA function to reload manually configured mqtt entities?
Are there any limitations to be expected?

I’d look a using packages instead. They merge together very nicely.

Create a packages subfolder, then put this into configuration.yaml


homeassistant:
  customize: !include customize.yaml
  packages: !include_dir_named packages

Same applies there, you can’t repeat mqtt: or sensor: (etc)

…and what do I have to put into this subfolder?