Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- platform: template
- sensors:
- motion_name_last_activated:
- friendly_name: 'Motion Name Last Activated'
- value_template: >
- {% set sensors = [states.binary_sensor.m_0_garage_motion,
- states.binary_sensor.m_0_ground_hallway_motion,
- states.binary_sensor.m_0_kitchen_motion,
- states.binary_sensor.m_0_outdoor_motion,
- states.binary_sensor.m_0_snug_motion,
- states.binary_sensor.m_1_first_hallway_motion,
- states.binary_sensor.m_1_living_room_motion,
- states.binary_sensor.m_2_master_bedroom_motion,
- states.binary_sensor.m_2_second_hallway_motion,
- states.binary_sensor.master_bedside_sam_pir_sensor,
- states.binary_sensor.motion_swk_cr_uniuvc1,
- states.binary_sensor.motion_swk_cr_uniuvc2,
- states.binary_sensor.motion_swk_cr_uniuvc3,
- states.binary_sensor.motion_swk_cr_uniuvc4] %}
- {% set time = sensors | map(attribute='last_changed') | max %}
- {% set sensor = (sensors | selectattr('last_changed','eq', time) | list)[0] %}
- {{sensor.name}}
- ###### This is to capture the name ( {{sensor.name}} ) of the latest entity to be triggered from the list
- ###### To capture the state, change {{sensor.name}} to {{sensor.state}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement