Is Plex integration broken?

Is the integration broken? First I had problems showing the plex sensor but then I tried to remove the integration and add it again but now I can not obtain the token from plex web getting an error.

Also when adding the integration manual the activity sensor show unknown.

What error are you getting when trying to obtain the token?

If you activity sensor is showing ā€˜Unknownā€™, try playing something from Plex. It usually updated then.

Also after playing something the activity sensor is not updating

Hmmm, have you removed the old authorised devices in Plex Web in Settings > Authorized Devices and the any Plex integration in HA.

After, maybe restart Plex and HA and try again?

No difference, I removed all old HA entities from server and restarted Plex Server and HA but the obtaining from website is still not working. And manual adding is still showing the activity sensor with unknown.

So, when adding the integration manually I had to select connect via ssl but not ssl verify, sensor seems to work now. But automatic obtaining token would be better. Will see if it work correct now.

So, some time after Plex server is offline the sensor changes to not available for the activity sensor. That was not the case in the past. When Server is offline it should just show 0 Watching as before not being unavailable in HA:

I literally just had the same thing happen, had some sensors that were unavailable and the integration wasnā€™t finding a second plex server so I removed it, removed the authorized device and tried to reinstall and ran into the same problem getting a token from plex. Updated, restarted, but still doesnā€™t work. Havenā€™t tried the manual setup yet.

Hi, is there any news on this? it was working fine on 0.116, this is the plex sensor was always notifying 0 if it was off or no one playing, and now when the server is off the sensor does not even exist so If you request state it return ā€œUNKNOWNā€ this has broken some automations on my sideā€¦

Please Help!!!

Cheers

Same issue here, would love an update.

Sounds like a bug - maybe enter an issue for it.

Issue reported https://github.com/home-assistant/core/issues/42912

1 Like

I havenā€™t looked at this in a long time but my solution to plex I think was to use

I dug around in my setup and I canā€™t figure out how its working but I know it changes the lights based on the type of content being watched and the time of day. It works in real time based on pause/play. I have the above URL in my notes so and Iā€™m pretty sure I remember that the plex integration was not real-time which is why MQTT was needed.

EDIT. Oops. Looks like the newer plex integration fixes the real-time issue according to Plex + Webhooks (WIP) - #28 by jjlawren

  1. The authentication issue seems to be caused by a change on the Plex side. Iā€™m working to find out what changed and how we can fix it.
  2. The sensor will show ā€œunavailableā€ when the Plex server is unreachable. Since 0.116 the behavior is to unload the integration while we try to reconnect. Once the Plex server comes back online it will reconnect automatically.

If your Plex server is running but youā€™re still seeing the sensor is ā€œunavailableā€, please create a Github issue and Iā€™ll investigate further. It should always show a count if the server is running.

Iā€™m pretty sure I remember that the plex integration was not real-time

The Plex integration has used realtime updates via websockets for about a year now, since 0.101.

hi, but in the past if it was unavailable (server down) and I request the state of sensor.plex the returned value was 0 and this was OK.

The problem is that if the server is down now the returned value is Unknown.

Thanks for your help.

Cheers

Correct, that has changed.

I assume this is breaking some template entities or automations. Share what you have and I can try to help fix them.

Ok I Have an automation to run after midnight to turn off my NAS, the conditions are:
Shield must be off
Backups server must be off
and no one should be playing anything from plex ( so in the past it was as easy just to check that Plex.sensor state was cero ā€œ0ā€)

if this 3 conditions were true then the server can safely shut down and if not it will keep checking every 15 minutes.

this automation is not working now because if plex is down or plex is up but no player is connected it returns ā€œUnknownā€, it only returns state 0 if a player is connected but not playing anything.

I hope this makes sense

Cheers

Yep, make sense. You should be able to add the ā€˜unavailableā€™ state into the condition check for the Plex sensor. This will then match when the Plex server is down, or when there are zero active playback sessions:

- condition: state
  entity_id: sensor.plex
  state:
    - 0
    - unavailable

Mmmm Interestting, will try that.

Thx

Fix for the auth issue is available in 0.117.6.