Mopidy doesnot play in hassio

can someone help me with mopidy?
i have this configuration.
but is doesnot play anything.
if i open http://192.168.1.11:6680/iris/ it plays my music on the speakers from the raspberry so that works.
But in hassio i get this message ( The following components and platforms could not be set up:

  • mpd
    Please check your config.)
    I think i got it ok but clearly not.
configuration.yaml
#################################################################  
##                  Mopidy Media Player                        ##
#################################################################

mpd:
  enabled = true
  hostname = 0.0.0.0
  port = 6600
  password = **************
  max_connections = 20
  connection_timeout = 60
  zeroconf = Mopidy MPD server on $hostname
  command_blacklist =
    listall
    listallinfo
  default_playlist_scheme = m3u

in my automations.yaml i got this

##################################################
#                     HA Boot_2                  #
##################################################
  - alias: HA Boot_2
    trigger:
       platform: homeassistant
       event: start
    action:
       service: media_player.play_media
       data_template:
        entity_id: media_player.971d899d_c14c7b06
        media_content_id: /local/music2/boot.mp3
        media_content_type: music  
        

in my script i got this

relaxdeck:
    sequence:
    - service: media_player.play_media
      data:
        entity_id: media_player.main
        media_content_type: playlist
        media_content_id: DeckMusic

    - service: media_player.volume_set
      data:
        entity_id: media_player.971d899d_c14c7b06
        volume_level: 0.60  

What is wrong?

According to the docs the entry in the configuration.yaml file of Home Assistant must be:

media_player:
  - platform: mpd
    host: IP_ADDRESS

Your’s is different, so that’s likely why it does not work.

What you are showing above is the configuration of Mopidy-MPD.
See here, Configuration: https://docs.mopidy.com/en/latest/ext/mpd/
This configuration must be done outside Home Assistant I would think.

1 Like

Many thanks Bouwe
That did the trick.
Now i only need to get him to play the boot message.

Maybe you need to delay the action of playing the boot message for some time after the trigger, until HA is really done starting and is able to execute the task.
Start with 5 minutes, if that works then go down in time to find the minimum required delay-time that works in your system.

i tried this but nothing.

  - alias: HA Boot_2
    trigger:
       platform: homeassistant
       event: start
    action:
     - service: media_player.play_media 
       data_template:
         entity_id: media_player.mpd
         media_content_id: /local/mopidy/playlists/boot.mp3
         media_content_type: 'music'
     - delay: '00:05:00'

when i start hassio mpd is off. And i cant turn it on
then i go to http://192.168.1.11:6680/iris there i choise one of my songs in the playlist
then it starts playing . Then i can turn it off and on again in hassio.
When it is playing or not when i run this script it stops and turns mpd off.
What is wrong? please help


relaxdeck:
    sequence:
    - service: media_player.play_media
      data:
        entity_id: media_player.mpd
        media_content_type: playlist
        media_content_id: DeckMusic

    - service: media_player.volume_set
      data:
        entity_id: media_player.mpd
        volume_level: 0.60  

You need to put the delay-line before the service-line.
Now the 1st action is playing the boot.mp3 file, the 2nd action is to wait 5 mins.

On your second problem, please go to Developer Tools, tab STATES and find the media_player.mpd in the list.
Click on the square icon with the error just left of the name.
What do you see on the card? Is there a power icon? Can you click on it, what happens? When the player is on, what other functionality is shown? Does this functionality all work?

Thanks again Bouwe
For the second problem i still have it.
But iam using hassio and i cant find developer tools.
i fund this instead.

Error executing service <ServiceCall script.relaxdeck (c:bf31a8eefead4b989061afc938c920c2)>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1243, in _safe_execute
    await self._execute_service(handler, service_call)
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 128, in service_handler
    await script.async_turn_on(variables=service.data, context=service.context)
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 193, in async_turn_on
    raise err
  File "/usr/src/homeassistant/homeassistant/components/script/__init__.py", line 188, in async_turn_on
    await self.script.async_run(kwargs.get(ATTR_VARIABLES), context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 151, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 235, in _handle_action
    await self._actions[_determine_action(action)](action, variables, context)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 318, in _async_call_service
    context=context,
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 97, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context
  File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call
    await asyncio.shield(self._execute_service(handler, service_call))
  File "/usr/src/homeassistant/homeassistant/core.py", line 1260, in _execute_service
    await handler.func(service_call)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 210, in handle_service
    self._platforms.values(), func, call, service_name, required_features
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 334, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 358, in _handle_service_platform_call
    await func(entity, data)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/mpd/media_player.py", line 339, in play_media
    self._client.add(media_id)
  File "/usr/local/lib/python3.7/site-packages/mpd/base.py", line 381, in mpd_command
    return wrapper(self, name, args, callback)
  File "/usr/local/lib/python3.7/site-packages/mpd/base.py", line 473, in _execute
    return retval()
  File "/usr/local/lib/python3.7/site-packages/mpd/base.py", line 368, in command_callback
    res = function(self, self._read_lines())
  File "/usr/local/lib/python3.7/site-packages/mpd/base.py", line 311, in _parse_nothing
    for line in lines:
  File "/usr/local/lib/python3.7/site-packages/mpd/base.py", line 538, in _read_lines
    line = self._read_line()
  File "/usr/local/lib/python3.7/site-packages/mpd/base.py", line 527, in _read_line
    raise CommandError(error)
mpd.base.CommandError: [50@0] {add} directory or file not found

maybe you can make sents of it?
the first problem i solved.
this code works fine.

 - alias: HA Boot_2
    trigger:
       platform: homeassistant
       event: start
    action:
     - service: media_player.play_media 
       data_template:
         entity_id: media_player.mpd
         media_content_id: local:track:playlists/boot.mp3
         media_content_type: 'music'
      

I changes /local/mopidy/playlists/boot.mp3 this true this local:track:playlists/boot.mp3

Again i found developer tools.
I must be blind.
But ok this is what it says.

 [media_player.mpd] (https://192.168.1.11:8123/developer-tools/state#) off friendly_name: MPD supported_features: 65471 
![mpd|297x271]

(upload://mqtz5mAv62lNCYzbtGkSScB1uEc.jpeg)

The texst to speak doesnot work also.

mpd

The MPD player is off. First press/click on the orange power icon. After it turns green, try again.
Does that work for you?

No that doesnot work it doesnot turn on.
But i can play music.
But not more then one at the time.
I tried to put 2 after each other seperetid with a , but doesnot work.

It is already nice it says hello to me when i arrive home.
But it would be nice if i can a kind of playlist.

Sorry, I can’t help you any further.
You could try to contact the person who wrote the MPD-code that is now integrated into Home Assistant.

1 Like

Thanks anyway you helpt a lote

You can search this forum for the term ‘mpd’ or ‘mopidy’ and you will find several discussions that might help you. Good luck!