thomasloven / lovelace-template-entity-row

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

templates are not re-evaluated despite having sensor.time in them #24

Closed akasma74 closed 4 years ago

akasma74 commented 4 years ago

I have the following config

type: entities
title: Motion detectors
show_header_toggle: false
entities:
  - type: custom:template-entity-row
    entity: binary_sensor.pir_1st_floor_landing
    #entity_ids:
    #  - binary_sensor.pir_1st_floor_landing
    #  - sensor.time
    secondary: >
      {% set dt_obj = states.input_datetime.pir_1st_floor_landing %}
      {% set dummy = strptime(states('sensor.time'), '%H:%M') %}
      {% set aware_dt = dummy.fromtimestamp(dt_obj.attributes.timestamp, now().tzinfo) %}
      {{ relative_time(aware_dt) }} ago

and it does not update secondary unless I hit Reload or uncomment entity_ids. HA 0.107.5, template-entity-row 1.1.0

thomasloven commented 4 years ago

That's a problem with the Home Assistant templating engine then. It's not perfect. Use entity_ids.