this post was submitted on 01 Nov 2024
10 points (100.0% liked)
homeassistant
12051 readers
41 users here now
Home Assistant is open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server. Available for free at home-assistant.io
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Try it without "template:" like
binary_sensor:
Thanks for the suggestion, @NeoNachtwaechter.
But doing that makes configuration.yaml invalid:
Give us the plain English of what you think this is supposed to do first 😉
Your error suggests a yaml formatting issue.
If any of these 4 things happen, set the sensor to "Detected", otherwise set it to "Not Detected":
As I said, this is working correctly in the template editor. The problem is that I can't make a sensor out of it.
Okay, but the post being responded to threw an error that certainly seems like a yaml formatting error.
If you simply deleted the "template" portion, and then changed the "binary_sensor" line without correcting the spacing in the lines after that, you'd get this error. Yaml is strict about leading spaces.
What I did was de-indent the
binary_sensor
section so it was at the same heirarchy as thetemplate
section, like this:But I realize now that I have to remove the hypen before "binary_sensor". When I do, I Studio Code Server still shows a couple errors:
It says I'm missing the "entities" and "platform" properties, and that "state" is not an allowed property.
Move everything back two spaces. You may need a yaml linter. Your problem is just the format from what I'm seeing.
I think Studio Code Server is a linter. It's telling me what the syntax problems are - I just don't know how to fix them. Now that I removed the hypehn, it's not telling me there are any spacing/formatting issues. But it currently says I'm missing the "entities" and "platform" properties, but I don't know what the values should be. And It also says "state" is not an allowed property, but that's the property that holds all the important stuff about this sensor - so how can I remove it?