dwainscheeren / dwains-lovelace-dashboard

An fully auto generating Home Assistant UI dashboard for desktop, tablet and mobile by Dwains for desktop, tablet, mobile
Other
1.77k stars 188 forks source link

more_page invalid key error when using parsed data #290

Closed bulburDE closed 3 years ago

bulburDE commented 3 years ago

I can't get it working to parse data from the more_page.yaml into the page.yaml. In the documentation the option is described but I couldn't find any examples specifically for the more_page.

This is my more_page.yaml:

# https://dwainscheeren.github.io/dwains-lovelace-dashboard/configuration/more_page.html

more_page:
  addons:
    - name: System Stats
      icon: mdi:chart-bar
      path: 'dwains-dashboard/addons/more_page/system_stats/page.yaml'
      data:
        name: Test

This is dwains-dashboard/addons/more_page/system_stats/page.yaml:

- type: custom:dwains-flexbox-card
  items_classes: 'col-xs-12 col-sm-6 col-sm-6'
  cards:
    - type: entities
      entities:
        - entity: sensor.glances_ha_cpu_used
          group: true
          name: {{ name }}

When I reload the theme I get the following error message:

2021-05-03 22:54:54 ERROR (SyncWorker_10) [custom_components.dwains_dashboard.process_yaml] invalid key: "OrderedDict([('name', None)])"
in "/config/dwains-dashboard/addons/more_page/system_stats/page.yaml", line 8, column 0
AalianKhan commented 3 years ago

Hey, Since you are pulling information from the data tag, I think you will have to configure it like this

- type: custom:dwains-flexbox-card
  items_classes: 'col-xs-12 col-sm-6 col-sm-6'
  cards:
    - type: entities
      entities:
        - entity: sensor.glances_ha_cpu_used
          group: true
          name: {{ (data | fromjson)['name'] }}

Hope this helps

dwainscheeren commented 3 years ago

Also add # dwains_dashboardto the first line of page.yaml

bulburDE commented 3 years ago

@AalianKhan thanks, that's the right syntax for getting information from data. I've tried a lot, but couldn't get any since I was missing the first line @dwainscheeren mentioned.

I've looked for it in the addons repo and it's missing in most addons. A hint in the documentation would be helpful, but I think more significant is the absence of the examples that are referenced in the documentation. All examples that are referenced there are missing, e.g. dwains-dashboard/addons/rooms/hello-room, dwains-dashboard/addons/more_page/statistics/, dwains-dashboard/addons/persons/hello-person/ So when starting I just picked a random one to build up from but that was missing the first line.