I’m not sure about the addon and it sure looks like you have it setup correctly, but mine has port 6600 for mpd and 6680 for mopidy. Different things.
Shot in the dark, but maybe try port 6680 in the integration???
I believe @danbutter is right
6600 is mpd, my integration uses the mopidy API, not mpd.
Maybe you should create an issue with the project to allow port 6680 as well.
I would do it, but right now I am swamped with other stuff.
Thanks for your answers guys !
@danbutter I tried the “shot in the dark”, didn’t work unfortunately.
@bushvin You got the right hint, I just submitted this issue : Mopidy API on 6680 port · Issue #158 · hassio-addons/addon-mopidy · GitHub
Hope @frenck will consider it
hello
I’ve had a look at it, and there is indeed no way of reproducing this issue. I’ve looked at it in every angle, but the code seems fine.
I’m thinking along the lines of delays and latency on account of streaming services. Do you use streaming services in your case, or is the music only local?
I have made some change to my code to see if it improves the situation.
can you give it a try?
copy media_player.py
to config/custom_components/mopidy/
on your HA and restart it
I’ve just installed Mopidy on an rpi 4 running Ubuntu 21.10. I ran into an issue while adding the GPG key during the first step of installation as per https://docs.mopidy.com/en/latest/installation/debian/:
toreupfeet@pi4-ubuntu:/$ wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
Perhaps this is why I cannot configure the integration in HA. I’m using a Win10 VirtualBox running Home Assistant OS, core-2021.12.4 and supervisor-2021.12.2.
This is my output when running Mopidy via CLI on the rpi:
toreupfeet@pi4-ubuntu:/$ mopidy
INFO 2021-12-21 20:34:45,794 [4392:MainThread] mopidy.__main__
Starting Mopidy 3.2.0
INFO 2021-12-21 20:34:45,913 [4392:MainThread] mopidy.config
Loading config from builtin defaults
INFO 2021-12-21 20:34:45,917 [4392:MainThread] mopidy.config
Loading config from file:///home/toreupfeet/.config/mopidy/mopidy.conf
INFO 2021-12-21 20:34:45,918 [4392:MainThread] mopidy.config
Loading config from command line options
INFO 2021-12-21 20:34:46,263 [4392:MainThread] mopidy.__main__
Enabled extensions: softwaremixer, m3u, http, local, mpd, file, stream
INFO 2021-12-21 20:34:46,263 [4392:MainThread] mopidy.__main__
Disabled extensions: none
INFO 2021-12-21 20:34:46,564 [4392:MainThread] mopidy.commands
Starting Mopidy mixer: SoftwareMixer
INFO 2021-12-21 20:34:46,568 [4392:MainThread] mopidy.commands
Starting Mopidy audio
INFO 2021-12-21 20:34:46,572 [4392:MainThread] mopidy.commands
Starting Mopidy backends: LocalBackend, FileBackend, M3UBackend, StreamBackend
INFO 2021-12-21 20:34:46,609 [4392:Audio-2] mopidy.audio.actor
Audio output set to "autoaudiosink"
INFO 2021-12-21 20:34:46,628 [4392:MainThread] mopidy.commands
Starting Mopidy core
INFO 2021-12-21 20:34:46,647 [4392:MainThread] mopidy.commands
Starting Mopidy frontends: MpdFrontend, HttpFrontend
INFO 2021-12-21 20:34:46,649 [4392:MainThread] mopidy_mpd.actor
MPD server running at [::ffff:127.0.0.1]:6600
INFO 2021-12-21 20:34:46,653 [4392:HttpFrontend-10] mopidy.http.actor
HTTP server running at [::ffff:127.0.0.1]:6680
INFO 2021-12-21 20:34:46,654 [4392:MainThread] mopidy.commands
Starting GLib mainloop
…and then it stops at that GLib mainloop line. At this point, I go to the HA integrations and click Configure Mopidy (which has been discovered). It returns:
“Do you want to add Mopidy Server Mopidy HTTP server on pi4-ubuntu@6680 (pi4-ubuntu.local:6680) to Home Assistant?”
…I submit.
It returns: “Aborted: Cannot connect to discovered Mopidy Server”
Can someone help me figure this out?
What happens if you browse to your mopidy instance?
http://<hostname/ip>:6680/
You should normally get a webpage with some options.
If not, then your mopidy isn’t installed/configured correctly.
Thank you for the reply. Indeed the web server does not resolve. I’ll try to figure out how to get mopidy up on this Ubuntu 21.10. If anyone has any ideas, feel free to chime in. I’m not an expert.
Ohhh. I had to change the hostname to 0.0.0.0 in the config file.
Massive thanks @bushvin for your fantastic work. Got it working like a charm through HACS with Snapcast, TuneIn and Spotify. One (noob) question though. How can I call the media browser for TuneIn and/or Spotify outside the media player (wanna use the shortcut function in the mini-media-player)?
You are most welcome!
TBH, I did not know this is possible, but I’ll see if I can find something.
This is absolutely great! Thank you very much! Now I really can control mopidy from Home Assistant (before, visiting the site was hard work :D). But playing a specific radio station from the Radio Browser integration via Node Red is far better!
Hi There.
Ive added a few custom integrations already. But somehow, after adding the repository by custom link, installing with HACS and restarting, I can’t find it in my regular Hassio Integrations page.
Any tips?
edit: A hard restart of my Hassio VM solved it.
Now I have to learn how to manually integrate this in the UI Still new. Maybe anyone got a code example? I’d like to integrate search and playlists. Ive only gotten the basic mediaplayer mini (custom)
Damn! I’m stuck at the very first step
My purpose is to install MOPIDY on an HAOS instance on RPI3 in order to play some mp3 files on event trigger.
The real problem is that I failed to find instruction on the installing process.
What I did so far:
I went on the github repository where I found some install instruction:
- Install HACS
- Go to any of the sections (integrations, frontend, automation).
- Click on the 3 dots in the top right corner.
- Select “Custom repositories”
- Add the URL to the repository.
- Select the correct category.
- Click the “ADD” button.
- Go to Home Assistaat settings → Integrations and add Mopidy
- Restart HA
But when at the step #8 i can’t find the Mopidy integration. When I go to “HACS - integrations - custom repositories” the “Mopidy Media Playes component” is there. But when I go to “Settings - Devices and Services” and try add the Mopidy integration I get this answer: " No integrations matched your search, the integration you want to set up might not be available to set up via the UI yet. "
What’s wrong? What’s my mistake?
Does anyone know where to find a detailed tutorial on how to install Mopidy?
Thanks a lot.
Can you check through a terminal or filebrowser if /config/custom_components/mopidy
exists?
If it is not there, it was’t properly installed. If it is, it’s worth a shot restarting you HA completely.
Have a look at the personal repositories list to check if the URL in point #5 was correct.
(“bushvin/hass-integrations”)
Hi Bushvin. Thanks for your hint. Yes, the component is there:
Indeed, after some attempts, now I have the component installed. But I can’t succeed in configuring it. A configuration dialog appears, asking for name and address of a server:
Seems that I just installed a client. Should I install also a server? How?
Let me stress that my purpose is to play some mp3 file though the 3.5mm audio port.
Apologies for my late reply. Life got in the way.
Yes, this integration is the “client” part to the Mopidy Server. You do indeed need to install a mopidy server, either on another machine, or using @frenck 's awesome mopidy addon
Hey @pklemy
I have recently come across your issue, I believe: mopidy resuming normal play before your notification tone is played.
I believe it has to do with the speed at which the automation is executed compared to mopidy actually playing the tune.
adding a static wait resolved it for me.
I have discovered mopidy is not the only one to actually have this issue…
I believe
- wait_template: "{{ not is_state('media_player.ha_player', 'playing') }}"
is the real culprit, as the media_player doesn’t start playing (or report it is playing) immediately. It needs to perform whatever protocol/app handshake before reporting it is playing, so your wait_template
actually sees the player is not playing and does what it needs to do: continue.
So my advice is to add a 5 second wait before your wait_template:
- delay: 5
- wait_template: "{{ not is_state('media_player.ha_player', 'playing') }}"
this way your media player gets the time to actually start playing.