Closed CheeseySandal closed 4 years ago
Releated to https://github.com/home-assistant/home-assistant/issues/28564 I think.
I did search honestly!
An unknown sensor could have several causes, let's make sure it's the same before merging issues.
media_player
entities? Are those showing and/or updating?I thought I'd fixed it as I noticed that my token had changed, but have changed configuration.yaml to the new token, but still not working. In 0.100.x versions, it successfully created a media_player.plex_tv_ue40h6400
player and the sensor did update.
Here's the plex sensor and tautulli sensor.
And here's plex snippets from my log
2019-11-11 10:43:43 DEBUG (MainThread) [homeassistant.bootstrap] Setting up {'config', 'media_player', 'scene', 'group', 'discovery', 'sensor', 'person', 'device_tracker', 'shopping_list', 'joaoapps_join', 'input_select', 'telegram_bot', 'hue', 'onboarding', 'webhook', 'tts', 'http', 'weather', 'timer', 'openuv', 'device_automation', 'updater', 'auth', 'hassio', 'plex', 'frontend', 'zone', 'cast', 'automation', 'notify', 'logbook', 'google', 'speedtestdotnet', 'cloud', 'sun', 'websocket_api', 'script', 'mqtt', 'mqtt_statestream', 'tplink', 'input_boolean', 'nest', 'api', 'lovelace', 'history', 'system_health', 'panel_custom', 'map'}
2019-11-11 10:43:51 INFO (MainThread) [homeassistant.setup] Setting up plex
2019-11-11 10:43:53 DEBUG (MainThread) [homeassistant.components.plex] Imported Plex configuration
2019-11-11 10:43:53 INFO (MainThread) [homeassistant.setup] Setup of domain plex took 2.3 seconds.
2019-11-11 10:43:56 DEBUG (MainThread) [homeassistant.components.plex] Connected to: plexy (https://REMOVED.eu:32400)
2019-11-11 10:43:56 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event component_loaded[L]: component=plex>
2019-11-11 10:43:57 INFO (MainThread) [homeassistant.components.media_player] Setting up media_player.plex
2019-11-11 10:44:38 DEBUG (MainThread) [plexwebsocket] Websocket connection refused
2019-11-11 10:44:43 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.plex
2019-11-11 10:44:43 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=sensor.plex, old_state=None, new_state=<state sensor.plex=unknown; unit_of_measurement=Watching, friendly_name=Plex (plexy) @ 2019-11-11T10:44:43.219134+00:00>>
And I got this in the plex log??
Nov 11, 2019 10:43:53.927 [0x7f6036ffd700] DEBUG - (Capabilities) Platform 'Home Assistant' not matched by plugin platform requirements
2019-11-11 10:44:38 DEBUG (MainThread) [plexwebsocket] Websocket connection refused
Can you think of anything in your setup that could cause websocket connections to the Plex server to fail? A reverse proxy, firewall, etc?
Nov 11, 2019 10:43:53.927 [0x7f6036ffd700] DEBUG - (Capabilities) Platform 'Home Assistant' not matched by plugin platform requirements
Hmm, when you authenticate to Plex during the HA integration setup, are you using a managed/home user login or the main/admin account?
I think the websocket is my problem but I don't think there's anything on the server to cause issues. It's a dedicated server in a data centre and Plex isn't behind a reverse proxy and there's no firewall installed (will probably live to regret this one day). Do websockets require two way communication (I. E. Need to port forward on my home router?)
If I try and configure through the integration frontend page, I get taken to the plex login page. I successfully sign in with the admin account, then I get redirected to an invalid certificate warning. Clicking allow/continue I then get taken to something like https://mydomain.duckdns.org:8123/api/callback?=1234 which is 404
Thanks for your help so far.
No, websockets communicate over the same port as the plain API calls and shouldn't need any special ports opened. A reverse proxy can need special setup, but that's not the case here. However something is causing the websocket connection to fail and I'm not sure what that is yet.
Is your baseurl
set properly in HA? The redirect after logging into Plex sends you back to your HA instance. An invalid cert or 404 means that step is not working.
Thanks for your patience and help, and I'm pleased to say I'm sorted now and it's working perfectly. I re-read up on the baseurl docs and realised I'd messed up even though my set up had been working for ages.
For any future googlers,
I was accessing HA via https://mydomain.duckdns.org:8123
and I had baseurl: mydomain.duckdns.org
in my config, with 8123 <> 8123 in the router.
So I changed baseurl to baseurl: https://mydomain.duckdns.org:8123
, removed plex:
from my config, and restarted. I then re-added plex via the integrations page, and the redirect back worked, and sensor.plex_myserver
works perfectly and fast.
I'm not quite sure how that would affect the websocket connections, but I'm glad it's working now. I've created #28703 to actually log the error when connecting to the websocket so it can make future troubleshooting easier. Thanks for reporting and troubleshooting with me.
Home Assistant release with the issue:
0.101.0, 0.101.1, 0.101.2, 0.101.3
Last working Home Assistant release (if known): 0.100.x
Operating environment (Hass.io/Docker/Windows/etc.):
Hassio on RP3
Integration:
https://www.home-assistant.io/integrations/plex/
Description of problem: I have a remote plex server. Made necessary changes for 0.100.x and it worked. Since upgrading to 0.100.0,1,2,3 my generated sensor.plex remains unknown. Nothing in logs.
Problem-relevant
configuration.yaml
entries and (fill out even if it seems unimportant):Traceback (if applicable):
Additional information: I've manually configured using configuration.yaml as when I try and configure using the frontend, I can successfully sign into plex, but when I get redirected, it always timesout, and the plex integration never appears.