Problem with MQTT sensors after splitting configuration

Hello all,

Like the title says im having some trouble with MQTT sensors after i have been splitting the configuration.yaml.
Simultaneously i have tried to format the mqtt sensors to its new formatting.

The entities which would work before splitting are no longer available?

So in the configuration.yaml i have this:

mqtt: !include_dir_merge_list mqtt/

I have added in a directory mqtt in the root folder
In that folder there are different .yaml files for a certain group of mqtt sensors
Content of one of the files:

  sensor:
    - name: "Schuur Temperatuur"
      state_topic: "RFX433/Schuur/"
      unit_of_measurement: "°C"
      value_template: '{{ value_json["Temperature"] }}'
    - name: "Schuur Luchtvochtigheid"
      state_topic: "RFX433/Schuur/"
      unit_of_measurement: "%"
      value_template: "{{ value_json.Humidity }}" 

Sure thing i have missed something during the splitting but i cant seem to find out what.
Other sensors like template sensors are working fine?

I hate to do this but has anyone any ideas? :flushed:

Anything in the logs?
indentation perhaps? In the content you quoted above the “sensor:”-line is already indented with two spaces, not 100% sure but I think that should start in column 1 ?

Armin

Hi Armin,

No only things that are a result of the entities not being there.
Tried to modify the identations but still nothing. :frowning:

Does it pass a check config from the developer tools?

If this is across several files, I’d move the mqtt: in to the files so each file looks correct independently then just use a straight include in configuration.yaml

Hi eightiescalling,

Yes it does pass the check config, which would indicate to be ok.
When i copy the mqtt to the configuration file it self it works instantly?

Problem solved thanks to the discord channel.

Configuration.yaml:

mqtt: 
  sensor: !include_dir_merge_list mqtt/sensors/

mqtt/sensors/sensor.yaml

- name: "Schuur Temperatuur"
  state_topic: "RFX433/Schuur/"
  unit_of_measurement: "°C"
  value_template: '{{ value_json["Temperature"] }}'
- name: "Schuur Luchtvochtigheid"
  state_topic: "RFX433/Schuur/"
  unit_of_measurement: "%"
  value_template: "{{ value_json.Humidity }}" 

For the wizzkids among us seems like i was trying to fill a dictionary with a list and that doesn’t work.
Very big shout out to @Tinkerer

1 Like