When using the the Availability check with more than one sensor the first one will not work of the value is not a number, it even says that its “true” if i use a sensor that not even exists.
Is this a bug or did I do something wrong?
# Power Consumption Grid Netto
- name: "Power Consumption Grid"
unique_id: "template_power_consumption_grid"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: "mdi:transmission-tower"
state: >
{% set PowerConsumption = states('sensor.electricity_meter_energieverbruik_w_2') | float %}
{% set SolarPower = states('sensor.solaredge_huidig_vermogen') | float %}
{{ ((PowerConsumption - SolarPower)) | round(0, default=0) }}
availability: "{{ is_number(states('sensor.nonexistingsensor') and states('sensor.solaredge_huidig_vermogen')) }}"
It does ‘work’ if I give a fake sensor for the second sensor to check.
# Power Consumption Grid Netto
- name: "Power Consumption Grid"
unique_id: "template_power_consumption_grid"
unit_of_measurement: "W"
device_class: power
state_class: measurement
icon: "mdi:transmission-tower"
state: >
{% set PowerConsumption = states('sensor.electricity_meter_energieverbruik_w_2') | float %}
{% set SolarPower = states('sensor.solaredge_huidig_vermogen') | float %}
{{ ((PowerConsumption - SolarPower)) | round(0, default=0) }}
availability: "{{ is_number(states('sensor.electricity_meter_energieverbruik_w_2') and states('sensor.nonexistingsensor')) }}"