MagentaTV Binding for Deutsche Telekom MR 4xx

Sorry my mistake! Edited to englisch at 22:30:

Internet connection is possible, because I can install Addons. And i think they are downloaded and not preinstalled. Correct?

Now I updated Openhab and got a error message. Hoppefully, this points to my problem.

COMMUNICATION_ERROR

org.openhab.binding.magentatv.internal.MagentaTVException: HTTP reqaest failed for URL https://accounts.login.idm.telekom.com/oauth2/tokens (class java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header)

Old text: Internet Verbindung ist vorhanden. (Sonst kƶnnte ich ja auch keine Addons installieren, oder?)

Habe jetzt Openhab upgedatet, jetzt habe ich eine klare Fehlermeldung:

English please, this is an international community!

1 Like

Hy @all,

its been a while. I recently had to re-install my openhab instance. But after that, MagentaTV binding is not working anymore. I tried it with the Backuped UserId from my old things config but this is not working. So i did the following:

  • Removed everything related to MAgentTV from OH (things, items, sitemap entries)
  • Stoped OH
  • Cleared cache
  • Downloaded DEV Build and moved it to the addons folder

Also iā€™ve checked if Smartcontrol is enabled - its enabled.

Binding was recognized by OH so i tried to add a new thing. Unfortunately after entering my Credentials the UserID is not generated. See Trace log here:

11:16:07.200 [DEBUG] [tatv.internal.MagentaTVHandlerFactory] - Initialize network access
11:16:07.312 [DEBUG] [scovery.MagentaTVDiscoveryParticipant] - Discovered an MagentaTV Media Receiver Receiver Wohnzimmer, UDN: 6d308421-631a-5767-ae09-AC6FBB72B244, Model MR401B_ACN.R01A5
11:16:07.319 [DEBUG] [scovery.MagentaTVDiscoveryParticipant] - Create Thing for device Receiver Wohnzimmer with UDN 6d308421-631a-5767-ae09-AC6FBB72B244, ModelMR401B_ACN
11:16:07.327 [INFO ] [ig.discovery.internal.PersistentInbox] - Added new thing 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' to inbox.
11:16:07.328 [INFO ] [openhab.event.InboxAddedEvent        ] - Discovery Result with UID 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' has been added.
11:16:08.574 [WARN ] [.apache.cxf.jaxrs.utils.ResourceUtils] - No resource methods have been found for resource class javax.ws.rs.core.Response
11:16:08.592 [WARN ] [.apache.cxf.jaxrs.utils.ResourceUtils] - No resource methods have been found for resource class javax.ws.rs.core.Response
11:16:08.632 [DEBUG] [ternal.network.MagentaTVNotifyServlet] - Servlet started at /magentatv/notify
11:16:08.643 [DEBUG] [tatv.internal.MagentaTVHandlerFactory] - NotifyServlet started
11:16:34.284 [DEBUG] [re.model.rule.jvmmodel.RulesRefresher] - Thing "magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244" added => rules are going to be refreshed
11:16:34.287 [INFO ] [openhab.event.InboxRemovedEvent      ] - Discovery Result with UID 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' has been removed.
11:16:34.305 [DEBUG] [tatv.internal.MagentaTVHandlerFactory] - Create thing type magentatv:receiver
11:16:34.350 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' changed from UNINITIALIZED to INITIALIZING
11:16:34.374 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' changed from INITIALIZING to UNKNOWN
11:16:39.391 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' changed from UNKNOWN to OFFLINE (CONFIGURATION_ERROR): Credentials missing or invalid! Fill credentials into thing configuration or generate UID on the openHAB console - see README
11:17:33.591 [DEBUG] [atv.internal.handler.MagentaTVHandler] - Receiver Wohnzimmer: Thing config updated, re-initialize
11:17:33.609 [TRACE] [ntatv.internal.MagentaTVDeviceManager] - Lookup device, uniqueId=7C358A00F54D7CCBB0309111DF1AA1D7
11:17:33.615 [DEBUG] [ntatv.internal.MagentaTVDeviceManager] - Device with id 7C358A00F54D7CCBB0309111DF1AA1D7 was not found in table (0 entries
11:17:33.642 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' changed from OFFLINE (CONFIGURATION_ERROR): Credentials missing or invalid! Fill credentials into thing configuration or generate UID on the openHAB console - see README to UNKNOWN
11:17:38.644 [DEBUG] [atv.internal.handler.MagentaTVHandler] - Receiver Wohnzimmer: Login with account *SensitiveDataCovered*@t-online.de
11:17:38.649 [DEBUG] [ntatv.internal.network.MagentaTVOAuth] - Authenticate with account *SensitiveDataCovered*@t-online.de
11:17:38.655 [DEBUG] [ntatv.internal.network.MagentaTVOAuth] - OAuth: HTTP Request
	HTTP GET https://slbedmfk11100.prod.sngtv.t-online.de:33428/EDS/JSON/Login?UserID=Guest
	Data=<none>
11:17:38.661 [TRACE] [ntatv.internal.network.MagentaTVOAuth] - 
	Headers=Accept-Encoding: gzip
User-Agent: Jetty/9.4.20.v20190813
Accept: */*
Cache-Control: no-cache
Host: slbedmfk11100.prod.sngtv.t-online.de
Accept-Language: en-US,en;q=0.9,de;q=0.8

	Cookies=[]
11:17:39.046 [DEBUG] [ntatv.internal.network.MagentaTVOAuth] - OAuth: HTTP Response
	Status=200 OK
	Data={"enctytoken":"D34DC43E562577AF414E9314602A60F7","encryptiontype":"0002","platformcode":"0200","epgurl":"http://appepmfk10009.prod.sngtv.t-online.de:33220","version":"MEM V200R008C18SPC200B043","epghttpsurl":"https://appepmfk10009.prod.sngtv.t-online.de:33227","rootCerAddr":"http://appepmfk10009.prod.sngtv.t-online.de:33220/EPG/CA/iptv_ca.der","upgAddr4IPTV":"https://slbedifk11100.prod.sngtv.t-online.de:33428/EDS/jsp/upgrade.jsp","upgAddr4OTT":"https://slbedmfk11100.prod.sngtv.t-online.de:33428/EDS/jsp/upgrade.jsp,https://slbedmfk11100.prod.sngtv.t-online.de:33428/EDS/jsp/upgrade.jsp","EPGDomainNameList":[{"key":"2","value":"appepmfk10009.prod.sngtv.t-online.de"},{"key":"3","value":"80.157.246.61"},{"key":"4","value":"80.157.246.61"},{"key":"5","value":"80.157.246.61"},{"key":"6","value":"80.157.246.61"},{"key":"7","value":"80.157.246.61"}],"sam3Para":[{"key":"SAM3ServiceURL","value":"https://accounts.login.idm.telekom.com"},{"key":"OAuthScope","value":"ngtvepg"}]}
11:17:39.050 [TRACE] [ntatv.internal.network.MagentaTVOAuth] - 
	Headers=Server: openresty/1.0.0.2
Date: Thu, 22 Apr 2021 09:17:39 GMT
Content-Type: text/plain;charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Keep-Alive: timeout=3600, max=767
X-Frame-Options: SAMEORIGIN
Access-Control-Allow-Methods: POST,OPTIONS,GET,*
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: accept, origin, content-type,Authorization,authorization,X_CSRFToken,If-None-Match,*
Set-Cookie: JSESSIONID=H7B81190EC550D6ED5A86097B6939BCB2C613941B7C3B1E625442F69711223BC97895A950996F017F31CE301BB55D477E; Path=/EPG/; Secure; HttpOnly
Content-Encoding: gzip
Vary: accept-encoding
X-XSS-Protection: 1; mode=block
X-Download-Options: nosniff
X-Content-Type-Options: nosniff


11:17:39.078 [DEBUG] [ntatv.internal.network.MagentaTVOAuth] - OAuth: epghttpsurl = https://appepmfk10009.prod.sngtv.t-online.de:33227/EPG
11:17:39.081 [TRACE] [ntatv.internal.network.MagentaTVOAuth] - sam3Para.SAM3ServiceURL = https://accounts.login.idm.telekom.com
11:17:39.087 [TRACE] [ntatv.internal.network.MagentaTVOAuth] - sam3Para.OAuthScope = ngtvepg
11:17:39.093 [DEBUG] [ntatv.internal.network.MagentaTVOAuth] - OAuth: HTTP Request
	HTTP POST https://accounts.login.idm.telekom.com/oauth2/tokens
	Data=password=qQ0klnxUfa6cFqrs&scope=ngtvepg+offline_access&grant_type=password&username=*SensitiveDataCovered*%40t-online.de&x_telekom.access_token.format=CompactToken&x_telekom.access_token.encoding=text%2Fbase64&client_id=10LIVESAM30000004901NGTVWEB0000000000000
11:17:39.095 [TRACE] [ntatv.internal.network.MagentaTVOAuth] - 
	Headers=Accept-Encoding: gzip
User-Agent: Jetty/9.4.20.v20190813
Accept: */*
Cache-Control: no-cache
Host: slbedmfk11100.prod.sngtv.t-online.de
Accept-Language: en-US,en;q=0.9,de;q=0.8
Content-Length: 249
Cookie: JSESSIONID=H7B81190EC550D6ED5A86097B6939BCB2C613941B7C3B1E625442F69711223BC97895A950996F017F31CE301BB55D477E

	Cookies=[]
11:17:39.315 [INFO ] [ntatv.internal.network.MagentaTVOAuth] - HTTP reqaest failed for URL https://accounts.login.idm.telekom.com/oauth2/tokens
java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
	at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) ~[bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:685) ~[bundleFile:9.4.20.v20190813]
	at org.openhab.binding.magentatv.internal.network.MagentaTVOAuth.httpRequest(MagentaTVOAuth.java:236) [bundleFile:?]
	at org.openhab.binding.magentatv.internal.network.MagentaTVOAuth.getUserId(MagentaTVOAuth.java:145) [bundleFile:?]
	at org.openhab.binding.magentatv.internal.handler.MagentaTVControl.getUserId(MagentaTVControl.java:94) [bundleFile:?]
	at org.openhab.binding.magentatv.internal.handler.MagentaTVHandler.getUserId(MagentaTVHandler.java:351) [bundleFile:?]
	at org.openhab.binding.magentatv.internal.handler.MagentaTVHandler.initializeThing(MagentaTVHandler.java:169) [bundleFile:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
	at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header
	at org.eclipse.jetty.client.AuthenticationProtocolHandler$AuthenticationListener.onComplete(AuthenticationProtocolHandler.java:163) ~[?:?]
	at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:198) ~[?:?]
	at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:190) ~[?:?]
	at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:444) ~[?:?]
	at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:390) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:316) ~[?:?]
	at org.eclipse.jetty.http.HttpParser.parseFields(HttpParser.java:1139) ~[?:?]
	at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1498) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:172) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:135) ~[?:?]
	at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:73) ~[?:?]
	at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:133) ~[?:?]
	at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:154) ~[?:?]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:426) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:320) ~[?:?]
	at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:158) ~[?:?]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) ~[?:?]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) ~[?:?]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) ~[?:?]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) ~[?:?]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) ~[?:?]
	... 1 more
11:17:39.343 [DEBUG] [atv.internal.handler.MagentaTVHandler] - Receiver Wohnzimmer: org.openhab.binding.magentatv.internal.MagentaTVException: HTTP reqaest failed for URL https://accounts.login.idm.telekom.com/oauth2/tokens (class java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header)
11:17:39.346 [DEBUG] [atv.internal.handler.MagentaTVHandler] - Receiver Wohnzimmer: Communication Error - org.openhab.binding.magentatv.internal.MagentaTVException: HTTP reqaest failed for URL https://accounts.login.idm.telekom.com/oauth2/tokens (class java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header), switch Thing offline
11:17:39.365 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'magentatv:receiver:6d308421-631a-5767-ae09-AC6FBB72B244' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): org.openhab.binding.magentatv.internal.MagentaTVException: HTTP reqaest failed for URL https://accounts.login.idm.telekom.com/oauth2/tokens (class java.util.concurrent.ExecutionException: org.eclipse.jetty.client.HttpResponseException: HTTP protocol violation: Authentication challenge without WWW-Authenticate header)

May i kindly ask you to check whats wrong here? If you need other Logs/Infos dont hesitate to reach out to me.

I could confirm the problem. Obviously again they made changes to the OAuth flow :frowning:

doesnā€™t look good

  • userid/password are no longer send as plain text
  • the code is based on a AES encrypted salted hash

I there someone here who could help to debug complex JavaScript?

1 Like

Hello,

I just switched to OH3 and almost successfully installed MAGENTATV Binding 3.1.0. However, for the switch POWER, Openhab only recognizes the ON status. OFF is ignored. I can switch the receiver on and off via Openhab, but Openhab does not recognize the OFF when I switch off the receiver directly at the device.

In version 2.5.1 this still worked.

Is this known?

Does no one have this problem?

The detection is based on UPnP discovery. Turn on DEBUG log and check if the binding receives the event.

Hi @markus7017 .

do I need to install the UPnP binding? Nothing comes up in the DEBUG logsā€¦

Hi @markus7017 ,

POWER is not part of the Binding.

It is not possible to change ā€œcurrent state ONLINE/NONEā€ā€¦

2021-08-27 09:57:48.038 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: Check receiver status, current state ONLINE/NONE

2021-08-27 09:57:48.041 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: Renew MR event subscription for device ()

2021-08-27 09:57:48.042 [DEBUG] [tv.internal.handler.MagentaTVControl] - : Subscribe Event Channel (terminalID=

2021-08-27 09:57:48.045 [DEBUG] [tv.internal.handler.MagentaTVControl] - : SUBSCRIBE returned SID

2021-08-27 09:58:45.175 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: STB event playContent: playMode=buffering, duration=-1, playPosition=-1

2021-08-27 09:58:45.179 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: Setting Player state to PLAY

2021-08-27 09:58:45.315 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: STB event playContent: playMode=buffering, duration=0, playPosition=0

2021-08-27 09:58:45.316 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: Setting Player state to PLAY

2021-08-27 09:58:45.378 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: EVENT_EIT_CHANGE event received.

2021-08-27 09:58:45.379 [DEBUG] [tv.internal.handler.MagentaTVHandler] - MagentaTV: EVENT_EIT_CHANGE for channel 1/373

Any ideas @markus7017 ?

this looks like you added receiver manually
try discovery

I tried discovery @markus7017

Cleaned cache. ā€œFreshā€ install.
No changes.

I can switch off/on the receiver with the POWER-Item, but if i change the POWER on the receiver. noting happensā€¦

send me a DEBUG log showing the complete initialization

I send it via private mail @markus7017

Hello,
I have two questions:

  1. Is there any news about retrieving the User ID from the Telekom server?
    (I want to pair an MR401A receiver)

I still have the problem with the OAuth-Error
ā€œHTTP protocol violation: Authentication challenge without WWW-Authenticate headerā€
as already mentioned in the past posts.

  1. Did someone already successful paired the new MagentaTV-Box?

BR Arki

No, no update. I would require someone with good JavaScript know how to understand the encryption implemented by a hardly obfuscated code.

Please try this approach: MagentaTV Binding for Deutsche Telekom MR 4xx - #56 by markus7017

You should be able to sniff the id using Wireshark

Thanks for the response,

Iā€™ve tried to sniff the network communication for several times,
unfortunately thereā€™s no information about the userID inside the data.
I can find the uuid but no userID.

Any hints if the naming of the columns for the user data has changed?

I cant find my UserId too :frowning:
My Receiver is connected via Cable to one of my Mesh Repeaters. I tried to capture Traffic of my fritzbox and the fritz repeater but cant find the UserId. Any ideas?

Where can i find the JavaScript code? I can have a look. But most of the time its hard to understand uglyfied code :frowning:

I just found a way to get the User ID.
I hope it will work for someone else too.
I used Chrome but it should also work with Firefox.

Press F12 to open Developer Tools. Open https://web.magentatv.de/tv-guide and Login to your Telekom Account.
Open Network Tab and Filter for DTA
Click the second one with type fetch.
Open Preview and you should see the userid.
Then i used MD5 hash: Generate MD5 message digests online ā€” Cryptii to calculate the md5 hash and hex value of it.
Left fill in userID and on right side you see your ID needed. After that you just need to do an Uppercase and its the same ID I had before.

All in one Picture as i can only use 1 Picture :frowning:

4 Likes