thomasloven / lovelace-state-switch

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

State swtich causes improper stacking of all other cards in view since ~v0.111 #40

Closed scstraus closed 2 years ago

scstraus commented 3 years ago

Hi, I'm not sure exactly when this problem started because I had the same problem with vertical-stack-in card and didn't notice the problem with state switch until I purged my configuration of vertical-stack-in.. I believe there's a good chance it's related to this change which has required changes from other cards. Pictures say 1000 words, so here you go:

With state-switch:

image

Without state-switch:

image

Here is the offending code (show the live view when I'm home on WiFi, but non-live view when I'm on mobile data).

  - type: custom:state-switch
    entity: input_select.sean_location_dropdown

    states:
      Home:

        type: vertical-stack
        cards:

        - type: picture-glance
          aspect_ratio: 16x9
          entities: []
          show_state: false
          show_name: false
          camera_image: camera.front_stream
          camera_view: live

        - type: horizontal-stack
          cards:

          - type: picture-glance
            aspect_ratio: 9x16
            entities: []
            show_state: false
            show_name: false
            camera_image: camera.left_stream
            camera_view: live

          - type: picture-glance
            aspect_ratio: 9x16
            show_state: false
            show_name: false
            entities: []
            camera_image: camera.right_stream
            camera_view: live

        - type: picture-glance
          aspect_ratio: 16x9
          entities: []
          show_state: false
          show_name: false
          camera_image: camera.back_stream
          camera_view: live

      default:
        type: vertical-stack
        cards:

        - type: picture-glance
          aspect_ratio: 16x9
          entities: []
          camera_image: camera.front_stream

        - type: horizontal-stack
          cards:

          - type: picture-glance
            aspect_ratio: 9x16
            entities: []
            camera_image: camera.left_stream

          - type: picture-glance
            aspect_ratio: 9x16
            entities: []
            camera_image: camera.right_stream

        - type: picture-glance
          aspect_ratio: 16x9
          entities: []
          camera_image: camera.back_stream

When changed to this (remove state-switch), the stacking problem disappears:


  - type: vertical-stack
    cards:

    - type: picture-glance
      aspect_ratio: 16x9
      entities: []
      show_state: false
      show_name: false
      camera_image: camera.front_stream
      camera_view: live

    - type: horizontal-stack
      cards:

      - type: picture-glance
        aspect_ratio: 9x16
        entities: []
        show_state: false
        show_name: false
        camera_image: camera.left_stream
        camera_view: live

      - type: picture-glance
        aspect_ratio: 9x16
        show_state: false
        show_name: false
        entities: []
        camera_image: camera.right_stream
        camera_view: live

    - type: picture-glance
      aspect_ratio: 16x9
      entities: []
      show_state: false
      show_name: false
      camera_image: camera.back_stream
      camera_view: live