#Sensor Template Helpers dropping to 0 during Matter Server unavailability

1 messages · Page 1 of 1 (latest)

pine bobcat
#

You defined a default of 0 in your float filter. You might need an availability template to make the sensor unavailable, as soon as one of the source sensors is unavailable.

#

Or is not a number.

pine bobcat
#

Looks good to me.

faint fog
#

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 }}
summer pier
#

@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?

golden echo
# summer pier <@723160143314812971> are the 2 below same things? ``` {{ 'sensor.smart_plug_mi...

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_number will 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.