I am using the code @bzumik1 has in this message on GitHub to change Espresense room sensors into device trackers (home/not home). But I would like to combine a few sensors (at least ping and device tracker) into one presense sensor, and that’s impossible because the device trackers created by the code does not have a unique ID. So is it possible to change that code so it creates those ID’s? Here’s the code from the GitHub thread:
alias: ESPresense - Convert to device_tracker
description: ""
trigger:
- platform: state
entity_id:
- sensor.jakub_iphone_espresense
- sensor.jakub_apple_watch_espresense
- sensor.petra_iphone_espresense
- sensor.petra_apple_watch_espresense
condition:
- condition: template
value_template: "{{ trigger.from_state.state != trigger.to_state.state }}"
enabled: false
action:
- variables:
dev_id: "{{ trigger.to_state.entity_id.split('.')[1] }}"
previous_state: "{{ states('device_tracker.' ~ dev_id) }}"
- service: device_tracker.see
data:
dev_id: "{{ dev_id }}"
source_type: bluetooth_le
location_name: >-
{% if not is_state('sensor.' ~ dev_id, 'not_home') %}
home
{% else %}
not_home
{% endif %}
mode: parallel