Hello all, here again.
In my configuration.yaml I have several sensor that I would like to keep there, but I would like to add others from another file.
My mqtt section looks like:
mqtt:
sensor:
- name: firstone
state_topic: "homeassistant/sensor/firstone/state"
unit_of_measurement: "W"
unique_id: watt_firstone
device_class: power
- name: secondone
state_topic: "homeassistant/secondone/temperature"
unit_of_measurement: "°C"
device_class: temperature
unique_id: temp_secondone
and so on.
I have created a file that I would like to include.
The file is called “otherfile.yaml” whose content is:
- name: thirdone
state_topic: "homeassistant/sensor/firstone/state"
unit_of_measurement: "W"
unique_id: hum_thirdone
device_class: humidity
- name: fourthone
state_topic: "homeassistant/sensor/fourthone/state"
unit_of_measurement: "kWh"
unique_id: energy_fourthone
device_class: energy
I have tried in many way to add an include for it but so far without success.
I have tried :
mqtt:
sensor:
- name: firstone
state_topic: "homeassistant/sensor/firstone/state"
unit_of_measurement: "W"
unique_id: watt_firstone
device_class: power
- name: secondone
state_topic: "homeassistant/secondone/temperature"
unit_of_measurement: "°C"
device_class: temperature
unique_id: temp_secondone
- !include otherfile.yaml
or
...
...
unique_id: temp_secondone
!include otherfile.yaml
or several combination, but I can’t make it works.
I get errors from:
Invalid config for ‘mqtt’ at configuration.yaml, line 43: expected dict ‘mqtt->0->sensor->0’, got None
to
Error loading /config/configuration.yaml: mapping values are not allowed here in “/config/configuration.yaml”, line 52, column 11
if I remove the dash.
How I’m supposed to make this working ?
Please, if you don’t mind, let’s stay on this. I’m not willing to modify all sensors in a dir or the like, at the moment.
Thanks in advance
Pierluigi