memen45 / SubMusic

Sync music and podcasts to your Garmin watch from your own SubSonic or Ampache server
GNU General Public License v3.0
122 stars 13 forks source link

Plex - Initial Setup Help / More Documentation Please #57

Closed MichaelRBlack closed 1 year ago

MichaelRBlack commented 2 years ago

Hi, I'm excited to see support come for plex. I'm trying to get it setup. How can I validate that I have correct settings?

This is what have entered into the SubMusic Settings:

Then on my phone, I select SubMusic as the provider and then go to Select Playlists and the watch says it's fetching but then gives me this error:

GarminSdkError::0
Error HTTP ->
GarminSdkError::-UNKNOWN_ERROR

What did I do wrong?

exonight commented 2 years ago

You can test the domain and key you send to plex with the following html link on a different device: https://URL:PORT/?X-Plex-Token=TOKEN Mine looks something like: https://IPADDRESS.a1a1a1a1a1a1a1a1a1a1a1a.plex.direct:32400/?X-Plex-Token=AaaaaaaAAAaaaa You should get XML back with information about you server and your login.

Is WiFi set up on your watch and known to be working?

Have you tried the Test Server function below playlists or Syncing first to see if it connects that way before trying to sync playlists?

Finally there were a number of people who reported problems till they moved their plex port to a standard web port. I have not had the same troubles so I hesitate recommending that.

MichaelRBlack commented 2 years ago

I've been able to confirm that my XML token is working correctly. The Test Server hasn't come back succesful yet. I've moved my plex to be on the standard port. I also noticed that my plex server settings were requiring SSL and when using a web browser it would give a warning about trusting the certificate. I've changed in plex to Prefer SSL but not require it. I'm wondering if my Mesh Wifi might be causing issues so the next chance I get to connect my watch to a different WiFi I'm going to see if that resolves any addressing issues.

memen45 commented 2 years ago

Were you able to fix the issue? In most cases, a reverse proxy is the easy solution. There are some (free) services I believe that add https as well. Or you could set up your own of course (see #33 for some ideas).

MFXM commented 2 years ago

Hi, I'm excited to see support come for plex. I'm trying to get it setup. How can I validate that I have correct settings?

This is what have entered into the SubMusic Settings:

  • API Backend: Plex API
  • ServerAddress: https://mydomain.com:32400
  • Username: my_user_name
  • API Key: followed the documentation to look at the XML for the token
  • Authenication method: API
  • Enable Skip: selected

Then on my phone, I select SubMusic as the provider and then go to Select Playlists and the watch says it's fetching but then gives me this error:

GarminSdkError::0
Error HTTP ->
GarminSdkError::-UNKNOWN_ERROR

What did I do wrong?

Have you tried setting the URL to the plex.direct address (i.e. https://IP-ADRESS.someHashValue.plex.direct:32400)? For me this solved the issue without any reverse proxy needed.

djirku commented 2 years ago

Hi! I solved this issue @MFXM @MichaelRBlack

I am on Apple iOS. I needed the Garmin Connect App open on my phone when I made the first Test/Browse request on my watch.

The phone then prompts the user to allow the device access to the network. Once you grant that, the watch app is able to browse the Plex server, view playlists and sync selected ones!

Thanks for making this app @memen45

MichaelRBlack commented 2 years ago

@memen45 unfortunately I have not been able to get this to work yet. I had the opportunity to try from a different network outside of my home network even. Plex I can access remotely so I know my Plex server is publicly accessible. Everything I try with the Submusic app I still get that generic error.

I've tried using my domain, the ip address, http, https, no prefix at all

MichaelRBlack commented 2 years ago

Hi, I'm excited to see support come for plex. I'm trying to get it setup. How can I validate that I have correct settings? This is what have entered into the SubMusic Settings:

  • API Backend: Plex API
  • ServerAddress: https://mydomain.com:32400
  • Username: my_user_name
  • API Key: followed the documentation to look at the XML for the token
  • Authenication method: API
  • Enable Skip: selected

Then on my phone, I select SubMusic as the provider and then go to Select Playlists and the watch says it's fetching but then gives me this error:

GarminSdkError::0
Error HTTP ->
GarminSdkError::-UNKNOWN_ERROR

What did I do wrong?

Have you tried setting the URL to the plex.direct address (i.e. https://IP-ADRESS.someHashValue.plex.direct:32400)? For me this solved the issue without any reverse proxy needed.

What is someHashValue, is that the token you find from the XML url? Do you still provide a username and api key when supplying this direct URL method?

MichaelRBlack commented 2 years ago

It's almost as if the app is not able to access the WiFi settings of my watch. As a test, I removed all saved WiFi networks from my phone, reboot my watch, saved SubMusic settings, then within the app tested the server. I got the generic error as I would expect without having any WiFi settings saved. I then used the Connect app to get onto the WiFi and tested again, same generic error. I'm thinking there's something either with my watch or app that isn't getting the WiFi correctly.

MFXM commented 2 years ago

Hi, I'm excited to see support come for plex. I'm trying to get it setup. How can I validate that I have correct settings? This is what have entered into the SubMusic Settings:

  • API Backend: Plex API
  • ServerAddress: https://mydomain.com:32400
  • Username: my_user_name
  • API Key: followed the documentation to look at the XML for the token
  • Authenication method: API
  • Enable Skip: selected

Then on my phone, I select SubMusic as the provider and then go to Select Playlists and the watch says it's fetching but then gives me this error:

GarminSdkError::0
Error HTTP ->
GarminSdkError::-UNKNOWN_ERROR

What did I do wrong?

Have you tried setting the URL to the plex.direct address (i.e. https://IP-ADRESS.someHashValue.plex.direct:32400)? For me this solved the issue without any reverse proxy needed.

What is someHashValue, is that the token you find from the XML url? Do you still provide a username and api key when supplying this direct URL method?

If you view the XML file via the browsers you usually will see the Plex direct URL. I just set this one including the port (as described above) as the URL and provide the API Key (which can be found out also via the URL you see in your browser while opening the XML file). The user name is not required/used.

memen45 commented 2 years ago

Depending on the watch model, there may be differences:

These limitations may differ between menu browsing and 'Test server' on the one hand (ports, https etc is handled by phone Bluetooth tethering) versus Sync on the other hand (watch wifi chip connects directly to the wifi network you set up in watch settings).

If you have tried to copy the Plex direct url (Login remotely to plex.app, then open the developer tools, network tab, there you will see a list of requests to your Plex direct url as well as the token, copy the url to SubMusic settings as well as the token), but it is not working still, I would suggest to set up a reverse proxy with https. Either host it yourself through e.g. Apache or Nginx (google 'plex reverse proxy'), or maybe try and find an online service to do it for you.

If you still encounter the same error, you can also send me more details through the 'Contact developer' option on Garmin Connect. I may be able to debug against your server to see if there is another issue!

MichaelRBlack commented 2 years ago

I'm checking in with my latest efforts.

While testing https://URL:PORT/?X-Plex-Token=TOKEN on a web browser I noticed that I was getting an untrusted SSL cert warning (I had never gone through the effort of setting up a signed cert for plex so I thought now was as good of a time as any). I went through a set up a subdomain for my plex server, got the reverse proxy working, and a SSL cert created and verified so web browsers don't warn me anymore about the site.

This has revealed a new error:

Test failed:
GarminSdkError::-2
Error HTTP -->GarminSdkError::BLE_

I also saw where I can find my plex direct URL and I've been trying variations between http vs https, subdomain vs plex.direct but this new error remains when trying to test the server. I'm hopeful with this new error and the work to setup a subdomain with SSL is getting me closer. I'm going to rereading through the suggestions here to make sure I haven't missed trying a recommendation.

memen45 commented 2 years ago

BLE_HOST_TIMEOUT is the exact error, and this would indicate an issue with your phone connection. I have had the same issue and it solved itself after a while. Probably restarting the Garmin Connect app, your phone or the Garmin watch could solve the issue as well.

MichaelRBlack commented 2 years ago

Any other advice for debugging what might be going on? I just keep trying the various permutations of suggestions around using the direct url vs. my doman, restarting devices, rejoining wifi networks, havin the connect app open on my phone vs. closed, etc...

memen45 commented 1 year ago

Any updates? @MichaelRBlack

MichaelRBlack commented 1 year ago

I'm happy to report that I gave it another attempt today and it's WORKING! 😭 I don't know why this time but I'm just happy that it is. Things that I did was verify that my DNS and subdomain was all working correctly testing against just using a web browser to access my Plex server. Then I went to the Garmin store and noticed the app had an update which I applied. From there everything started working on the watch. I can browse playlists and was able to sync music. This is going to make me so happy to have an easier way to have fresh music to listen to during my workouts.

jamesandersen commented 1 year ago

@MichaelRBlack can you share the format of the settings you ended up with? e.g. did you end up with a xxx.plex.direct domain for the server setting?

@memen45 is there some curl command we can try (comparable to what the watch is doing when it tries to sync) to help troubleshoot this? Also if I'm not seeing some garmin 300 error while my server address is using port 32400 does that mean my watch is one that can access custom ports (so I can rule out needing some reverse proxy solution)?

I've been messing with settings on my router, my nas, my plex installation, the IQ connect settings etc ... so far I can very consistently see my playlists and NOT sync anything ... I typically just see sync hanging at 0% indefinitely

I'm really excited at the prospect of getting this working (and would be happy to make a donation if I can) - thanks for all the effort on this!

memen45 commented 1 year ago

Yes you can add /identity to the server address you find (note that the server address has no trailing slash). It should return a JSON or XML content. If you do it in the browser and you get a blank page, right-click > view source.