Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Card does not appear when dashboard is shown #119

Open
CoryAlbrecht opened this issue Jul 24, 2024 · 13 comments
Open

Card does not appear when dashboard is shown #119

CoryAlbrecht opened this issue Jul 24, 2024 · 13 comments

Comments

@CoryAlbrecht
Copy link

CoryAlbrecht commented Jul 24, 2024

In a web browser (Chrome, Ubuntu) the card does not appear when the dashboard is loaded but will appear on a manual page refresh (e.g. Ctrl+R). If you go to another tab on the same dashboard and return, it is gone again and you have to refresh to get it back.

In the companion app (Samsung Galaxy Tab S6 Lite, Google Pixel 8) the card does not appear and the app cannot be refreshed by swiping down.

I have multiple cards like this to show if there are any active alarms or timers on any of the Google/Nest Minis throughout my home, and they all act like this.

type: custom:state-switch
entity: >-
  {% set nt = state_attr('sensor.bathroom_mini_alarms', 'alarms')|count %} {% if
  (nt >= 1) and (nt <= 3) %}
    {{state_attr('sensor.bathroom_mini_alarms', 'alarms')|count}}
  {% elif nt >= 4 %}3{% endif %}
tap_action:
  action: more-info
states:
  '1':
    type: custom:timer-bar-card
    name: Active Alarms
    entities:
      - entity: sensor.bathroom_mini_alarm_1
        extend_paper_buttons_row:
          position: right
          entity: sensor.bathroom_mini_alarm_1
          buttons:
            - layout: icon
              icon: mdi:delete
              tap_action:
                confirmation:
                  text: Do you want to delete the alarm? (Cannot be undone.)
                action: call-service
                service: script.delete_google_home_alarm
                service_data:
                  alarm_id: sensor.bathroom_mini_alarm_1
                  alarm_device: sensor.bathroom_mini_alarms
              styles:
                button:
                  margin: 0px 0px 0px 8px
  '2':
    type: custom:timer-bar-card
    name: Active Alarms
    entities:
      - entity: sensor.bathroom_mini_alarm_1
        extend_paper_buttons_row:
          position: right
          entity: sensor.bathroom_mini_alarm_1
          buttons:
            - layout: icon
              icon: mdi:delete
              tap_action:
                confirmation:
                  text: Do you want to delete the alarm? (Cannot be undone.)
                action: call-service
                service: script.delete_google_home_alarm
                service_data:
                  alarm_id: sensor.bathroom_mini_alarm_1
                  alarm_device: sensor.bathroom_mini_alarms
              styles:
                button:
                  margin: 0px 0px 0px 8px
      - entity: sensor.bathroom_mini_alarm_2
        extend_paper_buttons_row:
          position: right
          entity: sensor.bathroom_mini_alarm_2
          buttons:
            - layout: icon
              icon: mdi:delete
              tap_action:
                confirmation:
                  text: Do you want to delete the alarm? (Cannot be undone.)
                action: call-service
                service: script.delete_google_home_alarm
                service_data:
                  alarm_id: sensor.bathroom_mini_alarm_2
                  alarm_device: sensor.bathroom_mini_alarms
              styles:
                button:
                  margin: 0px 0px 0px 8px
  '3':
    type: custom:timer-bar-card
    name: Active Alarms
    entities:
      - entity: sensor.bathroom_mini_alarm_1
        extend_paper_buttons_row:
          position: right
          entity: sensor.bathroom_mini_alarm_1
          buttons:
            - layout: icon
              icon: mdi:delete
              tap_action:
                confirmation:
                  text: Do you want to delete the alarm? (Cannot be undone.)
                action: call-service
                service: script.delete_google_home_alarm
                service_data:
                  alarm_id: sensor.bathroom_mini_alarm_1
                  alarm_device: sensor.bathroom_mini_alarms
              styles:
                button:
                  margin: 0px 0px 0px 8px
      - entity: sensor.bathroom_mini_alarm_2
        extend_paper_buttons_row:
          position: right
          entity: sensor.bathroom_mini_alarm_2
          buttons:
            - layout: icon
              icon: mdi:delete
              tap_action:
                confirmation:
                  text: Do you want to delete the alarm? (Cannot be undone.)
                action: call-service
                service: script.delete_google_home_alarm
                service_data:
                  alarm_id: sensor.bathroom_mini_alarm_2
                  alarm_device: sensor.bathroom_mini_alarms
              styles:
                button:
                  margin: 0px 0px 0px 8px
      - entity: sensor.bathroom_mini_alarm_3
        extend_paper_buttons_row:
          position: right
          entity: sensor.bathroom_mini_alarm_3
          buttons:
            - layout: icon
              icon: mdi:delete
              tap_action:
                confirmation:
                  text: Do you want to delete the alarm? (Cannot be undone.)
                action: call-service
                service: script.delete_google_home_alarm
                service_data:
                  alarm_id: sensor.bathroom_mini_alarm_3
                  alarm_device: sensor.bathroom_mini_alarms
                styles: null
                button:
                  margin: 0px 0px 0px 8px
@ildar170975
Copy link

You have plenty of custom cards inside state-switch - and yet open an issue for state-switch...
Suggest to replace inner cards with simple stock cards & re-test.

@CoryAlbrecht
Copy link
Author

#117 #118

@CoryAlbrecht
Copy link
Author

You have plenty of custom cards inside state-switch - and yet open an issue for state-switch...
Suggest to replace inner cards with simple stock cards & re-test.

It makes no difference with only standard cards.

@ildar170975
Copy link

It makes no difference with only standard cards.

Try to understand that people who will look at your problem (plugin author, other volunteers) may want to reproduce your issue. That is why it is CUSTOMARY to post a MINIMAL code which demonstrates the problem, not a >100 lines code with custom stuff.

@mrgrlscz
Copy link

mrgrlscz commented Sep 2, 2024

I have a similar problem on my config... my card do not show at first load, i have to refresh manually (sometimes several times)
i tried with stock cards: here's the code:

type: custom:state-switch
entity: input_boolean.test
states:
  'on':
    type: entities
    entities:
      - sun.sun
  'off':
    type: entities
    entities:
      - sun.sun
      - sun.sun
      - sun.sun

@parautenbach
Copy link

Set a default – see the docs.

@zSprawl
Copy link

zSprawl commented Sep 11, 2024

Set a default – see the docs.

This fixed the issue perfectly. Thanks!

@parautenbach
Copy link

Cool, I ran into the same issue after my HA upgrade.

@deam0n
Copy link

deam0n commented Sep 12, 2024

Set a default – see the docs.

what if I dont want any card to show, until certain conditions are met?

@parautenbach
Copy link

No idea.

Try making a section with an invalid state (a state not provided by your entity) and putting a phantom or empty card (like a markdown card with no content) in that section. Make that section the default.

@mrgrlscz
Copy link

Maybe you can try this (I didn't yet) :
https://github.com/jeremywillans/lovelace-blank-card

@deam0n
Copy link

deam0n commented Sep 12, 2024

Maybe you can try this (I didn't yet) : https://github.com/jeremywillans/lovelace-blank-card

this actually works! Thanks!

@ildar170975
Copy link

Do not see a glitch here, works as expected in Chrome + Win10 + HA 2024.9.

  - title: xxxxx
    path: xxxxx
    cards:
      - type: custom:state-switch
        entity: input_boolean.test_boolean
        states:
          'on':
            type: entities
            entities:
              - sun.sun
          'off':
            type: entities
            entities:
              - sun.sun
              - sun.sun
              - sun.sun

      - type: entities
        entities:
          - entity: input_boolean.test_boolean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants