Hi there, Hi @sayanova ,
it works with this simplification:
- spec:
name: play_music
description: Play music.
parameters:
type: object
properties:
media_player_id:
type: array
items:
type: string
description: List of media player Entity IDs to play
media_id:
type: string
description: Media identifier (URI)
media_type:
type: string
optional: true
enum: ["artist", "album", "playlist", "track", "radio"]
description: Will be auto-determined if omitted
enqueue:
type: string
enum: ["play", "replace", "next", "replace_next", "add"]
optional: true
description: How to enqueue the media
announce:
type: boolean
optional: true
description: Whether to make an announcement
artist:
type: string
optional: true
description: Specify the artist
album:
type: string
optional: true
description: Specify the album
radio_mode:
type: boolean
optional: true
description: Specify if it is a radio mode.
required:
- media_player_id
- media_id
function:
type: script
sequence:
- service: mass.play_media
target:
entity_id: "{{ media_player_id }}"
data:
media_id: "{{ media_id }}"
Problem is the template data, but i donāt know how to format it
hi @jekalmin
there is still some problem,
Probably in retrieving the query to the script,
When I tell it to run album X for my player, it runs the script but without the text of the query,
(no error message appears in the log)
Thanks
- service: mass.play_media
target:
entity_id: "{{ media_player_id }}"
data: >
{
media_id: "{{ media_id }}"
media_type: "{{ media_type }}"
{% if enqueue is defined and enqueue %}
enqueue: "{{ enqueue }}"
{% endif %}
{% if announce is defined and announce %}
announce: "{{ announce }}"
{% endif %}
{% if artist is defined and artist %}
artist: "{{ artist }}"
{% endif %}
{% if album is defined and album %}
album: "{{ album }}"
{% endif %}
{% if radio_mode is defined and radio_mode %}
radio_mode: "{{ radio_mode }}"
{% endif %}
}
I canāt get the template to work, I always get this error:
2023-12-19 09:25:09.439 ERROR (MainThread) [custom_components.extended_openai_conversation.helpers] extended_openai_conversation: Error executing script. Error for call_service at pos 1: Error rendering data template: Result is not a Dictionary
I know that you donāt have any speakers to test, so donāt worry
- spec:
name: play_music
description: Play music.
parameters:
type: object
properties:
media_player_id:
type: array
items:
type: string
description: List of media player Entity IDs to play
media_id:
type: string
description: Media identifier (URI)
media_type:
type: string
optional: true
enum: ["artist", "album", "playlist", "track", "radio"]
description: Will be auto-determined if omitted
enqueue:
type: string
enum: ["play", "replace", "next", "replace_next", "add"]
optional: true
description: How to enqueue the media
announce:
type: boolean
optional: true
description: Whether to make an announcement
artist:
type: string
optional: true
description: Specify the artist
album:
type: string
optional: true
description: Specify the album
radio_mode:
type: boolean
optional: true
description: Specify if it is a radio mode.
required:
- media_player_id
- media_id
function:
type: script
sequence:
- service: mass.play_media
target:
entity_id: "{{ media_player_id }}"
data:
media_id: "{{ media_id }}"
Sorry, I had a problem talking to OpenAI: Request too large for gpt-3.5-turbo in organization org-1mxR4GLwpDM6ylDJIQ0S1sgS on tokens_usage_based per min: Limit 60000, Requested 131729. Visit https://platform.openai.com/account/rate-limits to learn more.
Could you add logging and see how it is requested?
This might be caused by exposing too many entities.
Go to http://{your-home-assistant}/config/voice-assistants/expose and see how many entities are exposed.
Iām trying to install in, both via hacs (open reposotory) and manually adding the files to the costom content folder. I have cleard the cashe but its not really working. Trough hacs after the restart its not there anymore and I cant find it in devices and servicesā¦
When I tried just adding the folder direct, restart but still nothing in devises and servies. What am I duing wrong?
@stban1983 , you mentioned this code was working - which is exciting - but so far I have not figured out how to do so. What is required to get the media player to work with this component? So far it does not actually play the media for me.
So far I have installed and configured OpenAI Extended, connected it with ChatGPT, set it as default Voice Assistant, included the prompt provided by the developer, and have added many of the spec functions from his readme on github as well as from this forum thread including the one you have provided above. Iāve installed and configured the Home Assistant Music Assistant integration through HACS, using the latest beta version (2.0.0b80) since Iām on a more recent version of HASS (2024.1.2).
The Voice Assistant seems to understand my requests and tells me that music is playing on the requested media player, but no media plays. Iāve tried this with various media on various players.
Iāve been able to play this media through the HA Media Assistant GUI to the designated speakers without issue.
Thank you for any guidance on how to troubleshoot.
Ari