blueprint to update device tracker based on mqtt_room sensor.
basically set device tracker as home when device in one of the rooms or not_home when changed to not_home.
you can find the code in github here & import button:
blueprint:
name: set_location_based_mqtt_room
description: set location based on mqtt_room sensor
domain: automation
input:
mqtt_room_sensor:
name: mqtt_room Sensor
description: mqtt_room sensor that associated to device
selector:
entity:
domain: sensor
track_device_id:
name: Device ID
description: Id of device (find id in known_devices.yaml).
trigger:
- platform: state
entity_id: !input mqtt_room_sensor
action:
- choose:
- conditions:
- condition: state
entity_id: !input mqtt_room_sensor
state: not_home
sequence:
- service: device_tracker.see
data:
dev_id: !input track_device_id
location_name: not_home
default:
- service: device_tracker.see
data:
dev_id: !input track_device_id
location_name: home
mode: single