How to change device_tracker state?

Hi
Maybe I am doing it all wrong, but I am using what I can understand =)
What I have so far:

  • BLE gateway that I have limited control of that sends MQTT a list of ble device UUIDs. Can be more than one at once if multiple are detected
  • I am using MQTT sensor to store just the UUIDs of the detected devices in the sensor attributes
  • I am using a binary sensor for each device that I want to know the detected state of that checks against the MQTT sensor to see if UUID is detected

Now, what I am really trying to do is to change the person’s state to/from “home/not_home”.
I have tried to create an automation that suppose to fire when the binanry sensor state changes to “on” and then change the state of the “person” entity to be “home”
But it does not work =(
Result:
result: false state: not_home wanted_state: home

Action:
condition: state
entity_id: person.sergey_2
state: home

You can’t change the state of a person - a person is a group of device_tracker entities combined into a single state based on the logic in the docs. Creating or changing the state of a device_tracker is simple:

  - service: device_tracker.see
    data:
      dev_id: somename
      location_name: "{{ 'home' if something else 'not_home' }}"

That will etiher create device_tracker.somename or change the state to whatever that template evaluates to. Add that device_tracker to your person and done. Or just use the device_tracker entity directly.

1 Like