The person.me entity Device tracker input

I’m confused about adding a “binary_sensor.carhome” to set the person to home?
The person.xx only accepts devices. Not even sure I’m clear what a device is defined as.
Do I need to make a binary_sensor inside of my esphome device a into it’s own device?
Do I need to make a beacon out of my binary_sensor.carhome ?
I don’t get it?

Device Tracker

Person


binary_sensor:
  - platform: status
    name: gar 32 status  
    
  - platform: ble_presence   # Car
    mac_address: 01:02:03:04:05:06
    name: carhome 

I’m pretty sure that you can only add presence trackers to a person. So yes, if you want your car to be attached to a person, it needs to be a presence tracker. If you’re already using the ble_presence platform, it seems like you should be able to put that into the device_tracker area instead of binary_sensor. Hopefully that’s enough to get you started. I use presence tracking, but via an outside program using MQTT where the presence tracker is setup for me, so I’m not going to be much help with a manual YAML config.

The person integration allows connecting device tracker entities…

You can create and update a device_tracker manually by using the service device_tracker.see in an automation:

alias: Convert binary sensors to device trackers
trigger:
  - platform: state
    entity_id:
      - binary_sensor.gar_32_status
      - binary_sensor.carhome
condition: []
action:
  - service: device_tracker.see
    data:
      dev_id: "{{ trigger.entity_id | split('.')[1] }}"
      location_name: >-
        {{ 'home' if trigger.to_state.state == 'on' else 'not_home' }}
mode: queued
max: 10

Thank you guys,

After over an hour of trying to figure out what thing is being set to home or not_home I still don’t get it.

I get this error when trying to save the code as is:
“Message malformed: template value should be a string for dictionary value @ data[‘action’][0][‘data’]”

I did make a

TestTracker:
  name: TestTracker
  id: testtracker
  icon:
  picture:
  track: true

in /config/known_devices.yaml
But were would I put it in the code?

Is this code changing the attributes of the binary_sensor from on/off to home/not_home? If so will the person.me accept the binary_sensor if it now has home/not_home attribute?

Hi, the example code is for an automation. You can create a new one via Settings → Automations and Scenes → Add automation (empty)

Then if you click on the three dots … (top right) you can switch to YAML and paste the code provided.

What the code does, is reading each change of the binary sensors, and update a device tracker accordingly. These device trackers then can be used for the person.

That sounds like it’s going to be cool !!

How come I get this error?

Convert

My bad, the dev_id doesn’t support templates.
So we need to hardcode this. It’s less neat, but should do the job!

alias: Convert binary sensors to device trackers
trigger:
  - platform: state
    entity_id: binary_sensor.tyhm
    id: tyhm
  - platform: state
    entity_id: binary_sensor.tyhd
    id: tyhd
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id: tyhm
        sequence:
          - service: device_tracker.see
            data:
              dev_id: tyhm
              location_name: "{{ 'home' if trigger.to_state.state == 'on' else 'not_home' }}"
      - conditions:
          - condition: trigger
            id: tyhd
        sequence:
          - service: device_tracker.see
            data:
              dev_id: tyhd
              location_name: "{{ 'home' if trigger.to_state.state == 'on' else 'not_home' }}"
mode: queued
max: 10

You may need to reboot in order to have the device tracker entities to be created.

So that worked after a reboot I now have a device tracker to add to that person :slight_smile:
Thank you !!