thomasloven / lovelace-state-switch

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

i.setConfig is not a function #34

Closed bkupidura closed 4 years ago

bkupidura commented 4 years ago

After HA update to 0.110.1/0.110.2, sometimes state-switch breaks.

debug console error:

state-switch TypeError: "i.setConfig is not a function"
    d state-switch.js:1
    u state-switch.js:1
    u state-switch.js:1
    h state-switch.js:1
    setConfig state-switch.js:1
    s hui-weather-forecast-card.ts:39
    l hui-weather-forecast-card.ts:39
    l hui-weather-forecast-card.ts:39
    Ht hui-weather-forecast-card.ts:39
    value hui-stack-card.ts:16
    value hui-stack-card.ts:16
    value hui-stack-card.ts:16

After page refresh, everything back to normal.

Card configuration:

              - type: custom:state-switch
                entity: user
                default: default
                states:
                  Guest:
                    type: custom:state-switch
                    entity: input_boolean.guest
                    states:
                      "on":
                        type: custom:button-card
                        entity: input_boolean.guest_occupancy
                        icon: mdi:account-group
                        size: 20%
                        show_name: false
                        tap_action:
                          action: toggle
                        styles:
                          icon:
                            - color: |
                                [[[
                                  if (entity.state == 'on'){
                                    return 'green';
                                  }
                                  return 'grey';
                                ]]]
                  default:
                    type: custom:button-card
                    entity: input_boolean.guest
                    icon: mdi:account-group
                    size: 20%
                    show_name: false
                    tap_action:
                      action: toggle
                    double_tap_action:
                      action: more-info
                      entity: input_boolean.guest_occupancy
                    styles:
                      icon:
                        - color: |
                            [[[
                              if (entity.state == 'on'){
                                return 'green';
                              }
                              return 'grey';
                            ]]]
dwainscheeren commented 4 years ago

Got the same error over here, the cards inside the state switch card not always load only 1/10 page refreshs.

thomasloven commented 4 years ago

Try release 7

bkupidura commented 4 years ago

Looks like fixed. Thanks!

dwainscheeren commented 4 years ago

Yes also here no problems anymore.