Advanced BSSID based location tracker

I am trying to setup a advanced location based sensor working with the device BSSID.

What I want to achieve,

  • Display an area name based on BSSID
    eg. 12:34:33:11:cc:ab = Living Room / 23:ab:55:fc:22:12 = Kitchen etc.
  • When the device is not connected to a BSSID, display the state as “Away”
  • This to specifically be a “Device Tracker” allowing me to assign it to a User.
  • When the user is “Away”, switch to the GPS location of the device.

Where im at

  • Using the composite device_tracker integration, I have managed to convert sensors to device trackers allowing me to assign them to the Users as device trackers. This currently shows as “Unknown” as im assigning the BSSID sensor directly to the compose device_tracker as the entity and I guess it cannot determine the home or away state.

Where I am stuck:

  • I need to somehow create a template sensor or something that determines the BSSID and assigns the name to that sensor, then assign that sensor the compose device_tracker sensor.

Can someone help me with this as I can only seem to create template sensors to convert to a “Unit of Measurement”.

Thanks

Can someone please assist me with this template sensor,

I think im missing something here,

      dean_location:
        value_template: >-
          {% if states('sensor.deans_iphone_bssid') == "xx:xx:xx:xx:xx:xx" %}
            Lounge
          {% if states('sensor.deans_iphone_bssid') == "xx:xx:xx:xx:xx:xx" %}
            Kitchen
          {% if states('sensor.deans_iphone_bssid') == "xx:xx:xx:xx:xx:xx" %}
            Living Room
          {% else %}
            Away
          {% endif %}
        friendly_name: 'Dean WiFi Location'

After the first “if” you should use “elif”.
Also, add a unique_id.
Like this:

       locatie_maarten:
         friendly_name: 'Locatie telefoon Maarten'
         unique_id: 'Locatie_telefoon_Maarten'
         value_template: >-
           {% if states('sensor.maarten_iphone_bssid') == "**:**" %}
            Begane grond
           {% elif states('sensor.maarten_iphone_bssid') == "**:**" %}
            Eerste verdieping
           {% elif states('sensor.maarten_iphone_bssid') == "**:**" %}
            Zolder
           {% elif states('sensor.maarten_iphone_bssid') == "**:**" %}
            Tuin
           {% else %}
            Niet verbonden
           {% endif %}

Thank you, I will try this out and see how it goes!