All sensors stopped working recently & unavailable Invalid config for [sensor]:

I am having what seems to me to be a unique issue. My sensors stopped working a few days ago and I’m not sure why. I have around 20 Wyze contact sensors and a few Tuya wifi switches that I had setup and working previously. The sensors say unavailable under the entities.

I have Home Assistant installed on a RPI4. I am running HA 0.109.3 with Supervisor 220.

I am getting an error when checking my configuration:

Invalid config for [sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 10).

Here is lines 10-12 in my config which is weird also because the sensor.yaml line is line 11.

scene: !include scenes.yaml
sensor: !include sensor.yaml
frontend: !include frontend.yaml

Here is my sensor.yaml contents:

#Sensors

smartweather:
  - platform: smartweather
    station_id: 20026538
    api_key: 
##################################################  
#Wyze
wyzeapi:
  - platform: wyzeapi
    username: 
    password: 

#logger:
#     default: warning
#      logs:
#        custom_components.wyzeapi: debug
light:
  - platform: wyzeapi
    username: 
    password: 
    
switch:
  - platform: wyzeapi
    username: 
    password: 

#wyzeapi:
#username: !secret wyze_user
#password: !secret 
##################################################  
tuya:
  - platform: tuya
    username: 
    password: 
    country_code: 1
##################################################

weather:
  - platform: darksky
    api_key: 
###################################################

darksky:
  - platform: darksky
    api_key: 
    forecast:
      - 0
    hourly_forecast:
      - 0
      - 1
    monitored_conditions:
      - summary
      - icon
      - temperature
####################################################

I have redacted the user/pass/api info.

It seems like Home Assistant is not seeing my sensors.yaml file at all.

My goal is to get my sensors back up and running and alleviate the invalid config. Any help is much appreciated!

Why do you have lights, switches and other non-senor platforms defined in your sensor.yaml file?

You cant do this:

sensor:
  light:
    - platform: wyzeapi
      username: 
      password: 
1 Like

I’m new to Home Assistant/yaml and that was how I understood to set it up. I do have Wyze bulbs, switches, and contact/motion sensors. I have only gotten HA to recognize the contact/motion sensors. Do I need to do a platform, user, pass for light, switch, etc? What do you mean by non-sensor platform?

What he means is…

In homeassistant you define the platform, and then the type of device you are integrating.

So

sensor:
  - platform: bob

Would set up a sensor for ‘bob’ devices (if such a thing existed). If you owned lights made by Bob, the configuration would be

light:
  - platform: bob

But what you have done is to put

sensor: !include sensor.yaml

(which means “place the contents of the sensor.yaml file here”) and then defined a light in sensor.yaml, meaning that the resulting code when the !include is merged is

sensor:
  light:
    - platform: bob

Which the system can’t understand.

You need to go back to the basics of homeassistant yaml configuration before using includes as you are not using them correctly.

I have Full Snapshots just about weekly so I’ll revert to one of those where the sensors worked for now and do what I can to learn about how to configure this going forward.

1 Like