custom-components / sensor.sonarr_upcoming_media

📺 Sonarr component to feed Upcoming Media Card.
Apache License 2.0
55 stars 45 forks source link

"undefined" is not valid JSON. #42

Open Phyxsius7 opened 1 month ago

Phyxsius7 commented 1 month ago

Describe the Bug When defining entity in card, the following error occurs "undefined" is not valid JSON.

The Error Copy and paste the full error from Home Assistant

Indicate if you followed all steps in the troubleshooting doc Yes, I did followed these instructions.

What data does the sensor display if any? No error message

What displays when visiting the API URL from the troubleshooting guide? [ { "seriesId": 629, "episodeFileId": 12987, "seasonNumber": 5, "episodeNumber": 1, "title": "Syr", "airDate": "2024-10-03", "airDateUtc": "2024-10-02T15:30:00Z", "overview": "Syr is not the only one who has feelings for Bell. When she notices the shift in her friend’s behavior, she asks Ryu a question that shakes the elf to the core.", "episodeFile": { "seriesId": 629, "seasonNumber": 5, "relativePath": "Season 5\Is It Wrong to Try to Pick Up Girls in a Dungeon! - S05E01 - Syr WEBDL-1080p.mkv", "path": "D:\Video\TV Shows\Is It Wrong to Try to Pick Up Girls in a Dungeon!\Season 5\Is It Wrong to Try to Pick Up Girls in a Dungeon! - S05E01 - Syr WEBDL-1080p.mkv", "size": 1038141666, "dateAdded": "2024-10-03T17:08:47.775894Z", "sceneName": "Is.It.Wrong.to.Try.to.Pick.Up.Girls.in.a.Dungeon.S05E01.1080p.WEB.H264-KAWAII", "quality": { "quality": { "id": 3, "name": "WEBDL-1080p", "source": "web", "resolution": 1080 }, "revision": { "version": 1, "real": 0, "isRepack": false } }, "language": { "id": 1, "name": "English" }, "mediaInfo": { "audioChannels": 2, "audioCodec": "AAC", "videoCodec": "x264" }, "originalFilePath": "Is.It.Wrong.to.Try.to.Pick.Up.Girls.in.a.Dungeon.S05E01.1080p.WEB.H264-KAWAII\Is.It.Wrong.to.Try.to.Pick.Up.Girls.in.a.Dungeon.S05E01.1080p.WEB.H264-KAWAII.mkv", "qualityCutoffNotMet": false, "id": 12987 }, "hasFile": true, "monitored": true, "absoluteEpisodeNumber": 64, "sceneAbsoluteEpisodeNumber": 1, "sceneEpisodeNumber": 1, "sceneSeasonNumber": 5, "unverifiedSceneNumbering": false, "series": { "title": "Is It Wrong to Try to Pick Up Girls in a Dungeon?", "sortTitle": "is it wrong to try to pick up girls in a dungeon", "seasonCount": 5, "status": "continuing", "overview": "In a world, where the deities have descended from the heavens lies the town of Orario that features the Dungeon, which contains an assortment of monsters from goblins to dragons. Adventurers slay those monsters and take their shards, which are then used to craft magic items. To become an adventurer, people join groups called Familia. Each of which is named after and serves a resident deity. The adventurers and their attributes and abilities are ranked by level, improved by experience and supervised by their Familia's deity.\r\nBell Cranel, a novice adventurer, is the sole member of the Familia under the goddess Hestia. After being saved by top level adventurer Ais Wallenstein of the Loki Familia, he falls in love with her and decides to improve and become worthy of her attention. All the while mostly unaware that other girls, deities and mortals, also develop feelings for him. Especially Hestia herself.", "network": "Tokyo MX", "airTime": "00:30", "images": [ { "coverType": "banner", "url": "https://artworks.thetvdb.com/banners/graphical/289882-g3.jpg" }, { "coverType": "poster", "url": "https://artworks.thetvdb.com/banners/v4/series/289882/posters/6167c1e908d41.jpg" }, { "coverType": "fanart", "url": "https://artworks.thetvdb.com/banners/fanart/original/5ccee55ed58bb.jpg" }, { "coverType": "unknown", "url": "https://artworks.thetvdb.com/banners/v4/series/289882/clearlogo/611c02aa51aec.png" } ], "seasons": [ { "seasonNumber": 0, "monitored": false }, { "seasonNumber": 1, "monitored": false }, { "seasonNumber": 2, "monitored": false }, { "seasonNumber": 3, "monitored": false }, { "seasonNumber": 4, "monitored": true }, { "seasonNumber": 5, "monitored": true } ], "year": 2015, "path": "my path", "profileId": 7, "languageProfileId": 1, "seasonFolder": true, "monitored": true, "useSceneNumbering": true, "runtime": 25, "tvdbId": 28982, "tvRageId": 481858, "tvMazeId": 53142, "firstAired": "2015-04-04T00:00:00Z", "lastInfoSync": "2024-10-04T15:53:40.662715Z", "seriesType": "standard", "cleanTitle": "isitwrongtotrytopickupgirlsindungeon", "imdbId": "tt4728568", "titleSlug": "is-it-wrong-to-try-to-pick-up-girls-in-a-dungeon", "certification": "TV-MA", "genres": [ "Action", "Adventure", "Animation", "Anime", "Comedy", "Fantasy", "Romance" ], "tags": [], "added": "2023-08-12T21:25:41.0607576Z", "ratings": { "votes": 10732, "value": 7.4 }, "qualityProfileId": 7, "id": 629 }, "id": 68461 } ]

Does the default Home Assistant Sonarr component work for you? Yes

Home Assistant Version 2024.10.0

I have the following in my HA

  1. installed "Upcoming Media Card" via HACS
  2. followed the instruction from the following page, at that page step 4 was not possible https://github.com/custom-components/sensor.sonarr_upcoming_media/tree/master#manual-configuration-steps
  3. added the following folders and files to homeassistant/www custom-lovelace/upcoming-media-card/upcoming-media-card.js
  4. Add the following to settings > Dashboards > Resources (top left menu) url: /local/custom-lovelace/upcoming-media-card/upcoming-media-card.js?v=0.1.1 resource type: javascript module
  5. added card with the following YAML
title: TV
type: custom:upcoming-media-card
entity: sensor.sonarr_upcoming
image_style: fanart
collapse: flag=true
sort_by: number
enable_tooltips: true

at this point I get the error in the card "undefined" is not valid JSON.

mkanet commented 1 month ago

Hi!

What version did you install? Below screenshot, is what my sonarr integration's sensor under Developer tools. looks like. Can you please also do the same and provide a similar screenshot? I mainly need to see what attributes you have clearly. You can hide any sensitive text like your API key or public IP address; however, try to keep as much of the text as possible.

Honestly, I think you might have to uninstall the integration, reboot, and add it again cleanly; making sure you have the latest version installed and running. I think something must have gone wrong when you first tried to install it.

image

Phyxsius7 commented 1 month ago

Hi @mkanet, and thank you for your prompt reply. I was afraid that I have to do clean install, especially because I found the guide difficult and seemed to me as outdated. Could you help me out and provide me with a guide on how to install it correctly?

mkanet commented 1 month ago

@Phyxsius7 sorry there really isnt a guide since the installation is easier that ever (doesnt require editing your configuration.yaml anymore). It only asks for few piece of information when installing it via Home Assistant GUI.

1) Correct IP address.
2) Correct Port 3) Correct sonarr API key

IP: 192.168.1.2 Port: 7878 3) SSL: (do not enable if you access sonarr via http:// instead of https://

I would restore from backup before you you attempted to install the integration and try again. As long as home assistant can see your sonarr server, it should work as expected.

All the other integrations for Upcoming Media Card are configured very similarly.

I am willing to help you out privately via email if you cant figure this out on your own. The only thing you need to do is restore from backup before you tried to install the integration. If you don't have a backup, I can try to help you out anyway. I just need to know exactly what configuration text you are copying and pasting into each field during the initial setup.