#what exactly are config.yaml top-level entries?

23 messages · Page 1 of 1 (latest)

clever abyss
#

Hi all, I'm experimenting with the rest integration and I'm a little confused by some of the documentation. Most of the examples in doc docs look like this, with sensor as the top-level key:

sensor:
  - platform: rest
    resource: http://IP_ADDRESS/ENDPOINT

But then, there's one that looks like this, with rest as the top-level entry:

rest:
  - resource: "http://date.jsontest.com/"
    sensor:
      - name: "Time"
        value_template: "{{ value_json.time }}"
      - name: "Date"
        value_template: "{{ value_json.date }}"

I feel like there's a type hierarchy here that I'm not quite fully understanding.

On the main page for the RESTful integration it also says:

RESTful Sensor and RESTful Binary Sensor can also be set up as platforms if there is only a single sensor per endpoint.
which makes me more confident that I'm missing some important nuance in the type system here.

What exactly is going on here?

cloud dirge
#

You're not really missing anything. Those are just integrations that are set up in YAML

#

Focus on the documentation for what you want to do and it will tell you how to configure it

clever abyss
#

But can you help my understand what the difference is?

cloud dirge
#

Between what and what?

#

sensor: is an integration, rest: is an integration

#

You can create some sensors via platform: tags (which correspond to other integrations) and some are defined under their own top-level tag (like rest:)

#

You quoted the difference for rest in your message

clever abyss
#

I think I'm stuck on rest being the name for both a platform and an integration.
Maybe what's missing is a deeper understanding of the destinction?

cloud dirge
#

In general, HA is moving away from platform variants

#

I don't know

#

Platforms are integrations

clever abyss
#

Because when I specify rest: I don't tell it anything about a platform. Or is sensor the platform in that case?

cloud dirge
#

Using the platform: syntax is slowly going away

#

In favor of the top-level integration tags

clever abyss
#

Platforms are integrations
I want to bang my head against something. We have just found the crux of my confusion.

cloud dirge
#

Template sensors, for instance, can be written in both forms

#

As can rest sensors, as you've noticed

clever abyss
#

This is why I was saying I felt like there was some nuance I was missing. I felt like I had a reasonable handle on part of the HA type hierarchy but how platforms and integrations relate to each other was eluding me and the docs weren't realyl helping because they tried to define everything via example.

#

Need more Zen of Python in HA...that said, I can't complain if I'm not submitting PRs.

#

Ok, I can't say that my confusion has been completely resolved, but you've been really helpful in getting me past my hang-up and back to actually enjoying my Friday evening playing with HA. Thank you for that

cloud dirge
#

Using platforms is older and generally lacks functionality compared to the top-level integration tags

#

But not everything has migrated