When the available
property is false, the entity state is equal to “unavailable”. So we can test the availability in a template with something:
{%- if is_state("switch.some_sensor", "unavailable") %}
....
{%- endif %}
Is there other or better ways ?