petro-kushchak / homebridge-homepod-radio

MIT License
39 stars 2 forks source link

Playing mp3 doesn't work. #30

Closed Matt-Eagle-Pi closed 1 year ago

Matt-Eagle-Pi commented 1 year ago

Hi Petro. Hi all!

The Stream to my homepod does not work. These are the my atvremote scan results:

Scan Results

   Name: Wohnzimmer

Model/SW: HomePod Mini, tvOS 16.2 Address: 192.168.0.xxx MAC: 58:D3:49:2B:8B:82 Deep Sleep: False Identifiers:

The Speaker from the hombridge-plugin is shown in Homekit . But when I trigger the event in shortcut, nothing happens.

The manual trigger with the command:

ffmpeg -i http://homebridge.local.4567/var/www/media -f mp3 - | atvremote --id 58D3492B8B82 stream_file=mail.mp3

gives a Server-Error-Reply: HTTP error 500 Internal Server Error and No such file or directory

But the directory exists. Can anyone give me a hint to solve that?

@Petro: In addition, i have a question. As you mentioned in the instructions, it is posible to play mp3-files from the Server (in my case a rasperry-pi) and stream them to the HomePod Mini (same Network). Is this right?

My idea is the following:

Trigger -> VibrationSensor -> Play mp3 and stream to my hompod mini -> "Mail_has_been_delivered.mp3"

Would that be possible?

Thanks!

petro-kushchak commented 1 year ago

Hi, looks like URL which you pass to ffmpeg is not correct, try

http://homebridge.local.4567/var/www/media/mail.mp3

Matt-Eagle-Pi commented 1 year ago

Hi Pedro.

Now I tried the following command:

ffmpeg -i http://192.68.0.xxx:4567/var/www/media/mail.mp3 -f mp3 - | atvremote --id 58D3492B8B82 stream_file=-

and get this output: [tcp @ 0x16715b0] Connection to tcp://192.68.0.xxx:4567 failed: Connection timed out http://192.68.0.xxx:4567/var/www/media/mail.mp3: Connection timed out

Do you know, how to fix this?

petro-kushchak commented 1 year ago

Looks like URL to mp3 file is not correct. Did you test this URL from other devices within tour network?

Matt-Eagle-Pi commented 1 year ago

From my laptop I get this {"error":true,"message":"Unsupported request"}:

I tried the Url: http://192.168.0.xxx:4567/var/www/media/play/mail.mp3

petro-kushchak commented 1 year ago

Hi,

To play mail.mp3 on HomePod using plugin you have to do the following:

  1. put mail.mp3 to some directory on your Homebridge server (in your example it could be /var/www/media)
  2. Configure plugin to use that directory when playing files (in your example set mediaPath= /var/www/media)
  3. Configure plugin to use some HTTP port for processing requests (in your example set httpPort=4567)
  4. Test that file is accessible by invoking from browser http://homebridge.local:4567/play/mail.mp3

Once it works - you can create simple automation which would just "get contents of URL" (in your example http://homebridge.local.4567/play/mail.mp3)

Let me know if this works, will try to add more configuration examples on how to use this feature :)

Matt-Eagle-Pi commented 1 year ago

Hi Petro. Many thanks for your support, so far!

I guess, I know, why the url doesn't work. My homebridge isn't installed as an exclusive hombridge-image to my Pi. The installation is on top of a raspi-debian with extra port-offset. In my case I use the IP plus Port, e.g. 192.168.1.123:8888 to get access to my homebridge in my local network.

If I use the url: http://192.168.1.123:4567/play/mail.mp3, it does not work.

Any ideas?

Matt-Eagle-Pi commented 1 year ago

Hi Petro,

the URL: ttp://192.168.0.123:8888/play/ -f mp3 - | atvremote --id 58D3492B8B82 stream_file=/home/pi/media/mail.mp3 works!

Now I have to figure out, how this works with the plugin.

Matt-Eagle-Pi commented 1 year ago

It ist done!

The two things were missing or set wrong:

Thanks! Issue can be closed!

petro-kushchak commented 1 year ago

Hi, sorry for late response - great that you managed to solve these issues :)