iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
441 stars 56 forks source link

States don't automatically update in the UI, refresh required #21

Closed BeerDiet closed 4 years ago

BeerDiet commented 4 years ago

Checklist:

Release with the issue: 1.1.1

Last working release (if known):

Browser and Operating System: Chrome (79.0.3945.130 (Official Build) (64-bit)) / Windows 10

Description of problem: Using the below config, I am able to adjust the slider and change the light without any issue, however the brightness is not updated in the UI. If the light is off, and I slide the slider halfway, the light will come on at 50%, the UI still says "Off." On refresh, it'll correctly report 50%. This is one of many examples -- state doesn't update on entities wrapped in the config-template-card.

      - type: "custom:config-template-card" 
        entities:
          - sensor.master_bedroom
        card:
          type: "custom:hui-entities-card"
          title: "Ken"
          show_header_toggle: false
          entities:     
          - type: custom:slider-entity-row
            entity: light.bedroom
            name: Lights

Doing the same thing with the below config works fine (unwrapping from config-template-card) -- the state is updated immediately after I change the position of the slider, without requiring a refresh.

        - type: "custom:hui-entities-card"
          title: "Ken"
          show_header_toggle: false
          entities:     
          - type: custom:slider-entity-row
            entity: light.bedroom
            name: Lights
iantrich commented 4 years ago

You're only watching for charges to light.master_bedroom with that config

BeerDiet commented 4 years ago

@iantrich Oh man, completely missed that one. Thanks.

anto86na commented 1 year ago
      - type: custom:config-template-card
        style:
          top: 50%
          left: 50%
          width: 100%
          mix-blend-mode: lighten
          opacity: >-
            ${states['light.luce_ripostiglio'].state === 'on' ?
            (states['light.luce_ripostiglio'].attributes.brightness
            / 255) : '0'}
        entities:
          - light.luce_ripostiglio
        element:
          type: image
          tap_action:
            action: none
          entity: light.luce_ripostiglio
          image: /local/casa/final/ripostiglio.png

this is my template card, i get update if i turn off the light, but if turn on to get update i need refesh of browser

ildar170975 commented 1 year ago

Rule # 1: simplify your code if any issues are observed. The CTC card DOES work. Check your template & CSS styles. ctc