custom-components / sensor.plex_recently_added Goto Github PK
View Code? Open in Web Editor NEW▶️ Plex component to feed Upcoming Media Card.
License: Apache License 2.0
▶️ Plex component to feed Upcoming Media Card.
License: Apache License 2.0
I started getting this after updating to .7
2018-11-22 15:57:43 ERROR (MainThread) [homeassistant.components.sensor] plex_recently_added: Error on device update! Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 251, in _async_add_entity await entity.async_device_update(warning=False) File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update await self.hass.async_add_executor_job(self.update) File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/sensor/plex_recently_added.py", line 224, in update overview = get_info(self.api_json[0].get('title', '')) File "/config/custom_components/sensor/plex_recently_added.py", line 372, in get_info return tmdb_json['results'][0]['overview'] IndexError: list index out of range
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...
I have a connection set up with a remote server of a friend. I would like to be notified if something changes in his server, but the sensor.plex_recently_added component appears to just look at my own movies and series.
Describe the solution you'd like
A clear and concise description of what you want to happen.
It would be great if Sensor.plex_recently_added would also find the recently added movies/episodes of the remote server
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I tried to setup additional platform descriptions in my configuration.yaml but in order to connect with the remote server I would need to know the token of the remote server. My friend obviously does not want to share his token as that would make his setup unsecure..
It should be possible to get the recently added information via the connection with my server, as I can see his newly added content in my plex app.
Additional context
Add any other context or screenshots about the feature request here.
2019-06-06 21:06:43 WARNING (MainThread) [homeassistant.helpers.config_validation] Your configuration contains extra keys that the platform does not support.
Please remove [server]. (See /config/packages/plex_recently_added.yaml, line 5).
Offending data: {"platform": "plex_recently_added", "token": "", "server": "IIIdefconnasIII", "ssl": "", "ssl_cert": "", "download_images": "", "max": "", "section_types": ""}
Describe the Bug
I cannot get the sensor working. Home Assistant gives me the following error:
File "/home/homeassistant/.homeassistant/custom_components/sensor/plex_recently_added.py", line 7
^
SyntaxError: invalid syntax
Indicate if you followed all steps in the troubleshooting doc
Well, did you? I tried.
What data does the sensor display if any?
Nothing
What displays when visiting the API URL from the troubleshooting guide?
It shows me the whole XML as intended
Does the default Home Assistant Plex component work for you?
Yes
Home Assistant Version
0.87.1
Describe the Bug
I configured two sensors: one for movies and one for tv shows. The second one doesn't shows on lovelace.
The Error
Actually the system doesn't give me specific error. I have just the warning that I'm using a custom component.
Indicate if you followed all steps in the troubleshooting doc
Yes
What data does the sensor display if any?
Display normally. In particular TV shows gives this data:
data: >-
[{"title_default": "$title", "line1_default": "$episode", "line2_default":
"$release", "line3_default": "$number - $rating - $runtime", "line4_default":
"$genres", "icon": "mdi:eye-off"}]
friendly_name: Serie
What displays when visiting the API URL from the troubleshooting guide?
Displays the normal xml code of the recently added page
Does the default Home Assistant Plex component work for you?
Do you mean the plex sensor? If it so, yes it correctly retrive information from my server.
Home Assistant Version
Home Assistant 0.106.6
Additional Context
As you can see, the movies section works fine, but the TV shows doesn't.
Describe the Bug
Images are not being downloaded to the "upcoming-media-card\images\plex" directory. the browser still tries to load the resource and gets a 404 error.
The Error
Copy and paste the full error from Home Assistant
No Error.
Indicate if you followed all steps in the troubleshooting doc
Well, did you?
Doesn't really apply since the components work.
What data does the sensor display if any?
Feel free to censor information pertaining to titles, networks, etc.
All the correct data
What displays when visiting the API URL from the troubleshooting guide?
Feel free to censor information pertaining to titles, networks, etc.
XML file
Does the default Home Assistant Plex component work for you?
This is important to know, helps rule out issues with your Plex installation.
yes
Home Assistant Version
What version of HA are you running?
0.108.5
Additional Context
Add any other context about the problem here.
platform: plex_recently_added
name: Recently Added Movies
token: !secret plex_api_key
host: 10.40.67.25
port: 32400
section_types:
platform: plex_recently_added
name: Recently Added Shows
token: !secret plex_api_key
host: 10.40.67.25
port: 32400
section_types:
Describe the Bug
I am getting an error saying the sensor took too long and it's asking me to reach out to the author
The Error
Log Details (WARNING)
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:297
First occurred: 16:58:45 (2 occurrences)
Last logged: 16:58:50
Updating state for sensor.plex_recently_added (<class 'custom_components.plex_recently_added.sensor.PlexRecentlyAddedSensor'>) took 2.621 seconds. Please report it to the custom component author.
Updating state for sensor.plex_recently_added_2 (<class 'custom_components.plex_recently_added.sensor.PlexRecentlyAddedSensor'>) took 3.920 seconds. Please report it to the custom component author.
Home Assistant has started!
Indicate if you followed all steps in the troubleshooting doc
Well, did you?
Yes
What data does the sensor display if any?
The sensor seems to be working correctly, it's just the errors start to be thrown up again and again
What displays when visiting the API URL from the troubleshooting guide?
I get the XML raw data of my library. It all looks ok.
Does the default Home Assistant Plex component work for you?
yes
Home Assistant Version
0.113
Additional Context
N/A
Describe the Bug
I/O inside the event loop
The Error
2020-05-16 06:08:09 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for plex_recently_added doing I/O at custom_components/plex_recently_added/sensor.py, line 317: r = requests.head(url, verify=False)
Indicate if you followed all steps in the troubleshooting doc
N/A
What data does the sensor display if any?
N/A
What displays when visiting the API URL from the troubleshooting guide?
N/A
Does the default Home Assistant Plex component work for you?
N/A
Home Assistant Version
0.109.3
Additional Context
Spams the logs on start up
Thanks for good work on this cards. On my hassio i see a problem on the plex cards that i use. The shadows on the title and info. Not any other integration use shadows on text so this one looks weird, too blurry I have try to edit the upcoming-media-card.js file but with no luck. Even if i try to delete cache and the shadow on text its still there.
please advice what to modify.
Is your feature request related to a problem? Please describe.
$date is in US format, makes it hard for people in the rest of the world to read
Describe the solution you'd like
Have an option for DDMM something like "$datedm"
Describe alternatives you've considered
If there is another way to display this, would be happy?
Additional context
I think thats all, pretty simple stuff :)
Would there be an ability to exclude certain directories from the sensor data. For example, my wife records several soap operas on the dvr during the day and these pop up on my HA window in addition to the ones that I request in my Library. I would like to exclude her library from the display in the sensor. Going through all of her titles would be labor intensive and wouldn't stop any new ones from appearing. If I could exclude like the titles exclude feature, that would solve the problem.
Is your feature request related to a problem? Please describe.
The component displays new items from all libraries of type movies or tv shows, but it would be nice, if you could exclude libraries that contain media, that you don't want to show up in Home Assistant. The "exclude_keyword" option only works on the title of media items, not on library names.
Describe the solution you'd like
Add a new config option "exclude_libraries": Allows you to specify a list of library names to be exclude from the sensor if in the title of the library
Describe alternatives you've considered
The alternative I am actually using, is to put a keyword into the title of the media items you don't want to show up and then use the "exclude_keywords" option to hide them.
Describe the Bug
Receiving an OverflowError: timestamp out of range for platform time_t
when loading the component
File "/config/custom_components/plex_recently_added/sensor.py", line 159, in device_state_attributes
card_item['airdate'] = datetime.utcfromtimestamp(
The Error
Error while setting up plex_recently_added platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 201, in _async_setup_platform
await asyncio.gather(*pending)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 310, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 481, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 522, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 296, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 323, in _async_write_ha_state
attr.update(self.device_state_attributes or {})
File "/config/custom_components/plex_recently_added/sensor.py", line 159, in device_state_attributes
card_item['airdate'] = datetime.utcfromtimestamp(
OverflowError: timestamp out of range for platform time_t
Indicate if you followed all steps in the troubleshooting doc
Yes, it seems like this may be an issue with a particular item in my library, but I have no idea which one.
What data does the sensor display if any?
None, issue upon loading component.
What displays when visiting the API URL from the troubleshooting guide?
See https://pastebin.com/A1UtXikt
Does the default Home Assistant Plex component work for you?
Yes
Home Assistant Version
Home Assistant 0.115.6
Additional Context
I think the issue might be with an item in my Plex library, but I'm not sure which one. The error message isn't very helpful.
Describe the Bug
The images are not downloaded
The Error
2019-06-07 17:30:08 WARNING (MainThread) [homeassistant.helpers.entity] Updating state for sensor.plex_recently_added (<class 'custom_components.plex_recently_added.sensor.PlexRecentlyAddedSensor'>) took 0.514 seconds. Please report platform to the developers at https://goo.gl/Nvioub
What data does the sensor display if any?
data: [{"title_default": "$title", "line1_default": "$episode", "line2_default": "$release", "line3_default": "$number - $rating - $runtime", "line4_default": "$genres", "icon": "mdi:eye-off"}, {"airdate": "2019-06-04T12:43:53Z", "aired": "2000-05-01", "release": "$day, $date $time", "flag": true, "title": "Gladiator", "episode": "", "runtime": 170, "studio": "DreamWorks", "genres": "Action, Adventure", "rating": "\u2605 7.6", "poster": false, "fanart": false}, {"airdate": "2019-06-04T10:40:03Z", "aired": "2016-07-08", "release": "$day, $date $time", "flag": true, "title": "Rock Dog", "episode": "", "runtime": 89, "studio": "Reel FX Creative Studios", "genres": "Adventure, Animation", "rating": "\u2605 4.7", "poster": false, "fanart": false}, {"airdate": "2019-06-04T10:24:11Z", "aired": "2018-05-04", "release": "$day, $date $time", "flag": true, "title": "Marvel's Agents of S.H.I.E.L.D.", "episode": "The One Who Will Save Us All", "number": "S05E20", "runtime": 42, "rating": "\u2605 7.7", "poster": false, "fanart": false}, {"airdate": "2019-06-04T08:45:25Z", "aired": "2011-11-17", "release": "$day, $date $time", "flag": true, "title": "I Tawt I Taw a Puddy Tat", "episode": "", "runtime": 3, "studio": "Warner Bros. Pictures", "genres": "Animation, Comedy", "rating": "\u2605 6.2", "poster": false, "fanart": false}, {"airdate": "2019-06-04T08:37:51Z", "aired": "2016-12-14", "release": "$day, $date $time", "flag": true, "title": "Ballerina", "episode": "", "runtime": 89, "studio": "Caramel Films", "genres": "Adventure, Animation", "rating": "\u2605 7.5", "poster": false, "fanart": false}]
friendly_name: Plex_Recently_Added
Does the default Home Assistant Plex component work for you?
Doesnt seem to work, working on that
Home Assistant Version
0.93.2
Additional Context
https://www.screencast.com/t/aAvkuSbYOJ
Images weren't downloading on my setup. I tracked the problem down to this line:
https://github.com/custom-components/sensor.plex_recently_added/blob/master/custom_components/plex_recently_added/sensor.py#L302
The encoded url needs the token, as well. The fix is:
encoded = quote('http{0}://{1}:{2}{3}?X-Plex-Token={4}'.format(ssl, local,
port, img, token), safe='')
Describe the Bug
Future versions of home assistant will require a version key in manifest.json
The Error
2021-02-27 23:25:55 WARNING (MainThread) [homeassistant.loader] No 'version' key in the manifest file for custom integration 'plex_recently_added'. This will not be allowed in a future version of Home Assistant. Please report this to the maintainer of 'plex_recently_added'
Home Assistant Version
2021.3.0b3
Hello I’m wondering how do I fix this?
Log Details (WARNING)
Logger: custom_components.plex_recently_added.sensor
Source: custom_components/plex_recently_added/sensor.py:273
Integration: plex_recently_added (documentation)
First occurred: 11:54:25 AM (65 occurrences)
Last logged: 3:06:25 PM
No Metadata field for "TV Shows"
Describe the solution you'd like
Would be great, instead of Recently Added, to be able to see what is on deck? That will consequently show me a list of the series I'm watching where a new unwatched episode is available. I would to use that along with recently added for movies.
Describe alternatives you've considered
Sorry, I am not smart enough to have thought of anything.
Additional context
...
Describe the Bug
Upgraded from 0.3.0 to 0.3.1 and I see a persistent crash and associated failures in other components preventing them from loading. Reverting back to 0.3.0 eliminates the crashes and HA comes up fine again.
The Error
2020-05-19 15:04:28 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 763, in async_forward_entry_setup
result = await async_setup_component(self.hass, domain, self._hass_config)
File "/usr/src/homeassistant/homeassistant/setup.py", line 44, in async_setup_component
return await setup_tasks[domain] # type: ignore
File "/usr/src/homeassistant/homeassistant/setup.py", line 50, in async_setup_component
return await task # type: ignore
File "/usr/src/homeassistant/homeassistant/setup.py", line 146, in _async_setup_component
hass, config, integration
File "/usr/src/homeassistant/homeassistant/config.py", line 777, in async_process_component_config
platform = p_integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 279, in get_platform
f"{self.pkg_path}.{platform_name}"
File "/usr/local/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 724, in exec_module
File "", line 860, in get_code
File "", line 791, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/plex_recently_added/sensor.py", line 48
vol.Optional(CONF_IMG_CACHE,
^
SyntaxError: invalid syntax
Lots and lots of instances of this.
Home Assistant Version
0.109.6
Describe the Bug
Unable to use sensor
The Error
Logger: homeassistant.components.sensor
Source: custom_components/plex_recently_added/sensor.py:269
Integration: Sensor (documentation, issues)
First occurred: 12:55:46 (1 occurrences)
Last logged: 12:55:46
plex_recently_added: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 365, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 482, in async_device_update
await task
File "/config/custom_components/plex_recently_added/sensor.py", line 269, in async_update
sub_sec = json.loads(sub_sec)
File "/usr/local/lib/python3.8/json/__init__.py", line 341, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
TypeError: the JSON object must be str, bytes or bytearray, not NoneType
Indicate if you followed all steps in the troubleshooting doc
Plex recently added URL shows XML of recently added
What data does the sensor display if any?
Does not show
What displays when visiting the API URL from the troubleshooting guide?
XML Media Container with all recently added plex information. Snippet below
Does the default Home Assistant Plex component work for you?
Yes
Home Assistant Version
core-2021.5.0
Hi, I can see this issue has been posted before but no information was provided so it ended up stale.
I have a repeating message in my logs every few minutes.
2020-11-10 00:18:42 WARNING (MainThread) [custom_components.plex_recently_added.sensor] No Metadata field for "Films"
2020-11-10 00:21:42 WARNING (MainThread) [custom_components.plex_recently_added.sensor] No Metadata field for "Films"
2020-11-10 00:24:42 WARNING (MainThread) [custom_components.plex_recently_added.sensor] No Metadata field for "Films"
2020-11-10 00:27:42 WARNING (MainThread) [custom_components.plex_recently_added.sensor] No Metadata field for "Films"
my configuration that is causing the issue is below
#-------------------------------------------
# Plex Recently Added Custom Sensors - https://github.com/custom-components/sensor.plex_recently_added/
#-------------------------------------------
- platform: plex_recently_added
name: plex_recently_added_movies
entity_namespace: server
token: !secret plex_x_token
host: !secret ipaddr_Comp_Shield
port: !secret port_Comp_Shield
download_images: false
on_deck: false
section_types:
- movie
and using http://SERVER:PORT/library/sections?X-Plex-Token=PLEXTOKEN
this is the library reporting no metadata (useless info removed). I am using plex's new scanner but this issue persisted prior to this.
<Directory allowSync="" art="" composite="" filters="" refreshing="" thumb="" key="" type="movie" title="Films" agent="" scanner="Plex Movie" language="" uuid="" updatedAt="" createdAt="" scannedAt="" content="" directory="" contentChangedAt="" hidden="">
<Location id="30" path=""/>
</Directory>
I have removed and recreated the Film library and also checked that I do not have other movie
type libraries.
Any help at all would be great, thanks!
HA core-2021.6.5 running on pi.
my system will not restart as it finds an error in the config.
Platform error sensor.plex_recently_added - Integration ‘plex_recently_added’ not found.
I commented it out, deleted the custom component, readded the newest version, restarted, but still get the error.
Here is my code:
sensor:
- platform: plex_recently_added
token: xxx
host: 192.168.1.124
port: 32400
and the files I need are in config/custom_components/plex_recently_added
Not sure what to try next?
Is your feature request related to a problem? Please describe.
Well yes and no, I don't have an option now to show the latest added pictures so problem for me but the sensors works fine for what's defined now ;-)
Describe the solution you'd like
I would like to add my picture libraries so that I can see what are the latest pictures added to the plex library
Describe alternatives you've considered
I used before the Emby sensor and this had this option, so missing this for the family now
https://github.com/gcorgnet/sensor.emby_upcoming_media
include | The names or the Emby Libraries you want to include. If not specified, all libraries will be shown and this component will create one sensor per Library
Thanks for considering this!
Would it be possible to add music for a section type?
Is your feature request related to a problem? Please describe.
When setting hide_unflagged in the upcoming_media_card component it grabs the first X number of movies and then filters out the watched elements. Causing the list to be always shorter than the set number. Similar functionality has been implemented with the Kodi component.
Describe the solution you'd like
It would be great if this component could already send a differentiator between flagged and not flagged items. Like here: boralyl/kodi-recently-added#4
Describe the Bug
Updated HA to version 92.2. Plex_Recently_Added, as well as Sonarr_Upcoming_Media, stopped working. Saw Plex_Recently_Added issue #19, so I added manifest.json and init.py to each component folder. Restarted HA, and the startup would fail.
The Error
hass[196597]: Traceback (most recent call last):
hass[196597]: File "/usr/lib/python3.6/concurrent/futures/_base.py", line 324, in _invoke_callbacks
hass[196597]: callback(self)
hass[196597]: File "/usr/lib/python3.6/asyncio/futures.py", line 417, in _call_set_state
hass[196597]: dest_loop.call_soon_threadsafe(_set_state, destination, source)
hass[196597]: File "/usr/lib/python3.6/asyncio/base_events.py", line 626, in call_soon_threadsafe
hass[196597]: self._check_closed()
hass[196597]: File "/usr/lib/python3.6/asyncio/base_events.py", line 366, in _check_closed
hass[196597]: raise RuntimeError('Event loop is closed')
hass[196597]: RuntimeError: Event loop is closed
Indicate if you followed all steps in the troubleshooting doc
Well, did you? Yes, yes I did. These were working before. If I remove the two new files, HA starts as expected, but without the components.
Does the default Home Assistant Plex component work for you?
Yes.
Home Assistant Version
0.92.2
Describe the Bug
After adding the component, the same doesn´t load, showing the message below.
The Error
error in homeassistant:
`
Log Details (ERROR)
Fri Jan 18 2019 09:16:41 GMT+0000 (Western European Standard Time)
Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 240, in async_update_ha_state
device_attr = self.device_state_attributes
File "/config/custom_components/sensor/plex_recently_added.py", line 117, in device_state_attributes
media['addedAt']).strftime('%Y-%m-%dT%H:%M:%SZ')
OverflowError: timestamp out of range for platform time_t`
xml from plex with a movie example with the reference to addedAt 👍
<MediaContainer size="1" allowSync="1" identifier="com.plexapp.plugins.library" librarySectionID="1" librarySectionTitle="Movies" librarySectionUUID="a1370d9f-5f27-4e38-84e1-5a13de91bad8" mediaTagPrefix="/system/bundle/media/flags/" mediaTagVersion="1547506704"> <Video ratingKey="2265" key="/library/metadata/2265" guid="com.plexapp.agents.imdb://tt1517451?lang=en" librarySectionTitle="Movies" librarySectionID="1" librarySectionKey="/library/sections/1" studio="Malpaso Productions" type="movie" title="A Star Is Born" titleSort="Star Is Born" contentRating="R" summary="Seasoned musician Jackson Maine discovers—and falls in love with—struggling artist Ally. She has just about given up on her dream to make it big as a singer—until Jack coaxes her into the spotlight. But even as Ally's career takes off, the personal side of their relationship is breaking down, as Jack fights an ongoing battle with his own internal demons." rating="9.0" audienceRating="8.1" viewCount="1" lastViewedAt="1547251882" year="2018" thumb="/library/metadata/2265/thumb/1546965466" art="/library/metadata/2265/art/1546965466" duration="8143933" originallyAvailableAt="2018-10-03" **addedAt="1546965437"** updatedAt="1546965466"
Indicate if you followed all steps in the troubleshooting doc
yes, and able to retrieve xml
http://pereixxxxx.xxx:32400/library/recentlyAdded?X-Plex-Token=MXhxxxxxxxxxxDgo1eZ
What data does the sensor display if any?
shows nothing, is not loaded.
What displays when visiting the API URL from the troubleshooting guide?
Feel free to censor information pertaining to titles, networks, etc.
Does the default Home Assistant Plex component work for you?
This is important to know, helps rule out issues with your Plex installation.
Home Assistant Version
What version of HA are you running?
Additional Context
Add any other context about the problem here.
I use section_types for movie but it shows TV shows.
- platform: plex_recently_added
name: Recently Added Movies # will create sensor.recently_added_movies
token: !secret plex_token
host: !secret plex_host
port: 32400
section_types:
- movie
Describe the Bug
i am getting the error where movies and tv swap and read that adding name: will fix this issue
The Error
Invalid config for [sensor.plex_recently_added]: [name] is an invalid option for [sensor.plex_recently_added]. Check: sensor.plex_recently_added->name. (See ?, line ?). Please check the docs at https://home-assistant.io/integrations/sensor.plex_recently_added/
Indicate if you followed all steps in the troubleshooting doc
Well, did you?
What data does the sensor display if any?
movies under tv and tv under movies
What displays when visiting the API URL from the troubleshooting guide?
Feel free to censor information pertaining to titles, networks, etc.
Does the default Home Assistant Plex component work for you?
do not use the plex component
Home Assistant Version
0.100.3
Additional Context
Apart from this error it is working fine
read about the issue here #29
Hi.
Sample for ui-lovelace.yaml:
- type: custom:upcoming-media-card
entity: sensor.plex_recently_added
title: Recently Downloaded
The entity is called sensor.recently_added
Sensor not being created - was working fine, this is on the very latest version of home-assistant, .96.3
Tried clearing cache and reinstalling add-on no go
Log Details (ERROR)
Sat Jul 20 2019 14:05:56 GMT-0700 (Pacific Daylight Time)
plex_recently_added: Error on device update!
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/local/lib/python3.7/site-packages/urllib3/util/connection.py", line 57, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1244, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1290, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1239, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/lib/python3.7/http/client.py", line 966, in send
self.connect()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.7/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f362c668850>: Failed to establish a new connection: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 399, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='192.168.1.248,172.30.32.1', port=32400): Max retries exceeded with url: /photo/:/transcode?width=200&height=200&minSize=1&url=http%3A%2F%2F192.168.1.248%2C172.30.32.1%3A32400%2Flibrary%2Fmetadata%2F2815%2Fart%2F1563356803%3FX-Plex-Token%3Dx9c46MUfvvCmcgTHmbKM&X-Plex-Token=x9c46MUfvvCmcgTHmbKM (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f362c668850>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 261, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 380, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/plex_recently_added/sensor.py", line 270, in update
if image_url(self.url_elements, True, fanart):
File "/config/custom_components/plex_recently_added/sensor.py", line 313, in image_url
r = requests.head(url, verify=False)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 101, in head
return request('head', url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='192.168.1.248,172.30.32.1', port=32400): Max retries exceeded with url: /photo/:/transcode?width=200&height=200&minSize=1&url=http%3A%2F%2F192.168.1.248%2C172.30.32.1%3A32400%2Flibrary%2Fmetadata%2F2815%2Fart%2F1563356803%3FX-Plex-Token%3Dx9c46MUfvvCmcgTHmbKM&X-Plex-Token=x9c46MUfvvCmcgTHmbKM (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f362c668850>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
There seems to have been a breaking change with 0.92, and since then plex_recently_added doesn't seem to work (along with Sonarr or Radarr). In the logs I see:
Unable to find services.yaml for the custom_updater integration
I have no idea what should be in services.yaml, and looking at the github page I don't see anything referencing that either. Is this something new that's required, or what do I need to do to get this to work again?
Describe the Bug
I have configured two different sensors.yaml entries for the sensor.plex_recently_sensor for both the "shows" and "movies" sections.
Two sensors are created, sensor.plex_recently_added and sensor.plex_recently_added_2.
The problem is which sensor displays movies or shows keeps on changing. For instance I'll configure the Upcoming Media Card to display sensor.plex_recently_added_2 and and for a while it'll display recently added TV shows in Plex. But after a few days it switches to displaying recently added movies.
If I change it to sensor.plex_recently_added to show TV shows after a few days that sensor will change to showing recently added movies.
Does the default Home Assistant Plex component work for you?
Yes
Home Assistant Version
.100.1
My config:
platform: plex_recently_added
token: !secret plex_token
host: 192.168.12.10
port: 32400
section_types:
-show
img_dir: /custom_ui/upcoming-media-card/images/plex/
platform: plex_recently_added
token: !secret plex_token
host: 192.168.12.10
port: 32400
section_types:
-movie
img_dir: /custom_ui/upcoming-media-card/images/plex/
Describe the Bug
I've got corrupted (empty) images being displayed in the media cards.
The Error
No error in the front end since the image files exist and they are retrieved with a HTTP 200 code.
Indicate if you followed all steps in the troubleshooting doc
Yes, I followed the steps.
What data does the sensor display if any?
All correct data.
What displays when visiting the API URL from the troubleshooting guide?
Correct paths to the images.
Does the default Home Assistant Plex component work for you?
Yes, this issue concerns only the Plex integration.
Home Assistant Version
HA 2021.9.7
Additional Context
My use case is a Plex media server remotely setup with a Let'sEncrypt enabled reverse proxy on port 443.
Due to this if I call manually my photo transcoder with the domain name I set encoded, I get a 404 error.
Still, the module will download an empty image without throwing the error.
More detailed analysis
It appears the image_url() function encodes a full url to send to the transcoder.
Someone who has setup Plex locally won't encounter the issue since the transcoder works with a local ip as url parameter.
Someone who has it remotely setup, won't be able to transcode with a remote host encoded as url parameter.
Someone who has it remotely setup, will be able to transcode if the local ip address is encoded as url parameter.
+ http(s)://local_host:local_port/photo/:/transcode?width=XX&height=XX&minSize=1&url=local_host:local_port%2Flibrary%2Fmetadata%2F1234%2Fthumb%1234567890&X-Plex-Token=XXXXXXXX
- http(s)://remote_host:remote_port/photo/:/transcode?width=XX&height=XX&minSize=1&url=remote_host:remote_port%2Flibrary%2Fmetadata%2F1234%2Fthumb%1234567890&X-Plex-Token=XXXXXXXX
+ http(s)://remote_host:remote_port/photo/:/transcode?width=XX&height=XX&minSize=1&url=local_host:local_port%2Flibrary%2Fmetadata%2F1234%2Fthumb%1234567890&X-Plex-Token=XXXXXXXX
How I sorted the issue in my HA instance
By inspecting what the actual plex.tv dashboard does, it appears the encoded url parameter a relative path to the image file is.
So the following works perfectly.
+ http(s)://remote_host:remote_port/photo/:/transcode?width=XX&height=XX&minSize=1&url=%2Flibrary%2Fmetadata%2F1234%2Fthumb%1234567890&X-Plex-Token=XXXXXXXX
So, I've replaced in the image_url() function of the sensor.py file:
encoded = quote('http{0}://{1}:{2}{3}?X-Plex-Token={4}'.format(ssl, local, port, img,token), safe='')
with
encoded = quote(img), safe='')
and it worked like a charm.
I don't know if it could work with a locally setup Plex Server, but it might make the job easier.
Best regards,
hdebeuf
Update component structure and documentation for the upcoming changes to Home Assistant.
It would be nice to be able to configure this sensor to only show unwatched items.
I'll be glad to hack this out, I just wanted to make sure I threw a todo in. I dont think it should be terribly hard.
On Homeassistant 0.107.0 and the newest 0.2.9 version of the plex recently added component. When I try to reload HA I get the following error:
Also see this error in logs as well when reloading the container:
Looks like the custom-component is now trying to create a device tracker rather than a sensor? idk. This is new to me so not sure. Had this working on a previous version of HA. Here's my configuration.yaml snip for reference:
Let me know if there is anything else you need from me to help diagnose.
Describe the Bug
I can not seem to get the configuration to work to display images when using the Google Cast component.
The Error
No error message
Indicate if you followed all steps in the troubleshooting doc
Yes
What data does the sensor display if any?
Displays all info minus the pictures (issue on Google Cast only). This works fine on all other browsers
What displays when visiting the API URL from the troubleshooting guide?
Displays normally
Does the default Home Assistant Plex component work for you?
Yes
Home Assistant Version
0.100.3
Additional Context
I know this is most likely a Google Cast issue, however, I do have all other images display.
I tried downloading the images locally by using this configuration:
- platform: plex_recently_added
token: !secret plex_token
host: 192.168.1.44
port: 32400
#ssl: true
download_images: true
img_dir: '/plex_artwork/'
Is your feature request related to a problem? Please describe.
Managed users don't get their respective token, so can't add their "progress" of watched and unwatched items. All of their items remain flagged therefore can't use the hide_flagged functionality in the upcoming media card.
Describe the solution you'd like
It would be great to separate users and their watch history.
Describe alternatives you've considered
An alternative could be to synchronize all managed users' history to an admin.
Thanks in advance for considering my request.
Is your feature request related to a problem? Please describe.
The component seems to be refreshing very frequently, maybe every minute? I see this because the images directory seems to be getting cleared out and re-populated very frequently.
Describe the solution you'd like
Can you add a configurable option for users to set their own refresh frequency ?
Describe the Bug
When you have a shared server, the plugin doesnt work.
The Error
The error is found in the code. When searching for servers within the account, my own valid token is taken. This is an error as the shared servers have their own access token.
Indicate if you followed all steps in the troubleshooting doc
What data does the sensor display if any?
What displays when visiting the API URL from the troubleshooting guide?
Does the default Home Assistant Plex component work for you?
No
Home Assistant Version
0.97.2
Additional Context
Is your feature request related to a problem? Please describe.
I watch several shows that's released every day. I would like to be able to exclude them from the sensor since I'm not really interested in when they're downloaded. For now I have solved this by adding an if statement before line 218 self.card_json.append(card_item)
that checks if card_item['title']
contains one of those keywords, but it would of course be good to have this as a config option. I will try to do this my self, in that case I will do a pr if you think this is a good idea.
Describe the solution you'd like
See above :)
Describe the Bug
The device_state_attributes
property has been replaced with extra_state_attributes
in HA core.
The Error
(<class 'custom_components.plex_recently_added.sensor.PlexRecentlyAddedSensor'>) implements device_state_attributes. Please report it to the custom component author.
Indicate if you followed all steps in the troubleshooting doc
Start HA
What data does the sensor display if any?
n/a
What displays when visiting the API URL from the troubleshooting guide?
n/a
Does the default Home Assistant Plex component work for you?
n/a
Home Assistant Version
2021.12.0b1
Additional Context
n/a
Hello,
I tried this component and I can't make it to work. In the log i have:
Error while setting up platform plex_recently_added Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 149, in _async_setup_platform await asyncio.wait_for(asyncio.shield(task), SLOW_SETUP_MAX_WAIT) File "/usr/local/lib/python3.7/asyncio/tasks.py", line 442, in wait_for return fut.result() File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/config/custom_components/plex_recently_added/sensor.py", line 53, in setup_platform add_devices([PlexRecentlyAddedSensor(hass, config, name)], True) File "/config/custom_components/plex_recently_added/sensor.py", line 76, in __init__ self.server_name, self.token) TypeError: cannot unpack non-iterable NoneType object
And here my config file:
- platform: plex_recently_added token: !secret plex_token host: 192.168.1.111 port: 32400 ssl: false ssl_cert: false download_images: false max: 5 section_types: - Films
I successfully add the Radarr component and the address http(s)://[IP]:[port]/library/recentlyAdded?X-Plex-Token=[token]
work well , it return a big xml in my browser.
Is anybopdy having the same issue?
For information i'm in Hassio 97.2
Describe the Bug
Platform not found: sensor.plex_recently_added / sonarr and radarr too
The Error
@maykar has my yaml file from previous troubleshooting on upcoming media card issue register
Indicate if you followed all steps in the troubleshooting doc
Yes - @maykar and I have checked the custom card component should be working okay now. But sensors/components are not showing up. All the custom components are in www/custom_components/sensor location. all files have been redownloaded in RAW format to eliminate that issue.
What data does the sensor display if any?
No sensor created
What displays when visiting the API URL from the troubleshooting guide?
All the correct data from plex/sonarr/radarr - working correctly
Does the default Home Assistant Plex component work for you?
Yes - working okay
Home Assistant Version
0.87.1
Additional Context
sensor.yaml, HA log file and lovelace.yaml file shared with @maykar
I recently uninstalled the below from hacs and removed from config:
I'm now seeing the following error when I check my config:
Configuration invalid
Integration plex_recently_added not found when trying to verify its sensor platform
Have been advised to post here instead of in hacs issues, original ticket here: hacs/integration#320 (comment)
The following entry in configuration.yaml
- platform: plex_recently_added
token: !secret plex_token
host: 192.168.1.2
port: 32400
download_images: true
max: 5
Yields this error:
plex_recently_added: Error on device update!
Traceback (most recent call last):
File "/usr/src/app/homeassistant/helpers/entity_platform.py", line 248, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/app/homeassistant/helpers/entity.py", line 349, in async_device_update
await self.hass.async_add_executor_job(self.update)
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/sensor/plex_recently_added.py", line 262, in update
if image_url(self.url_elements, True, fanart):
UnboundLocalError: local variable 'fanart' referenced before assignment
Using 0.2.0.
This will require an update to the card as well, but I'd like to add the ability to create separate cards from one component...one card for TV one for Movies. Current thought is to split the data attribute into movie and tv attributes and combine in card by default unless the cards config hides one or the other.
Describe the Bug
The Entity sensor.plex_recently_added shows no data. Just the default.
My config:
sensor:
- platform: plex_recently_added
token: TOKEN
host: IP
port: 32400
The Error
2020-04-19 03:19:34 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-04-19 03:19:36 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonarr_upcoming_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-04-19 03:19:36 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for plex_recently_added which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-04-19 03:19:47 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform plex_recently_added is taking over 10 seconds.
2020-04-19 03:20:28 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:20:59 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:21:29 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:22:00 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:22:31 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:23:02 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:23:33 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:24:04 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:24:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
2020-04-19 03:25:06 WARNING (MainThread) [homeassistant.helpers.entity] Update of sensor.plex_recently_added is taking over 10 seconds
Indicate if you followed all steps in the troubleshooting doc
See my states output below. Opening the url works fine. Using Curl on hassio works too.
What data does the sensor display if any?
Developer Tools -> States:
data: >-
[{"title_default": "$title", "line1_default": "$episode", "line2_default":
"$release", "line3_default": "$number - $rating - $runtime", "line4_default":
"$genres", "icon": "mdi:eye-off"}]
friendly_name: Plex Recently Added
What displays when visiting the API URL from the troubleshooting guide?
https://IP:32400/library/recentlyAdded?X-Plex-Token=TOKEN
Opening that site with the same token, ip and port displays the XML. Using curl on that url on hassio displays the xml too.
Does the default Home Assistant Plex component work for you?
Yes. Displays Watching states, player fine.
Home Assistant Version
0.108.6 (latest)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.