Lock automation, turn on lights in hallway when door unlocks

Hello!

I’m trying to get my yale doorman /verisure door lock to turn on hallway light on unlock, however, it does not trigger on door unlock.

- action:
  - data:
      entity_id: light.hall_1
    service: light.turn_on
  - data:
      entity_id: light.hall_2
    service: light.turn_on
  alias: Turn on lights on door unlock
  condition: []
  id: '1523470034979'
    to: lock.unlock
  trigger:
  - entity_id: lock.dorr
    platform: state

Using the automation editor (i did write my own at first but it did not work either).

Any ideas`?

I had to setup a template sensor for my Schlage lock. (Using code someone else was kind enough to share)

- platform: template
  sensors:
    garage_door_lock_state:
        #NOTE: To ensure consistent updates, we link to the update of the zwave entity id, and not the lock!
        entity_id:
          - sensor.schlage_be469nxcen_touchscreen_deadbolt_alarm_type_89_0
          #- input_select.lock_hass_status_for_office_back_door_lock
          - zwave.schlage_be469nxcen_touchscreen_deadbolt_89
        value_template: >-
            {% set alarm_type = states('sensor.schlage_be469nxcen_touchscreen_deadbolt_alarm_type_89_0') %}
            {% set alarm_level = states('sensor.schlage_be469nxcen_touchscreen_deadbolt_alarm_level_89_1') %}
            #{% set hass_state = states('input_select.lock_hass_status_for_office_back_door_lock') %}

            {#- Z-Wave/RF Lock: Alarm State 0x01 (???) -#}
            {%- if hass_state == 'locked_by_hass' -%}
                {{ 'locked with Home Assistant' }}

            {#- Z-Wave/RF Unlock: Alarm State 0x01 (???) -#}
            {%- elif hass_state == 'unlocked_by_hass' -%}
                {{ 'unlocked with Home Assistant' }}

            {# Manually Locked: Alarm State 0x15 (21) #}
            {% elif alarm_type == '21' %}
                {{ 'locked manually with key cylinder or inside thumb turn' }}

            {#- Manual Unlock: Alarm State 0x16 (22) -#}
            {%- elif alarm_type == '22' -%}
                {{ 'unlocked manually with key cylinder or inside thumb turn' }}

            {#- Keypad Lock by keypad touch (lock & leave): Alarm State 0x12 (18) -#}
            {%- elif alarm_type ==  '18' -%}
                {{ 'locked with keypad' }}

            {#- Keypad Unlock: Alarm State 0x13 (19) -#}
            {%- elif alarm_type == '19' -%}
                {{ 'unlocked with keypad by user ' ~ alarm_level }}

            {%- else -%}
                {#- The lock status is sometimes unknown when HASS boots and Z-Wave is initialized.  In this case
                    we want to use the last state reported by the lock itself (physically) if possible, otherwise
                    we return 'unknown' -#}
                {# {{ 'unknown' }} #}
                {% set state = states.lock.schlage_be469nxcen_touchscreen_deadbolt_locked_89_0 %}
                {% set status = (state.attributes.lock_status if state else '')|trim() %}
                {% set result = status if status != '' else 'unknown' %}
                {{ result|lower() }}
            {%- endif -%}

Then I use this automation to disable my HA Alarm when a specific user unlocks my Schlage lock. This method should work for you too.

- alias: Disarm alarm when deadbolt is opened by user 3
  trigger:
    - platform: state
      entity_id: sensor.garage_door_lock_state
      to: '#unlocked with keypad by user 3'
  action:
    - service: alarm_control_panel.alarm_disarm
      entity_id: alarm_control_panel.ha_alarm