From 56e3245eff7db075766be0757a3984e4fa00638c Mon Sep 17 00:00:00 2001 From: Mark Ferry Date: Tue, 21 May 2024 18:09:30 +0100 Subject: [PATCH 1/3] config: add home_assistant.use_mopidy Use bushvin's custom mopidy integration for HomeAssistant from https://github.com/bushvin/hass-integrations instead of the core mpd integration --- config.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config.json b/config.json index eaf79dc..01d2532 100644 --- a/config.json +++ b/config.json @@ -12,6 +12,9 @@ "chromecast": { "device": "default:CARD=ICUSBAUDIO7D" }, + "home_assistant": { + "use_mopidy": false + }, "mopidy": { "host": "media", "path": "/var/lib/mopidy/bin/mopidy" From 95497e0e614f3a939fd1522d2c02bf64b4cb864a Mon Sep 17 00:00:00 2001 From: Mark Ferry Date: Tue, 21 May 2024 18:11:20 +0100 Subject: [PATCH 2/3] ha: use mopidy platform if enabled otherwise use mpd --- templates/home-assistant.yaml.template | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/templates/home-assistant.yaml.template b/templates/home-assistant.yaml.template index 0928a4f..7e9d568 100644 --- a/templates/home-assistant.yaml.template +++ b/templates/home-assistant.yaml.template @@ -1,11 +1,19 @@ {{#zone}} media_player: - - platform: mpd + {{! use localhost for dev}} + - host: {{#dev}}localhost{{/dev}}{{^dev}}{{mopidy.host}}{{/dev}} + {{! use mopidy custom extension if enabled}} + {{#home_assistant.use_mopidy}} {{! use slugified name if available}} + name: {{#name_}}{{name_}}{{/name_}}{{^name_}}{{name}}{{/name_}}_mopidy + port: {{mopidy.http_port}} + platform: mopidy + {{/home_assistant.use_mopidy}} + {{^home_assistant.use_mopidy}} name: {{#name_}}{{name_}}{{/name_}}{{^name_}}{{name}}{{/name_}}_mpd - {{! use localhost for dev}} - host: {{#dev}}localhost{{/dev}}{{^dev}}{{mopidy.host}}{{/dev}} port: {{mopidy.mpd_port}} + platform: mpd + {{/home_assistant.use_mopidy}} {{#kodi}} - platform: kodi @@ -17,7 +25,12 @@ media_player: - platform: group name: {{#name_}}{{name_}}{{/name_}}{{^name_}}{{name}}{{/name_}}_multizone_audio entities: + {{#home_assistant.use_mopidy}} + - media_player.{{#name_}}{{name_}}{{/name_}}{{^name_}}{{name}}{{/name_}}_mopidy + {{/home_assistant.use_mopidy}} + {{^home_assistant.use_mopidy}} - media_player.{{#name_}}{{name_}}{{/name_}}{{^name_}}{{name}}{{/name_}}_mpd + {{/home_assistant.use_mopidy}} {{#kodi}} - media_player.{{#name_}}{{name_}}{{/name_}}{{^name_}}{{name}}{{/name_}}_kodi {{/kodi}} From 92530fd727e8b873decc0f1b41ea73f844668e39 Mon Sep 17 00:00:00 2001 From: Mark Ferry Date: Tue, 21 May 2024 20:21:47 +0100 Subject: [PATCH 3/3] announcer does not use mopidy This overrides the global setting. --- config.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config.json b/config.json index 01d2532..d8ef4be 100644 --- a/config.json +++ b/config.json @@ -227,8 +227,10 @@ { "name": "announcer", "Name": "Announcer", + "home_assistant": { + "use_mopidy": false + }, "mopidy": { - "http_port": "6680", "mpd_port": "6600", "mpd_only": true },