54 lines
7.7 KiB
JSON
54 lines
7.7 KiB
JSON
[
|
|
{
|
|
"id": "Musicbox - Controls",
|
|
"result": {
|
|
"structured": "TRIGGER: When an MQTT message is received on topic musicbox/controls. CONDITIONS: None. ACTIONS: Store the MQTT payload in variable 'action'. Then, based on the value of 'action': IF action equals 'volume_up' THEN increase volume for media_player.spotify_tobias_munzert AND media_player.music_player_daemon AND media_player.49pus6401. IF action equals 'volume_down' THEN decrease volume for media_player.49pus6401 AND media_player.music_player_daemon AND media_player.spotify_tobias_munzert. IF action equals 'playpause' THEN: IF media_player.music_player_daemon repeat attribute is 'all' THEN set repeat to 'one' for media_player.music_player_daemon AND media_player.spotify_tobias_munzert. OTHERWISE set repeat to 'all' for media_player.music_player_daemon. THEN, IF media_player.spotify_tobias_munzert source attribute is 'sk61' THEN set repeat to 'one' for media_player.spotify_tobias_munzert. IF action equals 'prev' THEN: IF music player device 1 [81920bfa76a06fe06068b75dfb2b912b] is playing THEN go to previous track for media_player.music_player_daemon. OTHERWISE IF music player device 2 [44286d1faf0e2fd39b95ed26fe57cdcb] is playing AND media_player.spotify_tobias_munzert source attribute is 'sk61' THEN go to previous track for media_player.spotify_tobias_munzert. IF action equals 'next' THEN: IF music player device 1 [81920bfa76a06fe06068b75dfb2b912b] is playing THEN go to next track for media_player.music_player_daemon. OTHERWISE IF music player device 2 [44286d1faf0e2fd39b95ed26fe57cdcb] is playing AND media_player.spotify_tobias_munzert source attribute is 'sk61' THEN go to next track for media_player.spotify_tobias_munzert. IF action does not match any of the above, log an error message.",
|
|
"natural_language": {
|
|
"trigger": "The automation is triggered when a message is received on the MQTT topic 'musicbox/controls'.",
|
|
"conditions": "There are no conditions that must be met before executing the actions.",
|
|
"action": "The automation first stores the content of the MQTT message in a variable. It then checks the value of this variable to decide what to do. If the message is 'volume_up', it increases the volume on the Spotify, Music Player Daemon, and TV media players. If the message is 'volume_down', it decreases the volume on the same three players. If the message is 'playpause', it toggles the repeat mode: if the Music Player Daemon is set to repeat all, it changes it to repeat one for both the Music Player Daemon and Spotify; otherwise, it sets the Music Player Daemon to repeat all. It then checks if the Spotify player's source is 'sk61' and, if so, also sets it to repeat one. If the message is 'prev', it checks which device is playing. If the first music player device is playing, it goes to the previous track on the Music Player Daemon. If the second music player device is playing and the Spotify player's source is 'sk61', it goes to the previous track on Spotify. The logic for 'next' is identical, but it goes to the next track instead. If the message does not match any of these known commands, it logs an error."
|
|
},
|
|
"human_like": "This automation controls multiple music players (like Spotify and a local music server) via MQTT commands, allowing you to adjust volume, change tracks, and toggle repeat modes from a central interface.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "Musicbox MPD Single Playback",
|
|
"result": {
|
|
"structured": "TRIGGER: When music player daemon [media_player.music_player_daemon] changes state to playing. CONDITIONS: spotify tobias munzert [media_player.spotify_tobias_munzert] attribute 'source' is sk61. ACTIONS: Pause spotify tobias munzert [media_player.spotify_tobias_munzert].",
|
|
"natural_language": {
|
|
"trigger": "When the music player daemon [media_player.music_player_daemon] starts playing.",
|
|
"conditions": "If the spotify tobias munzert [media_player.spotify_tobias_munzert] is currently set to the source 'sk61'.",
|
|
"action": "Pauses the spotify tobias munzert [media_player.spotify_tobias_munzert] media player."
|
|
},
|
|
"human_like": "Pauses the Spotify player when the MPD player starts playing, ensuring only one audio source is active at a time.",
|
|
"complexity": "low"
|
|
}
|
|
},
|
|
{
|
|
"id": "Musicbox - Playback Controller",
|
|
"result": {
|
|
"structured": "TRIGGER: When an MQTT message is received on topic musicbox/playback. CONDITIONS: None. ACTIONS: Parse the JSON payload into variables: data, data_id, action, content_tag, content_ha, content, content_uri, content_domain, content_type, content_id. Then, if content_ha equals 'Tag ' concatenated with data_id as a string AND content_tag is not empty, do nothing. Otherwise, choose based on action: If action equals 'start_playback', then if content_domain equals 'spotify', trigger musicbox spotify start playback [automation.musicbox_spotify_start_playback] with variables content, content_type, content_id; else if content_domain equals 'mpd', trigger musicbox start playback mpd [automation.musicbox_start_playback_mpd] with variables content, content_type, content_id. If action equals 'resume_playback', then if content_domain equals 'spotify', trigger musicbox spotify resume playback [automation.musicbox_spotify_resume_playback] with variable content; else if content_domain equals 'mpd', trigger musicbox mpd resume playback [automation.musicbox_mpd_resume_playback] with variable content. If action equals 'pause_playback', then if content_domain equals 'spotify', trigger musicbox spotify pause playback [automation.musicbox_spotify_pause_playback] with variable content; else if content_domain equals 'mpd', trigger musicbox mpd pause playback [automation.musicbox_mpd_pause_playback] with variable content. If no condition matches, log an unsupported action or domain message.",
|
|
"natural_language": {
|
|
"trigger": "When an MQTT message arrives on the topic 'musicbox/playback'.",
|
|
"conditions": "There are no explicit conditions; the automation proceeds directly to actions after parsing the message.",
|
|
"action": "The automation extracts data from the JSON payload and sets up several variables. It first checks if the content appears to be a tag with a specific format; if so, it does nothing. Otherwise, it interprets the 'action' field. For 'start_playback', it triggers either the Spotify or MPD start playback automation based on the content domain, passing along relevant content details. For 'resume_playback' or 'pause_playback', it similarly triggers the corresponding Spotify or MPD automation. If the action or domain is not recognized, it logs an error message."
|
|
},
|
|
"human_like": "This automation acts as a central controller for music playback, routing MQTT commands to start, resume, or pause music on either Spotify or MPD based on the message content.",
|
|
"complexity": "high"
|
|
}
|
|
},
|
|
{
|
|
"id": "Musicbox Spotify Single Playback",
|
|
"result": {
|
|
"structured": "TRIGGER: When spotify tobias munzert [media_player.spotify_tobias_munzert] changes state to playing. CONDITIONS: The source attribute of spotify tobias munzert [media_player.spotify_tobias_munzert] is sk61. ACTIONS: Pause music player daemon [media_player.music_player_daemon].",
|
|
"natural_language": {
|
|
"trigger": "When the Spotify player named spotify tobias munzert [media_player.spotify_tobias_munzert] starts playing.",
|
|
"conditions": "The Spotify player must be using the source named 'sk61'.",
|
|
"action": "Pauses the other media player named music player daemon [media_player.music_player_daemon]."
|
|
},
|
|
"human_like": "Pauses the main music player when a specific Spotify player starts using a particular source, ensuring only one plays at a time.",
|
|
"complexity": "low"
|
|
}
|
|
}
|
|
] |