I have synology router and HA integration is publishing a lot of interesting information from it.
One thing I would like to do is have an entity panel reporting for example signal strength of all devices connected ideally sorted by strength.
Sensor I have is a device_tracker one and attributes are as below example.
Having quite a lot of those if the template creation (which anyway I don’t know how to create and it is main reason of this post) could be automated it would be great.
Paste this into developer tools -> template editor then copy the results into configuration.yaml. If you have a separate sensor file, remove the first line and paste the remainder. You may need to adjust the spacing.
sensor:
- platform: template
sensors:
{%- for dt in states.device_tracker if dt.attributes.signal_strength is defined %}
{{ dt.object_id }}_signal_strength:
friendly_name: {{ dt.name }} Signal Strength
value_template: >
{{ "{{{{ state_attr('{}','signal_strength') }}}}".format(dt.entity_id) }}
device_class: signal_strength
{%- endfor %}