feat(ha): add device-available automation with template trigger
- Used platform: template instead of state trigger with entity_id: all (entity_id: all is not valid for state triggers in HA) - Template checks: from_state == 'unavailable' AND to_state not in ['unavailable', 'unknown', 'none'] — fires only on recovery - Removed problematic regex condition; condition: [] keeps it simple - Action: notify via Telegram bot with device name, entity_id, new state - mode: queued to handle burst of devices coming online simultaneously
This commit is contained in:
14
tasks/home-assistant/automations.yaml
Normal file
14
tasks/home-assistant/automations.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
# Home Assistant Automations
|
||||
# Managed via OpenClaw workspace. Push to HA after review.
|
||||
|
||||
- id: '1744300000001'
|
||||
alias: 'Alert: Device became available'
|
||||
trigger:
|
||||
- platform: template
|
||||
value_template: "{{ trigger.from_state.state == 'unavailable' and trigger.to_state.state not in ['unavailable', 'unknown', 'none'] }}"
|
||||
condition: []
|
||||
action:
|
||||
- service: notify.telegram_bot_8251509944_126472752
|
||||
data:
|
||||
message: "✅ Устройство онлайн\n📋 {{ trigger.to_state.name }}\n🔧 {{ trigger.entity_id }}\n💡 {{ trigger.to_state.state }}"
|
||||
mode: queued
|
||||
Reference in New Issue
Block a user