Anyone know how I could get a template sensor to show the previous status on the front end rather than the current one? Ie after the user unlocks my lock I want to show the last status in this case who unlocked last but as soon as the lock is locked the alarm type changes so I cant see unless I look at the history.
sensor 20:
platform: template
sensors:
template_back_door_unlock_status:
{% if is_state(‘sensor.back_door_alarm_level’, ‘2’) and is_state(‘sensor.back_door_alarm_type’, ‘19’) %} User1 {% endif %}
{% if is_state(‘sensor.back_door_alarm_level’, ‘3’) and is_state(‘sensor.back_door_alarm_type’, ‘19’) %} Guest 1 {% endif %}
{% if is_state(‘sensor.back_door_alarm_level’, ‘4’) and is_state(‘sensor.back_door_alarm_type’, ‘19’) %} Guest 2 {% endif %}
{% if is_state(‘sensor.back_door_alarm_level’, ‘5’) and is_state(‘sensor.back_door_alarm_type’, ‘19’) %} Guest 3 {% endif %}
{% if is_state(‘sensor.back_door_alarm_level’, ‘5’) and is_state(‘sensor.back_door_alarm_type’, ‘19’) %} Guest 3 {% endif %}
friendly_name: ‘Last Unlocked by’