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:
Стрим
2026-04-11 06:53:41 +00:00
commit 84cd63ce70

View 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