thomasloven / lovelace-template-entity-row

🔹 Display whatever you want in an entities card row.
MIT License
210 stars 16 forks source link

Error saving card in lovelace #14

Closed stast1 closed 4 years ago

stast1 commented 4 years ago

When editing a card in lovelace, the value of the template is saved instead of the template itself.

image

Click Save and Edit

image

image

jacekpaszkowski commented 4 years ago

same issue here. it seems that during save template is evaluated and then saved in lovelace yaml

basnijholt commented 4 years ago

I have the exact same:

type: entities
entities:
  - entity: binary_sensor.dishwasher
    name: Dishwasher
    secondary: >
      {% set on_for = as_timestamp(now()) - as_timestamp(states('input_datetime.dishwasher_started')) %}
      {% set off_for = as_timestamp(now()) - as_timestamp(states('input_datetime.dishwasher_done')) %}
      {% if states('binary_sensor.dishwasher') == 'on' %}
        Has been on for {{ (on_for / 60)|round(0) }} minutes.
      {% else %}
        Has been off for {{ (off_for / 3600)|round(1) }} hours.
      {% endif %}
    state: >
      {% if is_state('binary_sensor.dishwasher', 'on') %}
        {{ states('sensor.dishwasher_watts') }} Watt
      {% else %}
        Off
      {% endif %}
    type: custom:template-entity-row

turns into

type: entities
entities:
  - entity: binary_sensor.dishwasher
    name: Dishwasher
    secondary: Has been off for 22.4 hours.
    state: 'Off'
    type: 'custom:template-entity-row'

I have HA 0.105.2 and template-entity-row at https://github.com/thomasloven/lovelace-template-entity-row/commit/81bf4990aaa4536a096dfd53023e0d3469942899.

stast1 commented 4 years ago

The problem was solved by the transition to Lovelace YAML mode