thomasloven / hass-lovelace_gen

🔹 Improve the lovelace yaml parser for Home Assistant
MIT License
218 stars 22 forks source link

Entity state in if condidtion #15

Closed o0shojo0o closed 4 years ago

o0shojo0o commented 4 years ago

Hi, it is possible to process the state of the passed entity in the if condidtion?

Here for example:

# lovelace_gen
card: picture-elements
noPadding: true
cardOptions:
  image: /local/images/blank_placeholder.png
  elements:
{% if states(entity) < 9 %}
    - type: state-icon
      entity: {{entity}}
      style:
        top: 10%
        left: 10%
    - type: state-label
      entity: {{entity}}
      style:
        top: 50%
        left: 50%
        font-size: 60px
        font-weight: bold
{% else %}
    - type: state-icon
      entity: {{entity}}
      style:
        top: 32%
        left: 32%
        transform: scale(3,3)
    - type: state-label
      entity: {{entity}}
      style:
        top: 10%
        left: 10%
{% endif %}
thomasloven commented 4 years ago

No. Lovelace_gen generates a static configuration that optimally never changes again, so that would be confusing.

o0shojo0o commented 4 years ago

Thanks for the explanation!