#Sensor Template Helpers dropping to 0 during Matter Server unavailability
1 messages · Page 1 of 1 (latest)
Looks good to me.
I would use the has_value filter in the availability template
{{ 'sensor.smart_plug_mini_total_energy' | has_value and 'input_number.electricity_price_eur_kwh' | has_value }}
@faint fog are the 2 below same things?
{{
'sensor.smart_plug_mini_total_energy' | has_value and 'input_number.electricity_price_eur_kwh' | has_valu
}}
or
{{
states('sensor.smart_plug_mini_total_energy') | is_numberand states('input_number.electricity_price_eur_kwh') | is_number
}}
Or does has_value check anything but unavailable/unknown?
It’s all defined here: https://www.home-assistant.io/docs/configuration/templating/
has_value('sensor.my_sensor')will test if the given entity is not unknown or unavailable.
is_numberwill return True if the input can be parsed by Python’s float function and the parsed input is not inf or nan, in all other cases returns False. Note that a Python bool will return True but the strings "True" and "False" will both return False.