Skip to content
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

Get device_id for assist if not set #27

Merged
merged 2 commits into from
May 23, 2024

Conversation

ADHDSquir
Copy link
Contributor

This PR adds area awareness to Assist pipelines created by StreamAssist. If the device_id for Assist was not defined via a service call, the switch will pass the device_id of its parent service to Assist which is then used by assist to get the area. I have tested this with the standard Assist pipeline as well as with the Extended OpenAI Conversation integration.

When using Extended OpenAI Conversation, the prompt should include Current Area: {{ area_name(current_device_id) }} as described in that integration's docs.

Addresses #22 and #25

@dinki
Copy link

dinki commented May 22, 2024

Confirmed working for me. Thanks!

@AlexxIT AlexxIT merged commit 0d29e43 into AlexxIT:main May 23, 2024
@AlexxIT
Copy link
Owner

AlexxIT commented May 23, 2024

Thanks! I have made a few changes to your code. I hope I didn't break anything.

@ADHDSquir
Copy link
Contributor Author

Your version works for my setup but you removed the checks to see if the assist and/or device_id keys are already set. I had that to avoid overwriting a device_id or other assist settings that a user had already defined when starting StreamAssist as a service and defining the optional settings in data: -> assist:

Won't self.options["assist"] = {"device_id": self.device_entry.id} overwrite any user-defined settings for assist?

@AlexxIT
Copy link
Owner

AlexxIT commented May 23, 2024

This setting can't be set from config entry. It can be changed only from service call

@ADHDSquir
Copy link
Contributor Author

This setting can't be set from config entry. It can be changed only from service call

Ah, OK. I get it. Thanks!

@ADHDSquir ADHDSquir deleted the device_id-to-assist branch May 26, 2024 21:43
@dinki
Copy link

dinki commented Jun 3, 2024

Hey @AlexxIT so a really dumb question. I see that this has been accepted and the code shows up in main but when I installed on my dev HA install I am not getting the device_id updated version. The install is from HACS. Does something need to happen on the HACS side for these changes to be reflected or something on your side?

I've got a few people testing my View Assist project and they noted that device_id in SA is not working properly. Any help is most appreciated.

@dinki
Copy link

dinki commented Jun 3, 2024

And within two seconds of posting that I see there's an option in HACS to redownload and choose version as main. I had originally just download the changed files and started using it so assumed a new release was available.

I guess the question now is if you would consider doing a point release so users can get this fix? My assumption is that it's not best practice to point to main generally. My View Assist project is relying heavily on this device_id to be set for proper routing so an update to Stream Assist would definitely be appreciated by me and the others that are using Stream Assist with View Assist. Sorry for the burden.

@AlexxIT
Copy link
Owner

AlexxIT commented Jun 12, 2024

https://github.com/AlexxIT/StreamAssist/releases/tag/v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants