hass-lovelace_gen icon indicating copy to clipboard operation
hass-lovelace_gen copied to clipboard

Entity is not reconized in macro for picture-entity

Open jmgiaever opened this issue 5 years ago • 1 comments
trafficstars

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.

jmgiaever avatar Sep 30 '20 12:09 jmgiaever

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.

lmamakos avatar Jul 23 '21 15:07 lmamakos