I can use operators like <= and > to compare numeric values, but the == and != operators only work with strings. Not only is this unintuitive (since you have to surround numbers in quotes) – it also falls apart when you try to add more than one entity since a value of 0.0 does not equal 0 (and vice versa).
As a workaround for the != operator, you can combine two filters like so:
I have an entity (price) for the electricity injection that can be positive and then the company pays to you for the energy that you are exporting, but sometimes … the value can be negative and in such case you are paying the electricity company if you export some energy.
I have two entities one for the prices for today and another one that shows the prices for tomorrow once they are published. The issue comes with the entity that shows the prices for tomorrow, because when the prices are not published yet … the attributes (the prices are attributes inside the sensor) are “unknown” and they are not still visible inside the entity … then an entity card is showing “Unknown” everywhere.
I tried to use
state_filter:
- operator: "!="
value: "unknown"
But it is still not working … it is still showing “Unknown” at the entities card.
Finally I temporary solved the problem by giving the value a very negative value.
Is there a way to have the entity filter display an entity (sensor.32_hot_tub_sprinkler_zone_history) when its timestamp value (2023-08-03T20:10:05-10:00) is older than 24hrs, or older than 7 days etc? Can’t figure out the syntax.
As far as I can tell, the value attribute doesn’t support lambdas (its type is simply listed as “string”), so you won’t be able to match against a dynamic value using a simple state_filter.