iantrich / config-template-card

📝 Templatable Lovelace Configurations
MIT License
425 stars 55 forks source link

Dashboard wide variable disappears in Companion app when properly running in Firefox / MacOS #136

Closed kcofoni closed 9 months ago

kcofoni commented 9 months ago

Checklist:

Release with the issue: 1.3.6

Last working release (if known): unknown

Browser and Operating System: Companion app and iOS 17

Description of problem: When a card use a dashboard wide variable, it greatly works on my mac with Firefox but this card does not appear any more on my iphone with companion. My dashboard is a grid layer. If I replace this global variable (defined as config_template_card_vars in my dashboard) by a local one (in a "variables section"defined in each card), no more issue.

Javascript errors shown in the web inspector (if applicable): none

Additional information:

ildar170975 commented 9 months ago

Add some MINIMAL code. Create a global var based on “sun.sun” and try using it.

kcofoni commented 9 months ago

I. The one that works perfectly everywhere

type: custom:config-template-card
variables:
  BONJOUR_LOCAL: new String('Bonjour !')
entities:
  - sun.sun
card:
  type: entities
  title: ${BONJOUR_LOCAL}
  entities:
    - sun.sun

This card works perfectly within desktop/firefox/macOS and iOS/companion image

II. The one that does not appear on my iOS/companion

config_template_card_vars:
  BONJOUR: new String('Hello !')
views:
...
type: custom:config-template-card
entities:
  - sun.sun
card:
  type: entities
  title: ${BONJOUR}
  entities:
    - sun.sun

This card works perfectly within desktop/firefox/macOS but is not displayed within Companion on my iPhone image

Hope this helps :smile:

ildar170975 commented 9 months ago

Do not see any issues here.

config_template_card_vars:
  BONJOUR_GLOBAL: new String('Good bye !')
...
title: test-0
path: test-0
cards:

  - type: custom:config-template-card
    variables:
      BONJOUR_LOCAL: new String('Bonjour !')
    entities:
      - sun.sun
    card:
      type: entities
      title: ${BONJOUR_LOCAL}
      entities:
        - sun.sun

  - type: custom:config-template-card
    entities:
      - sun.sun
    card:
      type: entities
      title: ${BONJOUR_GLOBAL}
      entities:
        - sun.sun

Win10+Chrome: изображение Same in iOS Companion App.

Reset a frontend cache in Companion App.

kcofoni commented 9 months ago

After resetting companion app front cache (or whatever...) it is now working. Great custom card ! Thanks