If someone can help me out I’ll help update the documentation, cause really one shouldn’t use two different examples to try demonstrate a feature. I’m talking about this page: https://www.home-assistant.io/docs/configuration/devices/
Where style 1 talks about something completely different than style 2… That’s poor, should explain the same devices in the two different forms.
Thank you, you are of course correct in the formatting part. It did look right when I created the post and I did try the block quote but once I submitted it didn’t come through. I shall try again:
Well it seems you didn’t understand my post possibly english is not your first language, not sure. I would very much like to edit that page if I understood the formatting better. That was my original question. My block quote did not come through the first time so it was a little hard to read but the gist of the question was not about indentation.
Hi all, I think I’ve pretty much answered this. It seems all examples I’ve looked at do not use Style 2 as laid out in the docs, at least for such things as sensors, binary_sensors, switches etc.
I still think the docs need touching as it’s confusing especially for new people, which lets face it, that is mostly who the documentation is aimed at, because if you understand it, well, you don’t require documentation:-)
I’m still interested in an answer if someone cares.
Thanks
where UNIQUE_VALUE is some unique (to binary_sensor’s) number or string.
As you mentioned, style 2 isn’t very popular (at least as far as I know.) I suspect it’s mostly there for legacy reasons, but that’s just a guess because I’ve only been using HA for about a half year.
No. “Style 1” starts with a key which is a “domain” name, like binary_sensor. “Style 2” starts with a key which is a “domain” name, plus whitespace, plus a unique string or number. I think it will be clearer if you see the two different styles for defining two entities of the same domain.
In Style 1 there is one top-level config key, which contains a list of two entity definitions. In Style 2, there are two top-level config keys, each defining one entity.
Your example of three entities, each in a different domain, but all using the same platform, would look like this in Style 2:
I actually see no advantage to Style 2 here (or really anywhere.) Even when using Packages, which I believe is much more common, I don’t see it being used.
Yes right, now when I go back and look, the doc page does make sense, it’s too bad the person that wrote it didn’t use the same example for both styles. I was under the impression that media_player was a platform, however, now that I look at it again, I see more clearly. Funny how the brain works.
So if we were to update the documentation it would look like so: