jonydebu
(Debu)
December 2, 2018, 10:48am
1
Hi , my template dont work fine i paste whats my problem :
and here´s my code :
friendly_name: wifi conected
value_template: '{{ states.device_tracker.life360_jony_.attributes.wifi_on }}'
value_template: >-
{% if is_state("wifi_on", "true")%}
-SI-
{% else %}
-
{% endif %}
Apreciate any help .
you’re using 2 value_templates?
in any case use the real state, which is True, not true. Case sensitive.
friendly_name: Wifi connected
value_template: >
{% if state_attr('device_tracker.life360_jony', 'wifi_on','True') %}
-SI-
{% else %}
- NO -
{% endif %}
jonydebu
(Debu)
December 2, 2018, 12:15pm
3
thanks for your quick answer . The first template is only to see the attribute valour and have a control of his sate . I try your solution but by now still have the same issue.
friendly_name: wifi conected
value_template: '{{ states.device_tracker.life360_jony_.attributes.wifi_on }}'
value_template: >
{% if state_attr('wifi_on','True') %}
-SI-
{% else %}
- NO -
{% endif %}
thats not how it works, but Ive made an error too… my bad
every template needs to be complete, and cant evaluate based on another template. Iow,
try this:
friendly_name: Wifi connected
value_template: >
{% if state_attr('device_tracker.life360_jony', 'wifi_on') == True %}
-SI-
{% else %}
- NO -
{% endif %}
note: always test Case, and parentheses…
btw, you tested template will never work, since ‘wifi_on’ isnt a state but an attribute of a state. You need to have a full and complete value_template in each template.
then it must be a typo, or your device is not reporting correctly, works as expected:
you’re sure you device is life360_jony ?