šŸ”¹ state-switch - conditional card on steroids

I have been trying to get this card working but no matter what I have done, I donā€™t get the options to show up. Iā€™ve uninstalled and reinstalled the repository and cleared the cache and cookies but nothing has changed. Iā€™ve tried very basic setups and nothing is showing up so maybe the code is bad? Does it need to be in another card to work?

type: custom:state-switch
entity: input_select.test_mode_select
default: Test1
states:
  Test1:
    type: vertical-stack
    cards:
      - type: entities
        title: one
        entities:
          - entity: light.3d_light
  Test2:
    type: vertical-stack
    cards:
      - type: entities
        title: two
        entities:
          - entity: light.3d_light

Make sure that your input_select is set to either Test1, or Test2. (Look at Developer > States for the input_selectā€™s current State).

It seems to be. The Test1 card option displays but I donā€™t have a place to choose it or Test2.

What?
Just place your input_select entity on the same view and see possible options.

@thomasloven I really love this card. Can you share the code for the example you give with the button presses change the view. Do you use an input boolean to accomplish this or what?

Be careful of tagging people out of the blue. It comes across as demanding.

I am not begging for help I just want to get the code to see if I can get it to work properly. I know its not a forum I understand that I was just curious if the maker of the card is willing to elaborate more on the code structure. I am just wanting to try to use a card in an advanced way and wanting to see if it is possible.

did you check lovelace-state-switch/test at master Ā· thomasloven/lovelace-state-switch Ā· GitHub?

I didnt, but Thomas did put-up some examples there

Is it possible to have the card preform two transitions?
I have a custom button card with tap_action to navigation _path: ā€˜#p1ā€™
based on my state switch the my card slides down to show my cards or entities. I was looking to have the card slip back up then down again showing another set of cards or entities when a different button is pressed.

1 Like

HI Marius

Did you end up finding a solution for this without the button-card?? I have been trying for a few days now to convert window.location.pathname into either a variable or usable template. Tried also using custom:config-template-card but just cant find a way of making the pathname usable in later code. I could use DeviceID in BrowserMod but I want the code a little more dynamic without manually needing to assign Device names etc.

My use case is that I have navigation buttons that I only want available when using a tablet and not on a PC.

no I havent, it simply cant be done in jinja, because path is frontend available only.

using stated-switch on a bigger view level like:

  - type: custom:state-switch
    entity: mediaquery
    states:
      "(pointer: coarse)":
        !include /config/dashboard/includes/include_plattegrond_swipe_3.yaml
      all:
        !include /config/dashboard/includes/include_plattegrond_grid_4.yaml

which includes a grid config for desktop or a swiper config for mobile (pointer: coarse), I can help but notice a huge delay upon each loading of the card.

If I use either of these configs individually, there is still some lag (it is a rather large view, including a lot of picture-glance cards for all of my rooms) but it is way more responsive.

Would there be a better way of deciding which card config to use based on either mobile or non mobile?

Hi all, Iā€™m looking for a way to install version 1.9.3, is there a way to do that?

I need that version for minimalist adaptieve ui.

I have a button that I only want to see when an entity is 1ā€¦

YAML:

- type: conditional
        conditions:
          - entity: binary_sensor.bureau_bewegingsmelder_occupancy
            state: 'on'
        card:
          - type: custom:mushroom-chips-card
            chips:
              - type: template

The button is not seen, but when the entity is 1 I get ā€œno card type configuredā€. what is wrong with the code ?

You put the single card there as a list item. Remove the - in front of ā€˜typeā€™

Thanks for helping me but I donā€™t understand :frowning:

instead of the above, use

        card:
          type: custom:mushroom-chips-card
          chips:
            - type: template

no - in front of the type:

as Thomas says, using the - makes that a list, and the card expects a single card, not a list of cards

1 Like

I still got the same error

here is the full code on the actionā€¦

YAML:

- type: conditional

        conditions:

          - entity: binary_sensor.bureau_bewegingsmelder_occupancy

            state: 'on'

        card:

          type: custom:mushroom-chips-card

          chips:

            - type: template

              entity: binary_sensor.bureau_bewegingsmelder_occupancy

              content_info: none

              use_light_color: false

              card_mod: null

              tap_action:

                !include alarm.yaml    

              icon: |2-

                    {% set state=states('binary_sensor.bureau_bewegingsmelder_occupancy') %}

                    {% if state=='on' %}

                    mdi:bell-outline

                    {% elif state=='off' %}

                    show_icon: false

                    {% endif %}

              icon_color: |2-

                    {% set state=states('binary_sensor.bureau_bewegingsmelder_occupancy') %}

                    {% if state=='on' %}

                    red

                    {% elif state=='off' %}

                    grey

                    {% endif %}

              style: |

                ha-card {

                  {% if states('binary_sensor.bureau_bewegingsmelder_occupancy') == 'on' %}

                  animation: blink 0.4s linear infinite;

                  }

                  @keyframes blink {

                    50% {opacity: 0;}

                    }

                  {%- else -%}

                  box-shadow: 0px 0px;

                  {%- endif %}

                ha-card {

                  box-shadow: 0px 0px;

          alignment: center

if this is your actual yaml, then you should at least fix the spacing. Maybe its a c&p fluke, but

- type: conditional

        conditions:

          - entity: binary_sensor.bureau_bewegingsmelder_occupancy

            state: 'on'

        card:

should be:

- type: conditional
  conditions:
    - entity: binary_sensor.bureau_bewegingsmelder_occupancy
      state: 'on'
  card:
    type:

   # and next your correct card config

check the example in the docs:

type: conditional
conditions:
  - entity: light.bed_light
    state: "on"
  - entity: switch.decorative_lights
    state_not: "off"
card:
  type: entities
  entities:
    - device_tracker.demo_paulus
    - cover.kitchen_window
    - group.kitchen
    - lock.kitchen_door
    - light.bed_light

you should try the conditional card with a simple entity first. so you know the conditional works ok.
also, try the card itself without conditional, soy know that works.

If both are fine, you can joinā€¦

- type: conditional
  conditions:
      - entity: binary_sensor.bureau_bewegingsmelder_occupancy
        state: 'on'
  card:
    - type: 'custom:button-card'
      entities:
         - sensor.p1_meter_5c2faf04a1f2_active_power

this is now my conditional code. It still says there is no card configured