Conditional card error

I am trying to create an entity card where the entity won’t display for a specific state.
I am getting a red screen error:
image

My card config:

          - type: entities
            title: BOM Forecast
            show_header_toggle: false
            entities:
              - sensor.bom_forecast_0
              - sensor.bom_forecast_1
              - sensor.bom_forecast_2
              - sensor.bom_forecast_3
              - sensor.bom_forecast_4
              - sensor.bom_forecast_5
              - sensor.bom_forecast_6
              - type: conditional
                conditions:
                  - entity: sensor.bom_forecast_6
                    state_not: "unknown°/unknown°/unknown%"
                card:
                  type: entities
                  entities:
                  - entity: sensor.bom_forecast_6

You need this if you are using a card as a row element:

So as a lazy bastard, how do I edit the above posted code to do this?

Install the hui element card, then:

          - type: entities
            title: BOM Forecast
            show_header_toggle: false
            entities:
              - sensor.bom_forecast_0
              - sensor.bom_forecast_1
              - sensor.bom_forecast_2
              - sensor.bom_forecast_3
              - sensor.bom_forecast_4
              - sensor.bom_forecast_5
              - sensor.bom_forecast_6
              - type: 'custom:hui-element'   ######  <-----
                card-type: conditional       ######  <-----
                conditions:
                  - entity: sensor.bom_forecast_6
                    state_not: "unknown°/unknown°/unknown%"
                card:
                  type: entities
                  entities:
                  - entity: sensor.bom_forecast_6

um…

              - sensor.bom_forecast_6
              - type: 'custom:hui-element'
                card-type: conditional
                conditions:
                  - entity: sensor.bom_forecast_6
                    state_not: "unknown°/unknown°/unknown%"
                card:
                  type: entities
                  entities:
                  - entity: sensor.bom_forecast_6

image

EDIT card_type I think…

Yeah sorry it is card_type:. Was going from memory.

1 Like

Ah crap… this is now drawing me into css hell


I think I can set the padding to correct the offset but how do I make that row transparent?

I use a card-mod theme for that. This goes in my theme:

  card-mod-theme: day
  card-mod-card: |
    ha-card.inline-card-no-border {
      box-shadow: none;
      --ha-card-background: rgba(0, 0, 0, 0);
    }

And then add this to my card:

card_mod:
  class: inline-card-no-border

At the level of the card I want to make transparent.

no change

          - type: entities
            title: BOM Forecast
            show_header_toggle: false
            entities:
              - sensor.bom_forecast_0
              - sensor.bom_forecast_1
              - sensor.bom_forecast_2
              - sensor.bom_forecast_3
              - sensor.bom_forecast_4
              - sensor.bom_forecast_5
              - type: 'custom:hui-element'
                card_type: conditional
                conditions:
                  - entity: sensor.bom_forecast_6
                    state_not: "unknown°/unknown°/unknown%"
                card:
                  type: entities
                  entities:
                  - entity: sensor.bom_forecast_6
                    card_mod:
                      style: |
                        ha-card {
                          box-shadow: none;
                          --ha-card-background: rgba(0, 0, 0, 0);
                        }

Try this:

                card:
                  type: entities
                  card_mod:
                    style: |
                      ha-card {
                        box-shadow: none;
                        --ha-card-background: rgba(0, 0, 0, 0);
                      }
                  entities:
                  - entity: sensor.bom_forecast_6

ok better but the padding not so much…
image
tried adding padding: 0 no difference

                card:
                  type: entities
                  card_mod:
                    style: |
                      ha-card {
                        box-shadow: none;
                        --ha-card-background: rgba(0, 0, 0, 0);
                        margin: -16px -16px -16px -16px;
                      }
                  entities:
                  - entity: sensor.bom_forecast_6

image

wishing I just left the ‘unknowns’ there lol

1 Like

Yeah it’s a slippery slope.

it’s not even like it’s once done done forever either… always something to tweak…