custom-cards / secondaryinfo-entity-row

Custom entity row for HomeAssistant, providing additional types of data to be displayed in the secondary info area of the Lovelace Entities card
172 stars 15 forks source link

Secondary info does not appear immediately #30

Open queimadus opened 4 years ago

queimadus commented 4 years ago

This seems to coincide with the home assistant 0.110 update (currently on 0.110.4). It takes a few ticks to _updateElement for the information to update.

Screen Recording 2020-05-31 at 12 27 27 mov

Error details:

secondaryinfo-entity-row.js:39 Uncaught (in promise) TypeError: Cannot read property 'shadowRoot' of null
    at HTMLElement._updateElement (secondaryinfo-entity-row.js:39)
Screenshot 2020-05-31 at 12 10 30
cstotts commented 4 years ago

I get the following error in my frontend until I reload at least once.

It also shows this on my mobile device.

r.setConfig is not a function entity: lock.front_door name: Front Door secondary_info: >- <b style="[[ if(lock.front_door.state == "locked","color:green","color:red") ]]">[[ {entity}.attributes.lock_status ]]</b> type: 'custom:secondaryinfo-entity-row'

I'm wondering if this is the same issue or not...

Ndrinta commented 4 years ago

Same here!

r.setConfig is not a function bla bla bla...

Takes a few seconds to get the value. To be fair it's a tricky one because the secondary_info entity it's a template sensor getting his state from another history_stat sensor. Fair enough that takes a sec to update but the real problem for me it's the error! It's unbearable. A giant red square in the middle of you home...

Card

entities:
  - entity: climate.furnace
    hold_action:
      action: more-info
    secondary_info: 'Active for [[ sensor.furnace_on_time ]] '
    tap_action:
      action: navigate
      navigation_path: /lovelace/furnace
    type: 'custom:secondaryinfo-entity-row'
    state_color: true
type: entities

Sensors

  - platform: history_stats
    name: Furnace ON time raw
    entity_id: sensor.furnace_operation_mode
    state: 'Heating'
    type: time
    start: '{{ now().replace(hour=0).replace(minute=0).replace(second=0) }}'
    duration:
      hours: 24

  - platform: template
    sensors:
      furnace_on_time:
        friendly_name: Furnace ON time
        value_template: >-
          {{ state_attr('sensor.furnace_on_time_raw', 'value') }}

Happy to share more if can help!

dfigus commented 4 years ago

Any idea what's the issue here? The error Cannot read property 'shadowRoot' of null is still here and in case it occurs the card stays empty (not just missing secondary info). Sometimes it takes a couple of reloads until it's correctly displayed.

snakuzzo commented 4 years ago

Have you updated card-tools to latest version (11) ?

dfigus commented 4 years ago

Yes, I'm currently running the latest version 11 (reported as 2.1.2 in the console). The error did also occur with the previous version. Sometimes the result of this._wrappedElement.shadowRoot.querySelector("hui-generic-entity-row") is null and the chained usage of shadowRoot.querySelector(".secondary") fails. I also tried to dig into this by myself, but without luck as I'm not a JS developer.

snakuzzo commented 4 years ago

I confirm....card is working, but I have this error on Chrome console...

image

and details...

image