thank you!!
Trying this out now, great idea for a component, thanks.
EDIT: After a HassOS update Iāve got it installed and running now, I donāt have a huge amount of shows added yet but it seems to be working.
Iām loving this. I have it set up as a lovelace card via the upcoming media card and itās great. Any chance youād point me in the direction of how to use this information for a sensor? The sensor page doesnāt describe how to deal with json.
But what iām thinking is that i should be following : [https://www.home-assistant.io/docs/mqtt/processing_json/](http://this guide on processing JSON for mqtt?). I started trying to do that, but ran into some difficulty.
I put āvalue_jsonā, and use ādataā as the attribute, and [1] to tell it to point it to the proper calendar event in the array? From there, then I tried to point it which string to find and pull out by saying ātitleā. I canāt figure out what I should be doing differently.
sensor:
- platform: template
sensors:
television_tonight:
value_template: '{{ value_json.data[1].'title'}}'
Just for context, hereās the next on my calendar.
data: [{"title_default": "$title", "line1_default": "$episode", "line2_default": "$release", "line3_default": "$rating - $runtime", "line4_default": "$number - $studio", "icon": "mdi:arrow-down-bold"}, {"airdate": "2019-05-17T00:00:00Z", "release": "$day, $time", "flag": false, "title": "iZombie", "episode": "Five, Six, Seven, Ate!", "number": "S5E3", "rating": 7.0, "poster": "https://image.tmdb.org/t/p/w500/q4nqNwAhzVR7JuYctrWJvUWz3xR.jpg", "fanart": "https://image.tmdb.org/t/p/w780/d2YDPTQPe3mI2LqBWwb0CchN54f.jpg", "runtime": 45, "studio": "The CW"},
What do you want exactly? The next show?
yeah, Iām trying to create a notification for shows that air tonight to send via telegram bot. So like name, episode number or title, and airtime. less important, but iām also curious about how it might impact a bayesian sensor
It would probably better handled by the component itself as a separate sensor. What would you propose being in the sensor? Add it as a feature request on the repo.
okay will do. But tbh, I also saw this as a learning opportunity. is what I was aiming to do possible/ was i going in the right direction?
Iāve never messed with template sensors all that much TBH. Iām much more comfortable in Python or Javascript than Jinja
ah okay, thanks for your time!
I think you are on the right path though, just need to get your sensorās data object
- platform: template
sensors:
television_tonight:
value_template: '{{ state_attr('sensor.trakt_upcoming', 'data')[0].'title'}}'
Thanks for the great work!
Is there a way to recreate traktās " Up next to watch"?
Found this closed issue but canāt seem to find a way to do this. Thanks
I did implement that on a test branch, but it is incredibly slow as it has to go through all your shows and all their history. You can give it a shot here: https://github.com/custom-components/sensor.trakt/tree/up-next
I have a weird problem with this plugin. For some reason If I have the sensor.py under /custom_components/trakt/ and also the sensor on my yaml the HA it doesnāt start. It restarts I have SSH access and i can see the files with samba share but no GUI, it shows that it cannot connect to HA. When iām removing the sensor.py and the entry from yaml it logins just fine. Any ideas? I have 0.93.2 version and trakt and upcoming card up to date
You need all the files, especially the manifest
Of course I have all the files, but the ones I said are the ones that making the HA work again when I remove them from HA
I had the same problem but got it working again with these steps:
- delete .trakt.conf
- restart HA (I then got a trakt.configurator notification)
- generate a new OAuth PIN from Trakt to use in the configurator
I may have to give your solution a shot. I had to stop using Trakt several weeks ago as it brought HA to a screeching halt.
This along with new Trakt authorization app credentials fixed it for me.
Thanks!
Unfortunately the success was short-lived. HA cannot boot up. Checking Home Assistant log I get the below Trakt error over and over hundreds of times. A search of ātraktā in my HA log brought up over 1000 entries. Had to disable Trakt custom component as HA would never come up. Obviously it has something to do with the Trakt authorization, but I have no idea how to stop this from happening.
File "/config/custom_components/trakt/sensor.py", line 81, in setup_platform
continue_setup_platform(hass, config, token, add_devices, discovery_info)
File "/config/custom_components/trakt/sensor.py", line 89, in continue_setup_platform
add_devices([TraktUpcomingCalendarSensor(hass, config, token)], True)
File "/config/custom_components/trakt/sensor.py", line 127, in __init__
self.update()
File "/config/custom_components/trakt/sensor.py", line 144, in update
calendar = MyShowCalendar(days=self._days)
File "/usr/local/lib/python3.7/site-packages/trakt/calendar.py", line 31, in __init__
self._get()
File "/usr/local/lib/python3.7/site-packages/trakt/core.py", line 455, in inner
json_data = self._handle_request('get', url)
File "/usr/local/lib/python3.7/site-packages/trakt/core.py", line 432, in _handle_request
raise self.error_map[response.status_code]()
trakt.errors.OAuthException: Unauthorized - OAuth must be provided
Anyone have any suggestions?