Hide sensor entity when blank

Hi everyone!

I’ve been able to clean up my front end thanks to conditionals and filters. Unfortunately I can’t seem to get this one working.

I would like to hide any alerts without a value. Only show the entity if it is available. Despite my efforts, all entities show. In the example below, I should only see the Warnings sensor entity.

Using Environment Canada sensors.

Thanks in advance!

type: entity-filter
state_filter:
  - operator: '!='
    value: ''
entities:
  - entity: sensor.advisories
    state_filter:
      - operator: '!='
        value: ''
  - entity: sensor.warnings
    state_filter:
      - operator: '!='
        value: ''
  - entity: sensor.watches
    state_filter:
      - operator: '!='
        value: ''
  - entity: sensor.statements
    state_filter:
      - operator: '!='
        value: ''

image

Did you ever get this working? I want to do the exact same thing.

Sadly no… I need to get a better understanding of the values being passed. Haven’t had the time to learn. I’ll certainly update if I figure it out.

Thanks to some updates since this post (state now uses 0 when there is nothing to report), I now have a solution!

Here is my full card. Please reach out if it’s not self explanatory.

type: vertical-stack
cards:
  - type: vertical-stack
    cards:
      - type: conditional
        conditions:
          - entity: sensor.kitchener_waterloo_advisories
            state_not: '0'
        card:
          type: entity
          entity: sensor.kitchener_waterloo_advisories

      - type: conditional
        conditions:
          - entity: sensor.kitchener_waterloo_warnings
            state_not: '0'
        card:
          type: entity
          entity: sensor.kitchener_waterloo_warnings

      - type: conditional
        conditions:
          - entity: sensor.kitchener_waterloo_watches
            state_not: '0'
        card:
          type: entity
          entity: sensor.kitchener_waterloo_watches

      - type: conditional
        conditions:
          - entity: sensor.kitchener_waterloo_statements
            state_not: '0'
        card:
          type: entity
          entity: sensor.kitchener_waterloo_statements