Hi,
I am using the GAUGE CARD to show i.e. Pollen activity by German Weather Service (DWD).
If a forecast is not available , the value won’t be within interval [1…6], but ‘-1’.
In that case the same error comes up in the frontend like:
'Entity is non-numeric: ....'
Would it be possible to create an optional argument for the Gauge definition like:
error_message: 'Not available'
That the Gauge itself still appears, but the text appears instead of the coloured gauge scale?
Ok, thanks for the answer.
I am almost new - if this is a simple solution for more experienced users, it is fine for me if this topic will be shifted to general forum questions…
For me it is still not possible…may you post some code, that I can alter or copy into my configuration file?
I am using the GUI mainly…
Regards,
Joerg
PS: I am actually have an infight already with some template sensor
Oh, that would be great.
But it seems there is the next problem at the horizon.
I am using a custom component with Unique ID it seems if I have a look in the entities.
My entity in this case is dwd_pollen_11_tomorrow_birke
The value in the API is ‘-1’ if no value is available.
Holding the last value seems reasonable.
OK,
the State is ‘unknown’ , because the json file shows the ‘-1’ (which means ‘not available’ acc. German API)
I would appreciate if you can give me an example to keep the last value, in case the new state is unknown.
but this would give you wrong information as the value is really unknown. For this reason I am not going to change this, but feel free to use the template sensor to fit it to your use case.
BTW: I am planning to improve the implementation to support maybe renaming inside of Home Assistant itself and use the functionality the platform delivers a bit better, including tests, so that eventually I can create a PR to make it part of the core product instead having to install it manually.
You can adapt the template to tell you when the data is unknown by displaying an obviously incorrect value like 9999, with the advantage that the graph does not display the error message:
- platform: template
sensors:
filtered_pollen:
name: 'whatever you want' # change this
unit_of_measurement: 'ppm?' # and this
value_template: >
{% if is_state('sensor.dwd_pollen_11_today_avg', 'unknown') %}
9999
{% else %}
{{ states('sensor.dwd_pollen_11_today_avg') }}
{% endif %}