Like many, im not keen on the way the device tracker displays devices as home or not_home
So to make things prettier, I made a template sensor that displays connected or offline…but I obviously have to create 1 sensor for each device_tracker entity, I do this as follows:
- platform: template
sensors:
connectivity_rpi_pihole:
friendly_name: 'Pi-Hole'
value_template: "{{ 'Connected' if is_state('device_tracker.rpi_pihole', 'home') else 'Offline' }}"
connectivity_richlaptop:
friendly_name: 'Rich Laptop'
value_template: "{{ 'Connected' if is_state('device_tracker.richlaptop', 'home') else 'Offline' }}"
connectivity_sony_tv:
friendly_name: 'Sony TV'
value_template: "{{ 'Connected' if is_state('device_tracker.sony_braviatv', 'home') else 'Offline' }}"
This feels sloppy…is there a cleaner easier way to achieve this? It just doesn’t seem very elegant?
Can one use wild cards to loop through device_tracker.* and create a unique sensor for each match?
I have tried this custom component by @abmantis, which works great, but displays on or off…and as I understand cannot be changed as it is a binary sensor.