Why configuration.yaml does not find splited yaml file?

This is my configuration.yaml file:

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  # latitude:
  # longitude:

  # C for Celcius, F for Fahrenheit
  temperature_unit: C
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: EST

# Show links to resources in log and frontend
introduction:

# View all events in a logbook
logbook:

# Track the sun
sun:

# Enables support for tracking state changes over time.
history:

# Checks for available updates
updater:

# Allows you to issue voice commands from the frontend
conversation:

# Enables the frontend
frontend:

# Enables configuration UI
config:

# Discover some devices automatically
discovery:

#http:
#  api_password: yourPasswordHere

mqtt:
  broker: 127.0.0.1
  port: 1883
  client_id: home-assistant-1
  keepalive: 60



binary_sensor1: !include binary_sensor1.yaml # new key



sensor 1:
  - platform: mqtt
    state_topic: "/house/temp1"
    unit_of_measurement: "°C"
    name: "Temperature"



switch 1:
  platform: mqtt
  name: "Outlet 1"
  state_topic: "/house/light1confirm"
  command_topic: "/house/light1"
  payload_on: "1"
  payload_off: "0"
  qos: 0
  retain: true



group:
  Home Sensors:
   - binary_sensor.door_sensor
   - sensor.temperature
   - switch.outlet_1

Trying to split the “binary_sensor1.yaml” file from configuration.yaml, but it is not deteting it. The file is in the same file directory.

My file directory is:
home/pi/.homeassistant/configuration.yaml

Here is content of “binary_sensor1.yaml”

binary_sensor1:
  platform: mqtt
  state_topic: "/house/door1"
  name: "Door Sensor"
  qos: 0
  payload_on: "1"
  payload_off: "0"

Error is:

2018-12-12 00:07:05 INFO (MainThread) [homeassistant.components.http.view] Serving /auth/token to 192.168.x.x (auth: False)
2018-12-12 00:07:06 INFO (MainThread) [homeassistant.components.http.view] Serving /api/config/core/check_config to 192.168.x.x (auth: True)
2018-12-12 00:07:06 ERROR (Thread-2) [homeassistant.loader] Unable to find component binary_sensor1
2018-12-12 00:07:16 INFO (MainThread) [homeassistant.components.http.view] Serving /api/config/core/check_config to 192.168.x.x (auth: True)
2018-12-12 00:07:17 ERROR (Thread-5) [homeassistant.loader] Unable to find component binary_sensor1
2018-12-12 00:07:18 INFO (MainThread) [homeassistant.components.http.view] Serving /api/config/core/check_config to 192.168.x.x (auth: True)
2018-12-12 00:07:18 ERROR (Thread-4) [homeassistant.loader] Unable to find component binary_sensor1

homeassistant page image:

Need help!

binary_sensor1 is not a component. Plain and simple.
Try this:
binary_sensor: !include binary_sensor1.yaml

and in the binary_sensor1.yaml:

- platform: mqtt
  state_topic: "/house/door1"
  name: "Door Sensor"
  qos: 0
  payload_on: "1"
  payload_off: "0"

May I know why a Hyphen is needed?

Can’t I simply write as below?

binary_sensor1:
  platform: mqtt
  state_topic: "/house/door1"
  name: "Door Sensor"
  qos: 0
  payload_on: "1"
  payload_off: "0"

You’re splitting binary_sensor into a file that contains an array of objects.

You cannot just decide to name a component binary_sensor1. You must use the COMPONENTS that are available to you.

Please read the documentation.

No it didn’t worked still getting the same error tried 3 times also changed the name from “binary_sensor1” to “sensor1” but still getting same error cannot find the file.
Any suggestions?

The reason it fails and that you need a hyphen is because that’s the way HA and the binary sensor component work.

To explain:

In your configuration.yaml file, if you want to add a component called binary _sensor you would write it like this:

homeassistant:
  etc
  etc
  etc.

binary_sensor:
  - platform: mqtt
    state_topic: "/house/door1"
    name: "Door Sensor"
    qos: 0
    payload_on: "1"
    payload_off: "0"
  - platform: whatever
    configuration_whatever
    etc
    etc
  - platform: etc

When you split the config you still need to follow the naming convention of HA and the component you want to use. In HA you can only use defined components - binary_sensor is a defined component, binary_sensor1 isn’t. HA won’t know what to do with it. So you get the error.

To PROPERLY split your config you need to write your configuration.yaml like this:

homeassistant:
  etc
  etc
  etc.

binary_sensor: !include binary_sensor1.yaml  #<-- this is a file name not a component

then in the file called “binary_sensor1.yaml” you put the following that is then split away from the main configuration.yaml file and included just as if it was wriitten in line at the point of the !include statement:

- platform: mqtt
  state_topic: "/house/door1"
  name: "Door Sensor"
  qos: 0
  payload_on: "1"
  payload_off: "0"
- platform: whatever
  configuration_whatever
  etc
  etc
- platform: etc

if you put “binary_sensor1:” on the top line of that file it is exactly like writing this in your configuration.yaml file:

binary_sensor:
binary_sensor1:
  - platform: mqtt
    state_topic: "/house/door1"
    name: "Door Sensor"
    qos: 0
    payload_on: "1"
    payload_off: "0"
  - platform: whatever
    configuration_whatever
    etc
    etc
  - platform: etc

Obviously that would give you an error. And it does.

Why?

Why would you do that?

binary_sensor1 and sensor1 are not valid components. PLEASE READ THE DOCUMENTATION.

Thanks, it worked!