Advertisement
xangin

XG3 BLE lock action automation smaple

Jul 23rd, 2023
1,522
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 1.41 KB | None | 0 0
  1. - id: outside_open_lock
  2.   alias: Outside open lock
  3.   trigger:
  4.     platform: state
  5.     entity_id: sensor.frontdoorlock_action
  6.     to: lock
  7.   condition:
  8.     condition: template
  9.     value_template: "{{ trigger.to_state.attributes['action_id'] == 0 }}" #Unlock outside the door
  10.   action:
  11.     service: notify.line_notify
  12.     data:
  13.       message: |
  14.        {% if trigger.to_state.attributes['method'] =="biological" %} #指紋
  15.            {% if trigger.to_state.attributes['key_id'] == 2 %}
  16.              人員2進門
  17.            {% elif trigger.to_state.attributes['key_id'] == 3 %}
  18.              人員3進門
  19.            {% elif trigger.to_state.attributes['key_id'] == 15 %}  
  20.              人員15進門
  21.            {% elif trigger.to_state.attributes['key_id'] == 20 %}  
  22.              人員20進門
  23.            {% else %}
  24.               BIO ID: {{ trigger.to_state.attributes['key_id'] }} 進門
  25.            {% endif %}
  26.         {% elif trigger.to_state.attributes['method'] =="nfc" %} #NFC
  27.            {% if trigger.to_state.attributes['key_id'] == 18 %}
  28.               人員19進門
  29.            {% else %}
  30.               NFC ID: {{ trigger.to_state.attributes['key_id'] }} 進門
  31.            {% endif %}
  32.         {% else %} #不是指紋也不是NFC
  33.            Method: {{ trigger.to_state.attributes['method'] }} #解鎖方式
  34.            User ID: {{ trigger.to_state.attributes['key_id'] }} #USER ID
  35.         {% endif %}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement