thomasloven / lovelace-template-entity-row

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

Error when using is_state - Issue with 0.117.b3 #42

Closed BoneheadFraggle closed 3 years ago

BoneheadFraggle commented 3 years ago

The card doesn't show any entities even though the condition criteria is fulfilled. Last known working version: 0.116.3 (or maybe even 0.115.x). No config changes in the cards since then.

In the example below, even though changing the condition from "on" to "off" doesn't make the row visible. When removing the condition, the row shows. Maybe related to the new template evaluation in 0.117?

Card config:

  - active: '{{ is_state("binary_sensor.rorelsesensor_entre_tmpl", "on") }}'
    condition: '{{ is_state("binary_sensor.rorelsesensor_entre_tmpl", "on") }}'
    entity: binary_sensor.rorelsesensor_entre_tmpl
    state: Aktiv
    type: 'custom:template-entity-row'

Log:

2020-10-23 20:31:31 ERROR (MainThread) [frontend.js.latest.202010012] https://mydomain/hacsfiles/lovelace-template-entity-row/template-entity-row.js:1:2531 Uncaught TypeError: i.replace is not a function

Edit: When I changed to:

  - entity: binary_sensor.rorelsesensor_entre_tmpl
    active: '{{ "true" if states[config.entity].state == "on"}}'
    condition: '{{ "true" if states[config.entity].state == "on"}}'
    state: '_(component.binary_sensor.state.motion.{{ states[config.entity].state }})'
    secondary: '{{ as_timestamp(states[config.entity].last_changed) | timestamp_local }}'
    type: 'custom:template-entity-row'

it works fine again. I guess the syntax changed in 0.117.x