HI,
using this for my xboxlive sensors:
value_template: >
{% if states.sensor.xbox_id %}
{% if is_state('sensor.xbox_id', 'Offline') %} Offline
{% elif is_state('sensor.xbox_id', 'unknown') %} Unknown
{% else %} {{state_attr('sensor.xbox_id','XboxOne Full')}}
{% endif %}
{% else %} n/a
{% endif %}
Works fine and the exist test seems to do its job as expected. If theres no sensor value yet, it shows n/a quite nicely.
Since I’ve been recently rewriting all of these states.etc expressions like state(), i tried that too in this template.
trying the same with
{% if states('sensor.xbox_id') %}
doesn’t work however and renders None…
is this to be expected?