mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-22 03:49:18 +02:00
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:
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user