Entry-filter on empty value

Hi,
on a card in my lovelace configuration I’m showing fuel prices. As some of the gas stations close at night their prices and therefore the sensor value are void then.

To improve readability, I wanted to hide those stations when no data is present.

I already tried using entity-filter:

type: entity-filter
state_filter:
 - "1.369"
not_empty: true
entities:
  - sensor.fuel_jet

Here I was wondering if there is a fnuction to set state_not_filter or filter_empty as I want to ignore empty values instead of including specific prices.

I also tried using conditional entities:

type: conditional
conditions:
  - entity: sensor.fuel_jet
    state_not: ""
card:
  type: entities
  entities:
    - sensor.fuel_jet

Unfortunately it is not possible to have a empty string set for state_not thus my problem still remains unsolved.

As I’m new to home-assistant I was wondering if the above feature is available and if not, I would like to know where to add it in source code – my first guess would be components/filter/sensor.py.

Thank you in advance :smiley:

would the state be empty or would it instead be unknown?
I would have thought you’d get an unknown value if it could not be retrieved.
Also what kind of sensors are these? scrape? Template?

Hi Laurent,

I’m using rest requests to obtain the data:

sensors:
- platform: rest
  resource: https://creativecommons.tankerkoenig.de/json/prices.php?apikey=MYKEY
  name: fuel-jet
  ...

This results in an empty value for the sensor, as the request yields an empty string. The above is part of my configuration.yaml file.

Thanks. I guess maybe raise an issue on HA’s github. I would also have expected the state_not: "" to work from a logical point of view…

Maybe try @thomasloven 's auto-entities .