Ziggo mediabox next

That would be great Jarne. I will contact you in the coming days about it. What is your primary language? Dutch or French? Please PM me if you have time!

I have sent you a pm

1 Like

Hi, we are using your app and that’s working great! We can zap between the channels. But is it please possible to add also the radio stations? I would love to make flows that it automatically start Radio 538 in the morning for example.

Thanks, unfortunately that’s not possible. Like netflix and videoland radio is an app. There’s no information about radio stations in the available webservices.

Hi, I’ve read this ziggonext library could also work for Telenet. I am a developer and looking into this now.
I’ve some useful information to share and I am a few steps closer to a working Telenet (be-nl) media player. But I don’t know what the expected responses are.

When making a call to authenticate with my username and password, I get this back:

{'system': 'peal', 'reason': 'Unexpected http response'}

Now looking at the code, this call is made to get the householdId and oespToken. I was able to obtain these codes just in my browser, so I altered the code to continue with that oespToken and householdId that I provided. By doing that, the component doesn’t fail anymore and seems to startup.

The problem is now that no new media_player is registered. So no errors in the log files, but also no media_player entity.
The only other items I see in my log files are after enabling MQTT logging:

2020-12-04 20:43:37 DEBUG (SyncWorker_0) [custom_components.ziggonext] Fetched a token: {'token': 'something-token-returned'}
2020-12-04 20:43:37 DEBUG (SyncWorker_0) [custom_components.ziggonext] Sending CONNECT (u1, p1, wr0, wq0, wf0, c1, k60) client_id=b'some-client-code'
2020-12-04 20:43:38 DEBUG (SyncWorker_0) [custom_components.ziggonext] Updated channels.
2020-12-04 20:43:38 DEBUG (Thread-5) [custom_components.ziggonext] Received CONNACK (0, 0)
2020-12-04 20:43:38 DEBUG (Thread-5) [custom_components.ziggonext] Connected to mqtt client.
2020-12-04 20:44:38 DEBUG (Thread-5) [custom_components.ziggonext] Sending PINGREQ
2020-12-04 20:44:38 DEBUG (Thread-5) [custom_components.ziggonext] Received PINGRESP
2020-12-04 20:45:38 DEBUG (Thread-5) [custom_components.ziggonext] Sending PINGREQ
2020-12-04 20:45:38 DEBUG (Thread-5) [custom_components.ziggonext] Received PINGRESP
2020-12-04 20:46:38 DEBUG (Thread-5) [custom_components.ziggonext] Sending PINGREQ

is this expected and what am I missing?
@sholofly do you have any idea? What is your debug loggin producing?

Ok, me again. I didn’t stop searching and I can tell that is works now :slight_smile:
I am having a working telenet media_player in home assistant that reflects the status of my tv box.
I can also control the tvbox (play, pause, …)

A change is needed in: https://github.com/Sholofly/ziggonext-python/blob/eb2804908b795d79aba76cc6213e5bd0c48c041d/ziggonext/ziggonext.py
And a solution te be found for authentication.

Keep you posted on any progress.

For all requesters of the Telenet version of Ziggo Next, I want to announce It’s fully working now.
Mainly authentication is a special case.
I opened a Pull Request to the project of @sholofly

Hopefully it will be merged soon so everyone can enjoy this Telenet media player in Belgium.

Great work guys!
Regarding the Telenet integration. Do you think it would be possible to also get the radio station here? It would be nice to be able do directly tune into “special” radio channels.

I just tested this. At this moment the component crashes when changing to a radio station. That needs to be fixed for sure. I will look into how to enable radio stations, not sure if that is possible.

2020-12-06 15:44:17 ERROR (Thread-5) [root] Uncaught thread exception
Traceback (most recent call last):
File “/usr/local/lib/python3.8/threading.py”, line 932, in _bootstrap_inner
self.run()
File “/usr/local/lib/python3.8/threading.py”, line 870, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 3452, in _thread_main
self.loop_forever(retry_first_connection=True)
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 1779, in loop_forever
rc = self.loop(timeout, max_packets)
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 1181, in loop
rc = self.loop_read(max_packets)
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 1572, in loop_read
rc = self._packet_read()
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 2310, in _packet_read
rc = self._packet_handle()
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 2936, in _packet_handle
return self._handle_publish()
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 3216, in _handle_publish
self._handle_on_message(message)
File “/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py”, line 3444, in _handle_on_message
self.on_message(self, self._userdata, message)
File “/config/custom_components/ziggonext/ziggonextlib/ziggonext.py”, line 204, in _on_mqtt_client_message
self.settop_boxes[deviceId].update_settop_box(jsonPayload)
File “/config/custom_components/ziggonext/ziggonextlib/ziggonextbox.py”, line 133, in update_settop_box
sourceType = playerState[“sourceType”]
KeyError: ‘sourceType’

The telenet integration is working now. Thanks @michaelg!

2 Likes

Thanks for the Telenet- be-nl support, it works great!

You’re welcome. Feel free to submit some feedback or feature requests!

Hello Forum Members
I’m working with @sholofly and others trying to get a Homebridge plugin working for Telenet.be users. We’re struggling with the authentication for Telenet and cannot login, even though we have valid credentials…
Is anyone here with a working Telenet ziggonext config able to log their http requests from the ziggonextbox.py code?
Please remove your credentials before posting!

1 Like

@michaelg Can you be of any assistance?

1 Like

yes, I debugged the entire authentication flow of Telenet.

It’s all available in this method: https://github.com/Sholofly/ziggonext-python/blob/baf4d0b21a0b009ff879b206a1cf8c56150a924b/ziggonext/ziggonext.py#L108

These are the step if reading the code above are needed to obtain a valid oespToken in Belgium. Telenet uses a single-sign-on method and doesn’t use the default authentication of the Ziggo/horizon platform.

  1. Authorization GET request giving
    1.1. session.authorizationUri
    1.2. session.state
    1.3. session.validityToken
  2. Make a GET request to the url provided in previous step: session.authorizationUri
  3. Make a POST request with your username & password, giving you a location header
  4. Make a GET request to that location url in the header in previous step, this giving you a authorizationCode
  5. Make an new POST call providing:
    5.1. the authorizationCode from step 4
    5.2. the state from step 1.2
    5.3. the validityToken from step 1.3
    5.4. and giving you a refreshToken
  6. make a new POSt call with that refreshToken en your username, is giving you a:
    6.1. householdId
    6.2. oespToken
    6.3. locationId

Are you able to provide him the corresponding response including body and headers? If so, please do not forget to anonimize it.

Hi @sholofly

I believe Virgin Media’s new 360 boxes which have been shopping for the last 2 months are using the same services as your component.

I’ve looked for the addresses and found https://prod.oesp.virginmedia.com/oesp/v3/CH/eng/web/session

(I think when I found it earlier, it actually has v4 in the API address actually)

Is it possible to add this in please?

What I’m not sure on though is when I log into virgin media’s website at https://virgintvgo.virginmedia.com/en.html (which looks the same as https://www.ziggogo.tv/nl.html which you have) the remote I can use there only has up, down, left, right, okay, home, back, power, blue, red, green and yellow buttons. Is this the same as you get?

Thank you

UPDATE: The Ziggonext integration on HACS has been updated to include support for Virgin Media. Many thanks to @sholofly for making this work for us here in the UK.

Looks like my Telenet Digibox is not working? Any one any idea what might be wrong?

Logger: homeassistant.setup
Source: custom_components/ziggonext/__init__.py:30
First occurred: 8:32:37 PM (1 occurrences)
Last logged: 8:32:37 PM

Error during setup of component ziggonext
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/ziggonext/ziggonext.py", line 149, in get_oauth_session
    url = response.headers["location"]
  File "/usr/local/lib/python3.8/site-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'location'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 242, in _async_setup_component
    result = await task
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/ziggonext/__init__.py", line 30, in setup
    api.connect()
  File "/usr/local/lib/python3.8/site-packages/ziggonext/ziggonext.py", line 268, in connect
    self.get_session_and_token()
  File "/usr/local/lib/python3.8/site-packages/ziggonext/ziggonext.py", line 57, in get_session_and_token
    self.get_session()
  File "/usr/local/lib/python3.8/site-packages/ziggonext/ziggonext.py", line 63, in get_session
    self.get_oauth_session()
  File "/usr/local/lib/python3.8/site-packages/ziggonext/ziggonext.py", line 179, in get_oauth_session
    raise ZiggoNextConnectionError("Unknown connection failure: " + str(e))
ziggonext.exceptions.ZiggoNextConnectionError: Unknown connection failure: 'location'

What is the box you own?