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

Error Code Syncing Plex from Server on ReadyNAS #58

Closed cvernon0 closed 2 years ago

cvernon0 commented 2 years ago

Hi there, Thanks for developing this app.

I'm having a bit of trouble with it. I'm not able to log in or sync from my Plex server that's hosted on a NAS device running Linux.

I'm getting error 300 or error 400.

SubMusic set up address= https://192.168.1.XXX:443

Username is my Plex username.

API Key I obtained from the View XML on "Get Info" in the plex app. Double and triple-checked the key to make sure it's correct for that server.

Authentication method=API

Enable Skip=on

Is there anything I'm missing in my set up here? Not sure how to get logs, but I can provide if you can let me know how.

Many thanks

memen45 commented 2 years ago

Thanks for your feedback! I see several potential causes why it is not working:

I would recommend setting up a reverse proxy with https, which proxies to your local Plex ip:port

Hope the above helps!

cvernon0 commented 2 years ago

Thanks for the tips, but unfortunately those steps seem pretty far beyond my capabilities. I have no idea how to do a reverse proxy, is that a command line thing? Is there a simple way to configure this to work if I'm not concerned about certificates, https, etc? Use only port 80?

I've deleted Plex from my NAS and am just running it from a computer on my LAN now. I thought having two Plex servers was complicating things. The server is at 192.168.1.15, so do I point SubMusic to that LAN IP address or to my modem IP address? What port should I specify in Plex and do I need to forward that port on my router? Do I need to specify that port in SubMusic? Is 32400 not the right port to use? I'm confused by that because Plex won't allow you to use any other port for the private port, but you can specify any unused port as the public port.

Thanks again

memen45 commented 2 years ago

Garmin watch software can only use port 80/443 and does not understand the :port custom port in the url. Therefore, the only way to choose the port is using http:// vs https:// in your url.

You can try to use port 80 without https certificates, however, some Garmin devices do require HTTPS, so it might still not work. The way to test it is using your browser to go to the ip address, then check if it is indeed showing Plex. Then copy the exact same url to the SubMusic settings.

If you set the Plex public port to 80, can you find the working url in the browser? I am not sure whether the Plex public port setting opens the port on the device, or remote, so you have to test. You can try to access the local LAN IP address from your browser. If it works, SubMusic can be pointed to the same IP address.

Other option is to simply port forward on your modem/router with external port 80 and internal ip:port of the Plex server. SubMusic should be pointed to the modem/router IP address in that case.

If you choose local ip, note that

If you choose remote ip, note that

thekiefs commented 2 years ago

hi @memen45 - thanks for the support.

After your comment in #56, I followed this guide and setup a proxy server on my Unraid Plex server in Docker. Plex responds great in a browser to both https://plex.domain.com, http://plex.domain.com/ whether on the local network or through remote.

However, when I configure either of the URLs in Garmin and try to test the server, I get the following error:

GarminSdkError::-2 Error HTTP --> GarminSdkError::BLE_HOST_TIMEOUT

Additionally, when I disable Bluetooth (but keep watch wifi enabled and connected on the watch), I get this error immediately after hitting test server

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

Edit- this error seems to have gone away. However, when I try to sync a playlist, the sync completes very quickly, and no music ever seems to be downloaded as playlist says "0 mins - needs sync". I can open a new bug if that's easier.

cvernon0 commented 2 years ago

Hi @memen45, thanks for the tips. I definitely made progress but now I have the same problem as @thekiefs .

My ISP gives me a static IP so my URL setting is just to my IP address, I'm using port 80 and that part seems fine. I can fetch playlists when I'm on the local network and outside it as well.

Because I can fetch playlists successfully from the Plex server, I know it must be connected at least to some extent. I can select the playlists I want to sync, however when I try to sync I'm getting the same error as @thekiefs mentioned above.

When I try to sync the playlists, it syncs very quickly (too quickly for the amount of data involved), and then shows green "Transfer complete." However, nothing actually gets transferred. If I run "test server" it reads "Inlog OK" but then stops there and freezes, and then displays "Garmin SDKError::2.... Host timeout."

Thanks again,

memen45 commented 2 years ago

Thanks for your detailed feedback! Can you confirm that Test Server option is handled by the phone Bluetooth connection? If the phone is not connected, there would be no internet and a timeout/not connected error would be expected.

During sync, however, the watch changes to its own wifi connection. This is where additional requirements come in, depending on the watch. Please refer to #42 also, and most likely it is required to switch to HTTPS with correct ssl ciphers. That would also require a domain name and DNS record of course.

@cvernon0 I am not sure whether https is built-in to Plex? Otherwise, you need a reverse proxy with valid certificates.

@thekiefs If needed, you can always create a test account and send me some temporary login through the 'Contact developer' option on Connect IQ. That way I can debug against your server instance to see if there is another issue.

memen45 commented 2 years ago

Hey @thekiefs, do you still get the same BLE_HOST_TIMEOUT error or were you able to find the cause? I now have the same error, while using Ampache backend, so I am wondering if this is some larger issue.

thekiefs commented 2 years ago

Hi @memen45 - I no longer get the BLE_HOST_TIMEOUT error.

When I "Test Server" I receive "Inlog OK".

But, I am still experiencing what @cvernon0 describes.

Do you want me to send you logs, or - happy to send you a test account

memen45 commented 2 years ago

Yes, both logs and a test account could help a lot!

Without the BLE_HOST_TIMEOUT error, the sync problem might be because the watch requires https certificates. When fetching playlists and 'Test server', the watch connects through the phone. During sync, the watch connects to wifi and the url by itself, and thus may have different requirements.

thekiefs commented 2 years ago

Great. I couldn't find how to send logs but I sent you info for the test account!

memen45 commented 2 years ago

@cvernon0 I have released a new version: 0.2.5-argalus. I have found a bug where the request limit was not set during sync. The update might solve this issue, but I am not 100% certain. Let me know if you still encounter any issues!

thekiefs commented 2 years ago

Works great for me now!

cvernon0 commented 2 years ago

Works great for me now as well! Thanks for the support @memen45.

Edit: I just noticed that there seems to be a 40 minute limit for playlist sync. I had a playlist of 65 minutes, only synced 40 minutes, Another playlist of 75 minutes - synced only 40 minutes. Not a big issue and I can work around it, but just wanted to make sure you were aware of it.

memen45 commented 2 years ago

Thanks for all your feedback! I will close this issue and open two new ones for the standing problems.

thekiefs commented 2 years ago

Without the BLE_HOST_TIMEOUT error, the sync problem might be because the watch requires https certificates. When fetching playlists and 'Test server', the watch connects through the phone. During sync, the watch connects to wifi and the url by itself, and thus may have different requirements.

hey @memen45 - unfortunately I broke my phone and only have access to my watch and computer. While I wait for a new phone, I tried checking available playlists and syncing music. When I try to browse/select playlist and test server from the music settings screen, I get an IQ! screen. I also ran into the BLE error again.

Any way we could have a fallback to wifi in the event bluetooth is unavailable?

memen45 commented 2 years ago

As far as I know, it is not possible to use the wifi connection for everything. Browsing the server requires Bluetooth connection, but you can remove local and synced playlists. The sync should still be working using wifi, though.

Exceptions should not occur while browsing, it should just show 'Nothing to show', I think. I can look into these exceptions tomorrow.