HA에서 장치가 10분동안 unavailable시 OpenWRT 공유기의 해당 Wifi장치 Reconnect.
이전에 만들었던 Matter Wifi장치 뿐만 아니라 ESPHome Wifi장치까지 추가가 쉽도록 재사용 가능한 자동화와 쉘커맨더로 수정.
** Matter Wifi Reconnect: https://ntxlds.blogspot.com/2026/02/matter-over-wifi-ha.html
configuration.yaml
automation: !include automation.yaml
shell_command: !include shell_command.yaml
automation.yaml
- id: system-wifi/reconnect
alias: system-wifi/reconnect
triggers:
- trigger: state
entity_id:
- switch.ws_ba_button1
- switch.ws_be_button1
- switch.neo03_relay
- switch.neo05_relay
to: 'unavailable'
for: '00:10:00'
actions:
- action: shell_command.kick_wifi_client
data:
mac: >-
{% set mac_map = {
'ws_ba_button1': '8C:87:D0:xx:xx:xx',
'ws_be_button1': 'B8:06:0D:xx:xx:xx',
'neo03_relay': 'D8:BF:C0:xx:xx:xx',
'neo05_relay': 'D8:07:C0:xx:xx:xx'
} %}
{{ mac_map.get(trigger.entity_id.split('.')[1]) }}
- action: notify.send_message
data:
entity_id: notify.hass_bot
message: "{{ trigger.to_state.attributes.friendly_name }} 기기 재연결을 시도합니다."
shell_commaner.yaml
kick_wifi_client: >
ssh -i /config/id_rsa -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@192.168.1.1 "ubus call hostapd.phy0-ap1 del_client '{\"addr\":\"{{ mac }}\",\"reason\":5}'"