mirror of
https://github.com/AtHeartEngineering/ai_automation_suggester.git
synced 2026-01-09 23:28:03 -05:00
update to 1.3.2
This commit is contained in:
@@ -59,14 +59,14 @@ Randomized entity selection (configurable) helps ensure each analysis run can su
|
||||
Suggestions are delivered directly within Home Assistant notifications:
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/ITSpecialist111/ai_automation_suggester/1.3.1/Screenshot%202025-01-19%20082247-1.png" alt="Notification example" width="700"/>
|
||||
<img src="https://raw.githubusercontent.com/ITSpecialist111/ai_automation_suggester/1.3.2/Screenshot%202025-01-19%20082247-1.png" alt="Notification example" width="700"/>
|
||||
<br><em>AI suggestions delivered right inside Home Assistant</em>
|
||||
</p>
|
||||
|
||||
You can also build custom dashboard cards to display suggestions using sensor attributes:
|
||||
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/ITSpecialist111/ai_automation_suggester/1.3.1/Screenshot%202025-01-19%20083200.png" alt="Dashboard card example" width="700"/>
|
||||
<img src="https://raw.githubusercontent.com/ITSpecialist111/ai_automation_suggester/1.3.2/Screenshot%202025-01-19%20083200.png" alt="Dashboard card example" width="700"/>
|
||||
<br><em>Dashboard showing human-readable description and extracted YAML block</em>
|
||||
</p>
|
||||
|
||||
|
||||
@@ -110,7 +110,13 @@ class AIAutomationCoordinator(DataUpdateCoordinator):
|
||||
self.selected_domains: list[str] = []
|
||||
self.entity_limit: int = 200
|
||||
|
||||
# Data shared with sensors
|
||||
# ------------------------------------------------------------------
|
||||
# Call parent **first** – DataUpdateCoordinator sets self.data = None
|
||||
# ------------------------------------------------------------------
|
||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=None)
|
||||
self.session = async_get_clientsession(hass)
|
||||
|
||||
# Data shared with sensors (must be set AFTER the super() call)
|
||||
self.data: dict = {
|
||||
"suggestions": "No suggestions yet",
|
||||
"description": None,
|
||||
@@ -120,17 +126,13 @@ class AIAutomationCoordinator(DataUpdateCoordinator):
|
||||
"provider": entry.data.get(CONF_PROVIDER, "unknown"),
|
||||
}
|
||||
|
||||
# Manual refresh only
|
||||
super().__init__(hass, _LOGGER, name=DOMAIN, update_interval=None)
|
||||
self.session = async_get_clientsession(hass)
|
||||
|
||||
# Registries (populated in async_added_to_hass)
|
||||
self.device_registry: dr.DeviceRegistry | None = None
|
||||
self.entity_registry: er.EntityRegistry | None = None
|
||||
self.area_registry: ar.AreaRegistry | None = None
|
||||
|
||||
# ────────────────────────────────
|
||||
# HA life-cycle hooks
|
||||
# HA life‑cycle hooks
|
||||
# ────────────────────────────────
|
||||
async def async_added_to_hass(self) -> None:
|
||||
await super().async_added_to_hass()
|
||||
@@ -182,7 +184,7 @@ class AIAutomationCoordinator(DataUpdateCoordinator):
|
||||
prompt = self._build_prompt(selected)
|
||||
suggestions = await self._dispatch(prompt)
|
||||
|
||||
# ---------------- post-process the reply -----------------
|
||||
# ---------------- post‑process the reply -----------------
|
||||
if suggestions:
|
||||
match = YAML_RE.search(suggestions)
|
||||
yaml_block = match.group(1).strip() if match else None
|
||||
@@ -204,15 +206,15 @@ class AIAutomationCoordinator(DataUpdateCoordinator):
|
||||
"provider": self.entry.data.get(CONF_PROVIDER, "unknown"),
|
||||
}
|
||||
else:
|
||||
self.data.update(
|
||||
{
|
||||
"suggestions": "No suggestions available",
|
||||
"description": None,
|
||||
"yaml_block": None,
|
||||
"last_update": now,
|
||||
"entities_processed": [],
|
||||
}
|
||||
)
|
||||
# Ensure self.data is *assigned*, not updated (handles None safely)
|
||||
self.data = {
|
||||
"suggestions": "No suggestions available",
|
||||
"description": None,
|
||||
"yaml_block": None,
|
||||
"last_update": now,
|
||||
"entities_processed": [],
|
||||
"provider": self.entry.data.get(CONF_PROVIDER, "unknown"),
|
||||
}
|
||||
|
||||
self.previous_entities = current_entities
|
||||
return self.data
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
"pyyaml>=6.0",
|
||||
"voluptuous>=0.13.1"
|
||||
],
|
||||
"version": "1.3.1"
|
||||
"version": "1.3.2"
|
||||
}
|
||||
@@ -72,7 +72,7 @@ class AISuggestionsSensor(CoordinatorEntity, SensorEntity):
|
||||
"name": f"AI Automation Suggester ({entry.data.get(CONF_PROVIDER, 'unknown')})",
|
||||
"manufacturer": "Community",
|
||||
"model": entry.data.get(CONF_PROVIDER, "unknown"),
|
||||
"sw_version": "1.3.1",
|
||||
"sw_version": "1.3.2",
|
||||
}
|
||||
self._entry = entry
|
||||
self._previous_suggestions: str | None = None
|
||||
@@ -149,7 +149,7 @@ class AIProviderStatusSensor(CoordinatorEntity, SensorEntity):
|
||||
"name": f"AI Automation Suggester ({entry.data.get(CONF_PROVIDER, 'unknown')})",
|
||||
"manufacturer": "Community",
|
||||
"model": entry.data.get(CONF_PROVIDER, "unknown"),
|
||||
"sw_version": "1.3.1",
|
||||
"sw_version": "1.3.2",
|
||||
}
|
||||
self._entry = entry
|
||||
self._attr_native_value = STATE_UNKNOWN
|
||||
|
||||
Reference in New Issue
Block a user