Error Splitting Sensor into sensors.yaml

Tried splitting my sensors into a separate yaml file and am getting this error.

Invalid config for [sensor]: required key not provided @ data[‘platform’].
Got None. (See /home/homeassistant/.homeassistant/configuration.yaml, line 114). Please check the docs at https://home-assistant.io/components/sensor/

Configuration yaml looks like…

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
sensor: !include sensors.yaml

Side note, I was having trouble getting mqtt sensors working so I decided to split the sensors and am now getting this error so I am wondering if sensors in general are just not working for whatever reason.

Hassbian version 0.82.0

1 Like

make sure your sensors.yaml doesn’t contain sensor: as the first line, and make sure they are an array of items starting with - nameofsensor:

1 Like

that should be - platform: component name

For example - platform: command_line to use the command line sensor component.

2 Likes

sorry. I was working from bad memory.

Here is a sample of part of mine which works. Pay close attention to the beginning of the file and the indentations.

#######################################
# Plex server
#-|---|---|---|---|---|---|---|---|---|
- platform: plex
  name: Plex
  host: pi1
  username: !secret plex_username
  password: !secret plex_password

#######################################
# System status
#-|---|---|---|---|---|---|---|---|---|
- platform: systemmonitor
  resources:
    - type: disk_use_percent
      arg: /home
    - type: memory_free
    - type: processor_use
    - type: load_15m
    - type: last_boot

- platform: speedtest
  monitored_conditions:
    - ping
    - download
    - upload

Also, keep in mind that sensors and binary_sensors are NOT mixable (have a separate:
sensor: !include sensors.yaml
binary_sensor: !include binary_sensors.yaml

1 Like

This was my problem. Thank you!

Hallo, hier dasselbe Fehler, neulich, nach Umstieg Pi4 (64bit) in Docker. Vorher keine Probleme auf Pi3+ OS. Viele Geräte/Sensoren werden nicht gefunden. Auch Nodered hat ein Problem, da Mqtt-Sensoren fehlen.

Hast du eine Lösung gefunden?