Closed stast1 closed 4 years ago
same issue here. it seems that during save template is evaluated and then saved in lovelace yaml
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.
The problem was solved by the transition to Lovelace YAML mode
When editing a card in lovelace, the value of the template is saved instead of the template itself.
Click Save and Edit