Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity is not reconized in macro for picture-entity #20

Open
jmgiaever opened this issue Sep 30, 2020 · 1 comment
Open

Entity is not reconized in macro for picture-entity #20

jmgiaever opened this issue Sep 30, 2020 · 1 comment

Comments

@jmgiaever
Copy link

This is my yaml (which is included!)

# lovelace_gen
{% macro user_photo(entity, ws) -%}
{{"  "*ws}}- type: picture-entity
{{"  "*ws}}  entity: {{ entity }}
{{"  "*ws}}  image: "/local/img.jpg"
{%- endmacro %}
title: Example
cards:
  - type: vertical-stack
    cards:
      - type: horizontal-stack
        cards:
          {{ user_photo('person.joachim_m_giaever', 3) }}
      - type: glance
        entities: 
          - entity: lock.entrance_door_lock
            name: "Entrance door"
            tap_action: 
              action: toggle
          - entity: binary_sensor.office_door_state
            name: "Office"
          - entity: binary_sensor.bedroom_window_state
            name: "Bedroom window"

The frontend is giving me the error:

Invalid Configuration: 'entity' required
type: picture-entity

I've tested that «the person» exists and tried to look for indentation errors. I'm wondering why I need to set 3xIndent in my method, but when I'm counting, I'll count 5.

I'm using HA 0.115.6. and latest version available of lovelace_gen in HACS.

@lmamakos
Copy link

You can use JSON-style syntax within YAML files to avoid indentation issues like this. See my post https://community.home-assistant.io/t/fun-with-lovelace-gen-and-jinja2-macros-to-avoid-whitespace-indentation-problems/236427 for an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants