Create Binary Sensor from Device tracker

Hello

I thought I knew how to create a binary sensor from a device tracker… However after 60 minutes I have failed.
Any tips please? They are devices that the netgear presence detection found and I want to see if they are on of off

I have this but it always off

  - platform: template
    sensors:
      test:
        friendly_name: test
        device_class: presence
        value_template: >
            {%- if is_state("device_tracker.philips_hue", "home") %}
                On
            {%- elif is_state("device_tracker.philips_hue", "not_home") %}
                Off
            {%- endif %}    

value_template: "{{ True if is_state('device_tracker.philips_hue', 'home') else False }}"

1 Like

so damn simple thank you

It can actually be even simpler:

value_template: "{{ is_state('device_tracker.philips_hue', 'home') }}"
3 Likes

lol… yeah xD
I blame lack of coffee…

1 Like