thomasloven / lovelace-state-switch

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

vertical-stack inside state-switch - does not work in iOS app #60

Closed ildar170975 closed 2 years ago

ildar170975 commented 2 years ago

Found a possible bug related to iOS companion app.

There is an input_select value:

input_select:
  test_value:
    options:
      - one
      - two
      - three

This card is supposed to show the similar Entities card for all 3 choices:

  - type: vertical-stack
    cards:
      - type: entities
        entities:
          - entity: input_select.test_value
            name: Choice

      - type: custom:state-switch
        entity: input_select.test_value
        default: "one"
        transition: flip
        transition_time: 500
        states:
          "one":
            type: vertical-stack
            cards:
              - type: entities
                title: one
                entities:
                  - entity: input_boolean.test_boolean
                    tap_action: none

          "two":
            type: vertical-stack
            cards:
              - type: entities
                title: two
                entities:
                  - entity: input_boolean.test_boolean
                    tap_action: none

          "three":
            type: vertical-stack
            cards:
              - type: entities
                title: three
                entities:
                  - entity: input_boolean.test_boolean
                    tap_action: none

image

It works fine - but only on PC (Win10x64, Chrome).

On iOS companion app it does not work properly. The checkbox can be toggled only for some one choice ("three" as I noticed).

The code w/o vertical stack works fine:

      - type: custom:state-switch
        entity: input_select.test_value
        default: "one"
        transition: flip
        transition_time: 500
        states:
          "one":
            type: entities
            title: one
            entities:
              - entity: input_boolean.test_boolean
                tap_action: none

          "two":
            type: entities
            title: two
            entities:
              - entity: input_boolean.test_boolean
                tap_action: none

          "three":
            type: entities
            title: three
            entities:
              - entity: input_boolean.test_boolean
                tap_action: none
ildar170975 commented 2 years ago

I managed to bypass the issue with switching off the transition: transition: flip - need to comment this string. Then the card started working as expected.

Probably the same issue: https://github.com/thomasloven/lovelace-state-switch/issues/45

thomasloven commented 2 years ago

Please try release 1.9.0

SeLLeRoNe commented 2 years ago

Hi there, I might have a problem related to this. Since 1.9.0 the card doesn't seems to work anymore with the custom layout-card (set to vertical, haven't test horizontal)

Because of the card similarity to the one of this issue, I believe it might be related.

If there is any information I can provide that might help, please let me know.

For now, here is my config:

      - type: custom:state-switch
        entity: person.andrea
        default: not_home
        states:
          home:
            type: custom:state-switch
            entity: device_tracker.andrea_oneplus_nord_room
            default: not_home
            states:
              not_home:
                entity: person.andrea
                type: "custom:secondaryinfo-entity-row"
                secondary_info: "Next Birthday in [[ sensor.birthday_andrea ]] Days ([[ sensor.birthday_andrea.attributes.years ]])"
                tap_action:
                  action: none
              home:
                type: custom:state-switch
                entity: device_tracker.andrea_oneplus_nord_room
                default: unavailable
                states:
                  "unavailable":
                    entity: person.andrea
                    type: "custom:secondaryinfo-entity-row"
                    secondary_info: "Next Birthday in [[ sensor.birthday_andrea ]] Days ([[ sensor.birthday_andrea.attributes.years ]])"
                    tap_action:
                      action: none
                  home:
                    entity: sensor.andrea_oneplus_nord
                    type: "custom:secondaryinfo-entity-row"
                    secondary_info: "Next Birthday in [[ sensor.birthday_andrea ]] Days ([[ sensor.birthday_andrea.attributes.years ]])"
                    tap_action:
                      action: none
          not_home:
            entity: person.andrea
            type: entities
            type: "custom:secondaryinfo-entity-row"
            secondary_info: "Next Birthday in [[ sensor.birthday_andrea ]] Days ([[ sensor.birthday_andrea.attributes.years ]])"
            tap_action:
              action: none

Only error I see in console is related to secondaryinfo-entity-row, but if I remove that part it still doesn't seems to work.

Thanks!

thomasloven commented 2 years ago

This issue is about entities not being toggleable in ios when using transition: flip?

SeLLeRoNe commented 2 years ago

No. My bad! I didn't notice the entire title was referred to iOS! I'll create a new issue tomorrow :) Sorry

ildar170975 commented 2 years ago

The issue seems to be resolved.