Add script automation and visibility options (#176)

Enhance Home Assistant script support with automation triggers and
printer card visibility control.

- Script automation: Run scripts automatically when main plug turns on/off
- Show/hide scripts on printer cards (configurable per script)
- Scripts appear in dedicated row on printer cards with quick-run buttons
- Toast notification when triggering scripts from settings/sidebar

Closes #176
This commit is contained in:
maziggy
2026-01-30 09:46:03 +01:00
parent 48c349bed1
commit 4c2cef64b3
17 changed files with 982 additions and 338 deletions
+1 -1
View File
@@ -228,7 +228,7 @@ class HomeAssistantService:
- domain: str
"""
# Default domains for smart plug control
default_domains = {"switch", "light", "input_boolean"}
default_domains = {"switch", "light", "input_boolean", "script"}
try:
async with httpx.AsyncClient(timeout=self.timeout) as client:
@@ -195,6 +195,11 @@ class SmartPlugManager:
logger.debug(f"Smart plug '{plug.name}' auto_off is disabled")
return
# Skip auto-off for HA script entities (scripts can only be triggered, not turned off)
if plug.plug_type == "homeassistant" and plug.ha_entity_id and plug.ha_entity_id.startswith("script."):
logger.debug(f"Smart plug '{plug.name}' is a HA script entity, skipping auto-off")
return
# Only auto-off on successful completion, not on failures
# This allows the user to investigate errors before power-off
if status != "completed":