-
-
Notifications
You must be signed in to change notification settings - Fork 30.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add connection test feature to assist_satellite #126256
Conversation
Hey there @home-assistant/core, @synesthesiam, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
Needs #126287 to hear the sound |
Thanks @MartinHjelmare! Feedback has been addressed. |
27f66de
to
c1c0ab5
Compare
Test failure seems unrelated |
audio_path = Path(__file__).parent / CONNECTION_TEST_FILENAME | ||
audio_data = await hass.async_add_executor_job(audio_path.read_bytes) | ||
|
||
async_dispatcher_send(hass, CONNECTION_TEST_SIGNAL.format(connection_id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally not a fan of dispatchers anymore, as it's unclear who will be using the signal. Not sure what the official stance from core is on this. An alternative is to share a dict with events between the HTTP view and the WebSocket command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree. Searching for the signal name will immediately reveal who is involved in the signal. Why reinvent the wheel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is the lack of typing on the dispatcher. The things are too loosely coupled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's indeed a good point 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we add the same type mechanism for that as for hass.data
?
Converting to a draft for some more discussion |
return | ||
|
||
# Send response indicating the command is accepted | ||
connection.send_result(msg["id"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should be a subscription or that actually a normal call could be enough?
Co-authored-by: Bram Kragten <[email protected]>
Co-authored-by: Martin Hjelmare <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok to merge when frontend signs off on usage 👍
Frontend approves ✅ |
* Add connection test feature to assist_satellite * Add http to assist_satellite dependencies * Remove extra logging * Incorporate feedback * Fix tests * ruff * Apply suggestions from code review Co-authored-by: Bram Kragten <[email protected]> * Use asyncio.Event instead of dispatcher * Respond asap * Update homeassistant/components/assist_satellite/websocket_api.py Co-authored-by: Martin Hjelmare <[email protected]> --------- Co-authored-by: Michael Hansen <[email protected]> Co-authored-by: Paulus Schoutsen <[email protected]> Co-authored-by: Bram Kragten <[email protected]> Co-authored-by: Martin Hjelmare <[email protected]>
* Add connection test feature to assist_satellite * Add http to assist_satellite dependencies * Remove extra logging * Incorporate feedback * Fix tests * ruff * Apply suggestions from code review Co-authored-by: Bram Kragten <[email protected]> * Use asyncio.Event instead of dispatcher * Respond asap * Update homeassistant/components/assist_satellite/websocket_api.py Co-authored-by: Martin Hjelmare <[email protected]> --------- Co-authored-by: Michael Hansen <[email protected]> Co-authored-by: Paulus Schoutsen <[email protected]> Co-authored-by: Bram Kragten <[email protected]> Co-authored-by: Martin Hjelmare <[email protected]>
Proposed change
Add connection test feature to
assist_satellite
The connection test is implemented as a websocket command which will send a unique announce media id to the targeted
assist_satellite
entity and wait for theassist_satellite
to fetch the media.Type of change
Additional information
Checklist
ruff format homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
.To help with the load of incoming pull requests: