thomasloven / lovelace-template-entity-row

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

condition option does not work until reload #23

Closed akasma74 closed 4 years ago

akasma74 commented 4 years ago

HA: 0.106.6 This component: 1.1.0 Browser: Safari, Chrome OS X 10.11.6

This simple config does not hide input_number regardless of the automation's state. It only changes when I reload the page in my browser. A commented string makes it work but it's not ideal.

type: entities
entities:
  - entity: automation.ventilation_1st_floor_bathroom_extractor_fan_turn_on_by_humdity_gradient
    name: by humidity gradient

  - type: custom:template-entity-row
    entity: input_number.ventilation_1st_floor_bathroom_shower_humidity_threshold
    #entity_ids: automation.ventilation_1st_floor_bathroom_extractor_fan_turn_on_by_humdity_gradient
    condition: "{{ is_state('automation.ventilation_1st_floor_bathroom_extractor_fan_turn_on_by_humdity_gradient', 'on') }}"
thomasloven commented 4 years ago

Your commented row is the solution. The template engine (which is part of Home Assistant and nothing I can change) fails to extract the correct entity to monitor for state changes from your template for some reason. The solution when that happens is to specify it manually,

akasma74 commented 4 years ago

Thanks for confirming. Again - shouldn't it be reflected in the description somehow? And do you remember changing something in the component in a similar situation - what is the diffrence, could you explain?

thomasloven commented 4 years ago

The fix then was to make it use entity: as if it was entity_ids if entity_ids was not supplied. That made it work better with config.entity in the templates.

akasma74 commented 4 years ago

Yes, clearly a different issue. Thanks for the info.

So basically entity_ids is the same as entity in template_sensor? I still believe it's vital to add this information to the card's description ;)

thomasloven commented 4 years ago

Yes, I'll add it. I left it out at first to see necessary it was.