Code Monkey home page Code Monkey logo

home-assistant-tv4-play's Introduction

Home Assistant TV4 Play

Note

As of 2023-11-29, TV4 changed their API which broke this integration. See Issue#15 for progress on making it work with the new API.

Play tv4 play programs on home assistant media players.

Currently, only tv4_play.play_suggested is available, but the plan is to add more services.

Installation

Add the code

Copy the custom_components/tv4_play folder in this repository to <home assistant config>/custom_components/tv4_play

Active the service

Add:

tv4_play:

to your configuration.yaml file.

Use in automations

And then add the automation you want:

automation:
- alias:
  trigger:
  # Some trigger
  action:
  - service: tv4_play.play_suggested
    entity_id: media_player.living_room_tv
    data:
      program_name: nyhetsmorgon

Get the program_name field

  1. Search an click on the program you want at tv4play.se
  2. From the url, grab the name. It should be right after program/

home-assistant-tv4-play's People

Contributors

lindell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

home-assistant-tv4-play's Issues

Detected I/O inside the event loop

Tack för en schysst addon! Dock vore det najs om du kunde fixa följande warning:

2020-09-23 07:04:05 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 tv4_play doing I/O at custom_components/tv4_play/video_url_fetch/video_fetch.py, line 13: data = get(url, headers=headers).json()

Stopped working?

Trying to start nyhetsmorgon and gets following error.

`2022-11-15 08:36:47.504 ERROR (MainThread) [homeassistant.components.script.starta_nyhetsmorgon_tv] Starta Nyhetsmorgon på TV: Error executing script. Unexpected error for call_service at pos 1: Expecting value: line 1 column 1 (char 0)
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/lib/python3.10/site-packages/simplejson/init.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/local/lib/python3.10/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 451, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 684, in _async_call_service_step
await service_task
File "/usr/src/homeassistant/homeassistant/core.py", line 1744, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1781, in _execute_service
await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
File "/config/custom_components/tv4_play/init.py", line 31, in play_suggested
video_url = await hass.async_add_executor_job(get_video_url, suggested_episode)
File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/tv4_play/video_url_fetch/video_fetch.py", line 13, in get_video_url
data = get(url, headers=headers).json()
File "/usr/local/lib/python3.10/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`

Could not fetch the CDN data: stream_not_started

I´m trying to use this and send TV4 to my Samsung TV. But when running this in developer tools -> Services

program_name: nyhetsmorgon
entity_id: media_player.the_frame

I get:

File "/home/hass/.homeassistant/custom_components/tv4_play/__init__.py", line 30, in play_suggested video_url = get_video_url(get_suggested_episode(program_name)) File "/home/hass/.homeassistant/custom_components/tv4_play/video_url_fetch/video_fetch.py", line 16, in get_video_url "Could not fetch the CDN data: {}".format(data['errorCode']) Exception: Could not fetch the CDN data: stream_not_started

Any idea how to fix it?

Anyone know what to use on Nyhetsmorgon now?

I used to use "Nyhetsmorgon" as the program name but now that doesn´t work anymore.
Looking at tv4play the program name seems to have changed.

image

But that does not work either.
Anyone figured it out?

Sign in required

As of November 29 it seems like login to TV4 account is needed to view Play programs.

IMG_4039

HTTPSConnectionPool

Hi,

Iam getting this SSL error when iam running TV4.play automation.

Stopped because an error was encountered at 9 september 2022 06:29:38 (runtime: 0.03 seconds)

HTTPSConnectionPool(host='tv4-graphql-web.b17g.net', port=443): Max retries exceeded with url: /graphql (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)')))

TV4 Nyhetsmorgon does not play

When trying to start TV4 Nyhetsmorgon using the same method since over a year (a preconfigured button), to play on my Nest Hub Max, it's only showing the light blue Home Assistant screen ("Welcome to Home Assistant"). The same on my other screeen, a Nest Hub, using the same pre-configured button.

Other programs, like "nyheterna" is working as expected, it's just "nyhetsmorgon" that doesn't work since a week or so.

type: button
icon: mdi:youtube-tv
name: TV4 Nyhetsmorgon
show_icon: true
show_name: true
double_tap_action:
action: call-service
service: tv4_play.play_suggested
service_data:
entity_id: media_player.matrummet_nest_hub_max
program_name: nyhetsmorgon
show_state: true

Subtitles on/off?

First of all, Thank you for both this and svt-play! I love them both.

Is there any data you can send to get subtitles?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.