thomasloven / lovelace-state-switch

🔹Dynamically replace lovelace cards depending on occasion
MIT License
382 stars 27 forks source link

state-switch stopped working with swipe-card #64

Closed ildar170975 closed 2 years ago

ildar170975 commented 2 years ago

Let's display three buttons dependingly on some input_boolean:

The code:

title: state-switch-4
path: test-state-switch-4
cards:

  - type: entities
    entities:
      - input_boolean.test_boolean

  - type: custom:state-switch
    entity: input_boolean.test_boolean
    states:
      "on":
        type: horizontal-stack
        cards: &ref_horizontal_stack
          - type: button
            entity: sun.sun
          - type: button
            entity: binary_sensor.updater
          - type: button
            entity: zone.home
      "off":
        type: custom:swipe-card
        cards: *ref_horizontal_stack

The output - no buttons is displayed: 3

Separately both cards are displayed:

title: state-switch-4
path: test-state-switch-4
cards:

  - type: entities
    entities:
      - input_boolean.test_boolean

  - type: horizontal-stack
    cards: &ref_horizontal_stack
      - type: button
        entity: sun.sun
      - type: button
        entity: binary_sensor.updater
      - type: button
        entity: zone.home

  - type: custom:swipe-card
    cards: *ref_horizontal_stack

4

VDRainer commented 2 years ago

Looks like there's a problem with custom cards. For me it's the custom:gauge-card.

              - type: custom:state-switch
                entity: sensor.e3dc_battery_power_stat
                states:

                  Ladung:
                    type: custom:gauge-card
                    title: Batterie Ladung
                    entity: sensor.e3dc_battery_power
                    min: 0
                    max: 3100
                    scale: 37px
                    severity:

                  Entladung:
                    type: custom:gauge-card
                    title: Batterie Entladung
                    entity: sensor.e3dc_battery_power_neg2pos
                    min: 0
                    max: 3100
                    scale: 37px

                  Leer:
                    type: custom:gauge-card
                    title: Batterie
                    entity: sensor.e3dc_battery_power_neg2pos
                    min: 0
                    max: 3000
                    scale: 37px

None of the gauges are displayed. If i switch to the core gauge it works. Back to v8.

Dapolux commented 2 years ago

Hello, I have the same issue with custom:mini-media-player, but also vertical-stack, and iframe, for exemple: image

So i downgraded this addon to the version "8" (using HACS), and is working back properly: image

thomasloven commented 2 years ago

Please try release 1.9.3.

ildar170975 commented 2 years ago

Tested again: HA 2022.3 state-switch 1.9.3 swipe-card 4.0.0

The same code as above:

  - type: entities
    entities:
      - input_boolean.test_boolean

  - type: custom:state-switch
    entity: input_boolean.test_boolean
    states:
      "on":
        type: horizontal-stack
        cards: &ref_horizontal_stack
          - type: button
            entity: sun.sun
          - type: button
            entity: binary_sensor.service_on_value
          - type: button
            entity: zone.home
      "off":
        type: custom:swipe-card
        cards: *ref_horizontal_stack

Untitled Projectbbbbbbbbbbbb

  1. The swipe-card works.
  2. The state-switch card works - it changes cards "swipe-card <-> horizontal-stack".
  3. After refresh or after 1st opening of the page - the whole state-switch card is not displayed, it is displayed after some delay.

@thomasloven Is it still a bug or a browser's issue?

ildar170975 commented 2 years ago

Do not observe the issue with state-switch 1.9.4. Tested with HA 2022.5.4, Win10+Chrome, iOS 15.x