Device tracker, trigger on either one not_home, or both home, but not if one is home

There is no harm in adding it. All triggers are “or”, so whatever happens first will trigger the automation.

image

easy enough :smiley:

but thinking of it, when at mom-in-law the ssid is the same, but then we are not home
will have to look at what the other sensors are

ahh wifi_bssid

will try that one instead as that is Unique

You can also log in to the router and change the name.
But that will affect all wireless devices you have.

yep, more trouble that it’s worth

i wanted to do the same when leaving…

ie i made a dublicate and then said when not_home switch off lights

using the wifi will make that happen a lot faster, but given that when driving away it might connect and disconnect from wifi a few times can i add a delay before new changes are considered a trigger?

image

is what i have in mind,

now also thinking that if one is home and the other needs to go and pick up a parcel
with the current setup would that not switch off the lights?

It sucks… But you only do it once.
I would create two device trackers that is controlled by automations.
The device trackers only need home/not home state so it’s not that hard.

Example:
Template device_tracker - Feature Requests - Home Assistant Community (home-assistant.io)

But in your case the trigger has to be wifi bssid.
Then you can add these two device trackers to your group and all logic will be maintained by the group (and work as you expect).

I actually can’t find where I created a device tracker.
The only place I can see anything regarding one of the trackers I have is in the known_devices.yaml.

kraftan:
  name: "Kraftan"
  picture: /local/kraftan3.png
  icon: mdi:golf-cart
  track: true

This is the device tracker that is updated when her phone disconnects from BT in the car so that it “parks” her car on a map.
Yes… it’s needed.

i can only trigger once? or what do you mean?

and by 2 device trackers i assume you mean one with bssid and the other home/not_home?

You only do the configuration once. It’s a lot of work but since you only do it once it’s just a matter of getting it done.

One for you and one for her.
From the linked thread:

action:
    - data_template:
        dev_id: richard
        location_name: >
          {% if is_state('binary_sensor.richard', 'on') -%}
            home
          {%- else -%}
            not_home
          {%- endif %}

As you can see the location is updated with home or not home

Yours should be something like:

action:
    - data_template:
        dev_id: richard
        location_name: >
          {% if state('sensor.sm_a515f_wifi_forbindelse', 'YOUR WIFI BSSID') -%}
            home
          {%- else -%}
            not_home
          {%- endif %}

ahh now i get it

so i create one automation for me and one for her

and in each i just put in:

action:
    - data_template:
        dev_id: richard
        location_name: >
          {% if state('sensor.sm_a515f_wifi_forbindelse', 'YOUR WIFI BSSID') -%}
            home
          {%- else -%}
            not_home
          {%- endif %}

??

of course i need to update the names in them so they match my setup… ie dev_id needs to change from richard to our names :smiley:

Yes…
And I believe the device trackers are created in the known_devices as I updated my post above with.

hehe, did a google on know decives:

As of 0.94 known_devices.yaml is being phased out and no longer used by all trackers.

but will try with the automations anyway

It only says the file is not used by integrations.
You still use it to create manual devices.

got some errors so for me i ended up with:

alias: Opdater Bo
description: ''
trigger:
  - entity_id: sensor.sm_a515f_wifi_bssid
    platform: state
    to: 'BSSID HERE'
condition: []
action:
  - data_template:
      dev_id: person.bo_herrmannsen_5
      location_name: |
        {% if is_state('sensor.sm_a515f_wifi_bssid', 'BSSID HERE') -%}
          home
        {%- else -%}
          not_home
        {%- endif %}
    service: device_tracker.see
mode: single

and one like it but instead of to i say from, of course i could prob fill in both to and from

Does that work?
To set the location of a person with device_tracker.see? I didn’t think that was possible.

dont know yet if it works… i just copied out from the link

let me see if it accepts without the last line

if i remove it i get

Message malformed: must contain at least one of service, service_template. @ data[‘action’][0]

and that was also the error i tried to solve before i blind copied the example

but i need to go and pickup a parcel so time will soon tell

I believe you need to create your own device trackers.
The documentations does not say you can use device_tracker.see on people. Perhaps you can.
But I would probably not even try.

Also I believe if you use a choose then you only need one automation per device tracker.

Choose option 1 template {{ bssid == “bssid”}}
home
Choose option 2 template {{ bssid !== “bssid”}}
not_home

or something like it

changed everything to deivce based

since we only have one phone each it does not matter if i look at person or device, but when you have same brand of phone and also nearly the same model it becomes “tricky” to know which is what

time to go and get that parcel and see if the update automations at least triggers

why are you not using the ping as device tracker