How can I create binary_sensor based on device_tracker sensor?

I have device_tracker sensor (created by ASUSWRT integration).
I try create binary sensor based on these sensors, but without success :frowning:
I have (in configuration yaml):

template:
  - binary_sensor:
      - name: "People 3"
        state: >
          {{ is_state('device_tracker.mi_10t_tomek', 'home') }}
        device_class: "presence"

and I don’t see this new sensor (of course after reload yamls)

What am i doing wrong?

Just make that in hte UI using the template {{ is_state('device_tracker.mi_10t_tomek', 'home') }}

However I’m not sure why you want this? If you want to see if people are home you can use the count on zone.home.

Is there a reason you need this as a binary sensor?

This is just a simple example.
It is supposed to be more developed there (more phones, motion sensors, etc.)

Then how I can create binary sensor?

Make a template helper

Which type? Binary sensor?

Is that what you want to create? If yes, then choose that.

1 Like

Super. This is works.
But why my first example doesn’t work?

I get info from

There could be many reasons it doesn’t work. Depends on here you put that in configuration.yaml.

EDIT: after rereading your initial post and assuming you put that in the correct spot in configuration.yaml, the issue is that you chose to reload yaml instead of restart. Whenver you add a new integration via yaml, you have to restart. After that, adding new sensors (or making changes) can be achieved by reloading.

1 Like

Thanks! Now it works first method also.
Restart is needed :frowning: