Include.yaml not work

There are many questions and i found a lot of them. But why it is not working in my case,…

In my confi.yaml I have this:

scrape: !include scrape.yaml

In my scrape.yaml i have this:

- platform: scrape
    name: ROVA ophaal moment
    resource: http://afvalkalender.rova.nl/nl/8051BB/5
    select: ".firstDate"
    scan_interval: 43200
        
- platform: scrape
    name: ROVA ophaal type
    resource: http://afvalkalender.rova.nl/nl/8051DP/30
    select: ".firstWasteType"
    scan_interval: 43200```


Wy or what I am doiong wrong,..?
(If I copy/ paste the scrape to my confo.yaml the scrape is working,...)

These are sensors using the scrape platform, they should be in sensors.yaml

sensor: !include sensors.yaml

sensors.yaml:

- platform: scrape
    name: ROVA ophaal moment
    resource: http://afvalkalender.rova.nl/nl/8051BB/5
    select: ".firstDate"
    scan_interval: 43200
        
- platform: scrape
    name: ROVA ophaal type
    resource: http://afvalkalender.rova.nl/nl/8051DP/30
    select: ".firstWasteType"
    scan_interval: 43200

If you want to have multiple sensors files - you could do it this way:

sensor: !include_dir_merge_list sensors/

and then have your sensors in a directory called sensors:
/config/sensors/scrape.yaml

- platform: scrape
    name: ROVA ophaal moment
    resource: http://afvalkalender.rova.nl/nl/8051BB/5
    select: ".firstDate"
    scan_interval: 43200
        
- platform: scrape
    name: ROVA ophaal type
    resource: http://afvalkalender.rova.nl/nl/8051DP/30
    select: ".firstWasteType"
    scan_interval: 43200
1 Like

One more thing: the YAML indentation is incorrect. The options should be vertically aligned.

- platform: scrape
  name: ROVA ophaal moment
  resource: http://afvalkalender.rova.nl/nl/8051BB/5
  select: ".firstDate"
  scan_interval: 43200
        
- platform: scrape
  name: ROVA ophaal type
  resource: http://afvalkalender.rova.nl/nl/8051DP/30
  select: ".firstWasteType"
  scan_interval: 43200
1 Like

Thanks a lot!!
It works. i have to copy all of the sensors to the sensor.yaml.

But somehow the scrape is not working yet,…