Skip to content

Commit

Permalink
Allow for NAME in AREA
Browse files Browse the repository at this point in the history
  • Loading branch information
jozefKruszynski committed Nov 10, 2024
1 parent b21cc70 commit ad835d6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
3 changes: 2 additions & 1 deletion custom_components/mass/intent.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ def __init__(self, hass: HomeAssistant) -> None:
self.hass = hass

slot_schema = {
vol.Any(NAME_SLOT, AREA_SLOT): cv.string,
vol.Optional(NAME_SLOT): cv.string,
vol.Optional(AREA_SLOT): cv.string,
vol.Optional(ARTIST_SLOT): cv.string,
vol.Optional(TRACK_SLOT): cv.string,
vol.Optional(ALBUM_SLOT): cv.string,
Expand Down
17 changes: 17 additions & 0 deletions custom_sentences/en/music_assistant_PlayMediaAssist.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@ intents:
requires_context:
domain: "media_player"

# TARGET AN AREA AND A NAME
- sentences:
- "<play> <artist> {artist} in [the ]<area> <on> [the ]{name} [<player_devices>] [((with)|(using)) {radio_mode}]"
- "<play> <album> {album} [by <artist> {artist}] in [the ]<area> <on> [the ]{name} [<player_devices>] [((with)|(using)) {radio_mode}]"
- "<play> <track> {track} [by <artist> {artist}] in [the ]<area> <on> [the ]{name} [<player_devices>][((with)|(using)) {radio_mode}]"
- "<play> <playlist> {playlist} in [the ]<area> <on> [the ]{name} [<player_devices>][((with)|(using)) {radio_mode}]"
- "<play> <radio_station> {radio} in [the ]<area> <on> [the ]{name} [<player_devices>]"
expansion_rules:
play: "((play)|(listen to))"
player_devices: "((speaker)|([media] player))"
"on": "(on|using)"
artist: "[the ](artist|band|group)"
track: "[the ](track|song)"
album: "[the ](album|ep|record|compilation|single)"
playlist: "[the ]playlist"
radio_station: "[the ]((radio station)|(radio)|(station))"

# CONTEXT AWARNESS
- sentences:
- "<play> <artist> {artist} [((with)|(using)) {radio_mode}]"
Expand Down
15 changes: 14 additions & 1 deletion custom_sentences/en/play_media_on_media_player.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,33 @@ language: "en"
intents:
MassPlayMediaOnMediaPlayer:
data:

# TARGET AN AREA
- sentences:
- "<play> {query};in [the ]<area> [((with)|(using)) {radio_mode}]"
expansion_rules:
play: "((play)|(listen to))"

# TARGET A NAME
- sentences:
- "<play> {query};<on> [the ]{name} [<player_devices>] [((with)|(using)) {radio_mode}]"
expansion_rules:
play: "((play)|(listen to))"
player_devices: "((speaker)|([media] player))"
"on": "(on|using)"
requires_context:
domain: "media_player"

# TARGET AN AREA AND A NAME
- sentences:
- "<play> {query};<on> [the ]{name} [<player_devices>] [((with)|(using)) {radio_mode}]"
- "<play> {query};in [the ]<area> <on> [the ]{name} [<player_devices>] [((with)|(using)) {radio_mode}]"
expansion_rules:
play: "((play)|(listen to))"
player_devices: "((speaker)|([media] player))"
"on": "(on|using)"
requires_context:
domain: "media_player"

lists:
query:
wildcard: true
Expand Down

0 comments on commit ad835d6

Please sign in to comment.