--- sensor: {% for shelly in shellies | selectattr("name", "match", "^shellyplug-s-") | list %} - name: Power Usage state_topic: home/{{ shelly["room"] }}/{{ shelly["device"] }}/relay/0/power unique_id: {{ shelly["name"] }} unit_of_measurement: W device: name: {{ shelly["device"] | capitalize }} suggested_area: {{ shelly["room"] | replace("_", " ") | capitalize }} identifiers: - {{ shelly["name"] }} {% endfor %}