đŸ”č state-switch - conditional card on steroids

Quick question: I have two state cards on my view that are active. When I change one of the cards (hash and navigate) and then change the other, the first one reverts to the default state. Is there a way around this? I tried by disabling default (I use hash), but then nothing shows at all.

hash is whatever’s after ? in the URL in your browsers navigation bar. Anything that changes that will change which card is displayed.

I see, that makes total sense. Thanks for clarifying! I don’t suppose there is a way to achieve what I want for only the device that is currently viewing it. I tried different ways (like input select) but those change the view for all devices.

I’m getting a “Custom element doesn’t exist: state-switch” error on Google cast. Any chance this has something to do with it?

i have an input select that changes the ecobee hold mode on my install, and if the hold mode is set to hold hours it also shows an input number slider to set the number of hours. if the mode is anything else, it hides the number slider.

this card is doing pretty much exactly what i want in regards to what i described above, but there’s one small glitch
the input select list when expanded is ducking behind the cards below it (screenshot attached). is there a way to bring that to front?

state-switch

You should start by making sure this does not happen if you are not using state-switch.

Hey @thomasloven
I was wondering, is it possible to have a “not” function somehow?
What I am trying to do is to hide a card completely if the state of the entity is “unavailable” but to show exactly the same cards if the state is either “on” or “off”, but I would like to prevent writing the same card(s) twice.

Thanks

That’s why I made q-card.

1 Like

Interesting, so I would create those q_cards (as I do for the decluttering one) and load for each state (on and off) that q-card, is this correct?
Also, would you consider this to be integrated into HACS?

Thanks :slight_smile:

Correct.
It’s still under evaluation. I’m not sure what kind of performance impact it might have yet.

It works perfectly :slight_smile:

Now with the mix of: decluttering-card, state-card and q-card I have a template that shows me the available lights in the house (hiding the unavailable ones) and I can control them all from one place:

image

Once expanded it looks like this:

There is only 1 thing I would like to make better, which is the spacing when you expand the group

If someone have an idea please let me know
 Maybe with card-mod but I don’t know how to do that :smiley:

If anyone need the code to re-create this it’s on my github repo:

Thanks!

it does not.

state-switch2

Thanks. I’ll see what I can do.

1 Like

one other quick question: on that same card, there’s a bit of a delay when the page first loads before the card comes up. this doesn’t seem to happen with the other state-switch cards i’ve used
is this just due to it using an input_select as the controlling entity? if so, is there a way to fix that so that the card is up and on the screen when the rest of the page comes up?

Here is an annoying thing that happens occasionally on refreshing the frontend or switching between tabs. Another refresh will always fix it tho. It just started happening after I updated to v110.

ex2

I get it on one other card (card-templater) with a very similar error and a refresh clears that one up too.

ex1

I know that card-templater isn’t one of yours and I’ve posted this to that thread too but I thought it might give you more insight as to what could be causing it.

I am aware of the problem and working on a fix.

1 Like

Should be fixed now, actually


Hey Thomas,

would you be willing to add the version info to the console log, so we can easily check in inspector it is loaded correctly?
thanks for considering!

Yeah, it looks like it’s working now. Thanks!

How can I show second card to display in the case entity parameter is set to deviceID.

I was testing following snippet, second card ‘Laptop2’ shown instead of showing both.

  - type: custom:state-switch
    entity: deviceID
    states:
      'c5cfe6f8-e92c2008':
        type: markdown
        content: >
          Laptop
        type: markdown
        content: >
          Laptop2
      'c202a709-0baf8d92':
        type: markdown
        content: >
          Mobile

If I add the cards as a list then I get ‘No card type configured.’ error message.

      'c5cfe6f8-e92c2008':
        - type: markdown
          content: >
            Laptop
        - type: markdown
          content: >
            Laptop2