@samtwilliams wrote:
Hi All,
Can anyone see why this isn’t working. it’s state is always ‘off’
- platform: template sensors: template_last_motion: friendly_name: 'Last Sensor Triggered' value_template: > {%- set pirs = [states.sensor.sensor1, states.sensor.sensor2, states.sensor.sensor3, states.sensor.sensor4, states.sensor.pir1, states.sensor.pir2, states.sensor.pir3, states.sensor.pir4, states.sensor.pir5, states.sensor.pir6] %} {% for pir in pirs %} {% if as_timestamp(pir.last_changed) == as_timestamp(pirs | map(attribute='last_changed') | max) %} {{ pir.name }} {% endif %} {% endfor %}
Posts: 6
Participants: 2