WiFi tracker using a binary_sensor

I’m trying to improbe the tracking of devices home leveraging the WiFi connection to my home GW, but even following the several similar topics in this community it seems not working (for sure my mistake … :-()

Below the configuration, I tried with both WiFi BSSID and WiFi Connection got by the companion App.


The “sensor redmi 7a wifi connection” is correctly updated but the binary sensor seems not, it always shows the state “off”.
I also tried to manually modify the state of the “sensor redmi7a wifi connection” in the developing tools but nothing.
Any help is welcome

There’s nothing wrong with OP’s direct use of strings.


Neither home or not_home are accepted values for a binary sensor, change them to on and off. If you want the frontend representation to be Home and Away like device trackers, you need to add device_class: presence to your sensor config.

FWIW, you can simplify your template:

value_template: "{{ is_state('sensor.redmi_7a_wifi_connection', 'Vodafone-Whole3.0') }}"

Another approach would be to use a “virtual” device tracker.

HI Didgeridrew,

I solved with your suggestions, thanks a lot.

Before unlikely followed some not perfect coding examples.