Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 105584

Simple YAML syntax question: includes, indentation

$
0
0

This seems simple but I can’t figure out the magic spacing (or something).

I have this sort of card repeated throughout many dashboards (now in yaml files not storage):

  - type: grid
    cards:
      - type: custom:auto-entities
        card:
          type: entities
          title: Cameras
        filter:
          include:
            - device: BlueIris*
          exclude:
            - entity_id: '*update'
            - entity_id: '*signal*'
            - entity_id: '*ble_strength*'
            - entity_id: '*rebooted'
            - entity_id: '*reboot'
            - entity_id: '*battery_level'
            - entity_id: '*last_seen'
            - domain: automation
            - hidden_by: user
            - hidden_by: integration
        sort:
          method: name
          ignore_case: true
        grid_options:
          columns: full

I wanted to take the excludes and put them in a file, so I created this file (ui-common-excludes.yaml):

- entity_id: '*update'
- entity_id: '*signal*'
- entity_id: '*ble_strength*'
- entity_id: '*rebooted'
- entity_id: '*reboot'
- entity_id: '*battery_level'
- entity_id: '*last_seen'
- domain: automation
- hidden_by: user
- hidden_by: integration

The hyphens are in the first column. Then I did this:

  - type: grid
    cards:
      - type: custom:auto-entities
        card:
          type: entities
          title: Cameras
        filter:
          include:
            - device: BlueIris*
          exclude: !include ui-common-excludes.yaml
        sort:
          method: name
          ignore_case: true
        grid_options:
          columns: full

And that all works fine. But suppose I also want to exclude something additional in one only, e.g. maybe a “domain: light”. I can’t seem to find a place to put it, e.g.

  - type: grid
    cards:
      - type: custom:auto-entities
        card:
          type: entities
          title: Cameras
        filter:
          include:
            - device: BlueIris*
          exclude: !include ui-common-excludes.yaml
            - domain: light 
        sort:
          method: name
          ignore_case: true
        grid_options:
          columns: full

All variations of these complain about bad indentation. I’ve tried repositioning the include on the next line, changing indentation in the file, no luck so far.

Is there some way I can see the actual resulting yaml after doing the include, so I can judge what’s wrong with it?

And/or is there a way to do what I’m trying?

Linwood

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 105584

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>