I am embarrassed to be asking this question, having tried for weeks to get things to work. But despite all my reading and trialling I am still failing and get nothing but errors referring to lines in the sensor.yaml file.
This all started around the time when I was attempting to connect a reed switch to a GPIO pin on my Raspberry Pi and interface it to HA (see below reference to ReedSwitch). I had everything in my configuration.yaml file but for some weird reason the reed switch would not show up in HA or even developer tools? So far I’ve had reasonable success in setting up various sensors etc, but this has me stumped?
So here goes my search for help…
In my configuration.yaml I have the obligatory:
sensor: !include sensor.yaml
And in my sensor.yaml file I have the following…
I made the changes and now I receive the following errors…
2021-03-05 14:12:39 ERROR (SyncWorker_0) [homeassistant.util.yaml.loader] mapping values are not allowed here
in "/config/sensor.yaml", line 20, column 11
2021-03-05 14:12:39 ERROR (MainThread) [homeassistant.bootstrap] Failed to parse configuration.yaml: mapping values are not allowed here
in "/config/sensor.yaml", line 20, column 11. Activating safe mode
Binary sensors are a different integration from sensors, that was why they couldn’t be in your sensors file. To add the binary sensor just add it to your configuration.yaml like this:
Wait, is it actually a binary sensor or is it a switch? I’m looking at the doc for rpi_gpio and it looks like the integration supports the binary_sensor, cover and switch platforms. I had assumed it was binary sensor based on what you put up top but I’m realizing the name says switch.
The configuration looks correct for a binary sensor based on the doc. But if you’re expecting a switch then that’s a different platform, you need to drop that configuration under switch: in your configuration.yaml.
Otherwise not sure since the config looks correct. But it also depends on an external device so it may not be a config problem. I’m not really familiar with that particular integration so may be better off with a separate post in that case.
I think I solved it… but dont know how? It suddenly decided to show up in the Developer Tools. I’ll do some more testing and see what happens. Thanks again for the help Mike.