Skip to content

Commit 60e81ce

Browse files
committed
fix(sentence)!: Fix getting default conversation agent
Fixes #270 BREAKING CHANGE: Changes made to conversation agent now require Home Assistant 2024.5+ for sentence node to work
1 parent ee60d8b commit 60e81ce

File tree

4 files changed

+5
-16
lines changed

4 files changed

+5
-16
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ _Companion Component to [node-red-contrib-home-assistant-websocket](https://gith
2323
## Minimum Requirements
2424

2525
- [node-red-contrib-home-assistant-websocket](https://github.com/zachowj/node-red-contrib-home-assistant-websocket) v0.57+
26-
- [Home Assistant](https://github.com/home-assistant/core) 2023.7.0+
26+
- [Home Assistant](https://github.com/home-assistant/core) 2024.5+
2727

2828
## Installation
2929

custom_components/nodered/manifest.json

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"domain": "nodered",
33
"name": "Node-RED Companion",
44
"after_dependencies": [
5+
"conversation",
56
"mqtt"
67
],
78
"codeowners": [

custom_components/nodered/websocket.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,7 @@
66

77
from hassil.recognize import RecognizeResult
88
from homeassistant.components import device_automation
9-
from homeassistant.components.conversation import (
10-
HOME_ASSISTANT_AGENT,
11-
)
12-
13-
try:
14-
from homeassistant.components.conversation import get_agent_manager
15-
except ImportError:
16-
# _get_agent_manager was renamed to get_agent_manager in 2024.4.0
17-
from homeassistant.components.conversation import (
18-
_get_agent_manager as get_agent_manager,
19-
)
9+
from homeassistant.components.conversation.default_agent import async_get_default_agent
2010

2111
from homeassistant.components.conversation.default_agent import DefaultAgent
2212
from homeassistant.components.device_automation import DeviceAutomationType
@@ -355,9 +345,7 @@ def remove_trigger() -> None:
355345
_LOGGER.info(f"Sentence trigger removed: {sentences}")
356346

357347
try:
358-
default_agent = await get_agent_manager(hass).async_get_agent(
359-
HOME_ASSISTANT_AGENT
360-
)
348+
default_agent = async_get_default_agent(hass)
361349
assert isinstance(default_agent, DefaultAgent)
362350

363351
_remove_trigger = default_agent.register_trigger(sentences, handle_trigger)

hacs.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"filename": "nodered.zip",
3-
"homeassistant": "2023.7.0",
3+
"homeassistant": "2024.5.0",
44
"name": "Node-RED Companion",
55
"zip_release": true
66
}

0 commit comments

Comments
 (0)