MagentaTV Binding for Deutsche Telekom MR 4xx

Hi @ibot1989 , welcome to the club :slight_smile:

Please go ahead a give the last build (see abobe) a try. Start with 401 and the. 400. @hmerk reported problems that the send key doesn’t work. would be helpful if you could supply a direct comparable result.

I’m working on the next beta, which includes more key codes and event processing show title information etc., but the release posted above is good for the basic testing.

Hi, I have a new version ready to test.
https://github.com/markus7017/org.openhab.binding.entertaintv/blob/master/target/org.openhab.binding.entertaintv-2.4.0-SNAPSHOT.jar

To install the binding you need to remove the current thing and re-add it by running a new discovery. OH should keep the channel/item linkage.

It includes new channels, some of them are marked as advanced, you need to click on [Show More] to see them. The activation code property has been removed from the binding config (now computed automatically).

Most important: The binding listens to the stb events. So every time you switch the program or start a on-demand video the binding gets events and will update the channels.

The binding supplies channels for power, chan-up, chan-down, vol-up and vol-down. Those are simplifications instead of sending the appropriate key codes to the _Key item (e.g. “CHUP”). Once the switch is activated the binding sends the keycode and puts the switch back in the OFF position. Using the _Key channel provides access to all keys on the remote.

Please give it a try and provide feedback.

Hello Markus,

Can you build a version for OpenHAB 2.3?
I think the version 2.4-SNAPSHOT is not compatible with my 2.3 installation.

Edit: I will testing with the Version 2.3-SNAPSHOT in the posting two days ago and give feedback in the evening.

Hello,
Can someone tell me how I get to the “User ID”. Unfortunately, I have no FritzBox and with WireShark I get only a GET command. The POST command with the user ID is missing.
Thank you

you could use tcpdump to create the eth file, which then can get loaded in Wireshark
@Mat_Ias is working on an automation of that process (script for now, which then could be implemented in the binding)

@markus7017 Thanks for the info with the 404-error. I was unable to reproduce the error. I changed the script so that in debug-mode it outputs the POST-Payload in the last step “Authenticate MobileDevice”. Could you give it a try and send me the output of the last step, including the POST-Payload?

getEntertainTVUserID.sh.pdf (5.2 KB)

1 Like

@markus7017 I installed your updated version. How do I get to see the status informations like in your screenshot: “Description”, “Play mode” oder “Program”? I only the see the attached channels

you need to press chup or chdown or play a video. this triggers an event from the stb (at least my mr401 does). you should get an update wirh every program change; check the DEBUG log

Yes, indeed: Example: EntertainTV: Unable to process STB event: null, JSON=’{“new_play_mode”:20,“mediaCode”:“3634”,“playBackState”:1,“mediaType”:1,“fastSpeed”:1}’

How do I process these events? With Event-based Triggers in rules?

hm, in fact that is an exception. I think I need to check if all parameters I want to fetch from JSON
I’ll have a look when I’m at homr

do you see other events?

No, in fact the event messages also don’t appear anymore. Now no events at all. In Karaf I set log:set DEBUG org.openhab.binding.entertaintv

my device is recognized as MR401B

try to restart OH or the binding. I already noticed that sometimes the pairing status gets lost and the stb stops sending events

Great, thanks. A restart helped. Can you give me a hint on how to process these events.

the. are processed by the binding and them mapped to the various cjannels. the item could trigger a rule if you want to do more

@Mat_Ias try this build, this should fix the exception problem
https://github.com/markus7017/org.openhab.binding.entertaintv/blob/master/target/org.openhab.binding.entertaintv-2.4.0-SNAPSHOT.jar

@Mat_Ias you made it. This version of the script returned the right userID.

@Sebastian_Kastner try the script to find out our user id

getEntertainTVUserID.sh <user@t-online.de> <password>

Ignore the debug output. If the script is successful you’ll see

UserID: XXXXXXXXXXXXXXXXXXXXX
UserID (MD5ed): HHHHHHHHHHHHHHHHHHHH

use the hashed value to configure the binding.

Excellent work @Mat_Ias, I get the correct UserID.

Hello,

As promised, I tried the binding this evening.
I used the Binding for OpenHAB 2.3. I tested the autodiscover for MR401 and MR400.

Results:

After loading the binding:

==> /var/log/openhab2/openhab.log <==
2018-10-16 09:56:45.579 [ERROR] [very.EntertainTVDiscoveryParticipant] - EntertainTV: Unable to create thing: null
2018-10-16 09:56:45.595 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ to inbox.
==> /var/log/openhab2/events.log <==
2018-10-16 09:56:45.598 [home.event.InboxAddedEvent] - Discovery Result with UID ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ has been added.
==> /var/log/openhab2/openhab.log <==
2018-10-16 09:56:45.603 [ERROR] [very.EntertainTVDiscoveryParticipant] - EntertainTV: Unable to create thing: null
==> /var/log/openhab2/events.log <==
2018-10-16 09:56:45.642 [home.event.InboxAddedEvent] - Discovery Result with UID ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ has been added.
==> /var/log/openhab2/openhab.log <==
2018-10-16 09:56:45.639 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ to inbox.
2018-10-16 09:56:45.848 [INFO ] [tv.internal.EntertainTVNotifyServlet] - EntertainTV servlet started at ‘/entertaintv/notify’

That worked so far

Then I started to add the thing of the MR401 (not yet saved), in the logfile it appeared:

2018-10-16 09:58:03.080 [WARN ] [ore.internal.thing.ThingTypeResource] - Cannot find channel type: entertaintv:playStatus
2018-10-16 09:58:17.253 [WARN ] [re.thing.internal.ThingFactoryHelper] - Could not create channel ‘playStatus’ for thing type ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’, because channel type ‘entertaintv:playStatus’ could not be found.
==> /var/log/openhab2/events.log <==
2018-10-16 09:58:17.291 [me.event.InboxRemovedEvent] - Discovery Result with UID ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ has been removed.
2018-10-16 09:58:17.313 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ changed from UNINITIALIZED to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING)
==> /var/log/openhab2/openhab.log <==
2018-10-16 09:58:21.164 [WARN ] [ore.internal.thing.ThingTypeResource] - Cannot find channel type: entertaintv:playStatus

This worked so far, until the missing channel “playStatus”.
The receiver model was detected automatically (MR401B).

Then the thing was saved:

==> /var/log/openhab2/events.log <==
2018-10-16 09:59:14.414 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to UNINITIALIZED (HANDLER_MISSING_ERROR)
2018-10-16 09:59:14.441 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to INITIALIZING
2018-10-16 09:59:14.576 [me.event.ThingUpdatedEvent] - Thing ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ has been updated.
==> /var/log/openhab2/openhab.log <==
2018-10-16 09:59:15.087 [INFO ] [ertaintv.internal.EntertainTVControl] - EntertainTVControl: Send Pairing Request (firendlyName=‘PAD:OPENHAB_OH2’, deviceID=‘26A5F0FD7A02C93E07CFC428C499D182’, userID=‘’)
==> /var/log/openhab2/events.log <==
2018-10-16 09:59:15.252 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ changed from INITIALIZING to ONLINE
2018-10-16 09:59:15.275 [me.event.ThingUpdatedEvent] - Thing ‘entertaintv:receiver:c1026e4c-e7fd-5393-a2f3-AC6FBB5C6A01’ has been updated.
==> /var/log/openhab2/openhab.log <==
2018-10-16 09:59:16.816 [WARN ] [ore.internal.thing.ThingTypeResource] - Cannot find channel type: entertaintv:playStatus

The thing was successfully go online, but the control did not work (UserID was not yet entered), it`s okay on this time.

Now the MR400

Add the thing of the MR400 (not yet saved), in the logfile it appeared:

==> /var/log/openhab2/events.log <==
2018-10-16 10:11:02.628 [me.event.InboxRemovedEvent] - Discovery Result with UID ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ has been removed.
2018-10-16 10:11:02.640 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ changed from UNINITIALIZED to UNINITIALIZED (HANDLER_CONFIGURATION_PENDING)
==> /var/log/openhab2/openhab.log <==
2018-10-16 10:11:06.173 [WARN ] [ore.internal.thing.ThingTypeResource] - Cannot find channel type: entertaintv:playStatus

The receiver model was not found automatically, the field remained empty. It was manually set to MR400.

After saving the thing:

==> /var/log/openhab2/events.log <==
2018-10-16 10:12:14.301 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to UNINITIALIZED (HANDLER_MISSING_ERROR)
2018-10-16 10:12:14.311 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ changed from UNINITIALIZED (HANDLER_CONFIGURATION_PENDING) to INITIALIZING
==> /var/log/openhab2/openhab.log <==
2018-10-16 10:12:14.362 [ERROR] [tertaintv.handler.EntertainTVHandler] - EntertainTV: Device initialisation failed: Unable to initialize thing: Error sending HTTP GET http:// 192.168.9.147:49153/xml/dial.xmlfailed: http:// 192.168.9.147:49153/xml/dial.xml
==> /var/log/openhab2/events.log <==
2018-10-16 10:12:14.384 [hingStatusInfoChangedEvent] - ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ changed from INITIALIZING to OFFLINE (COMMUNICATION_ERROR): Unable to initialize thing: Error sending HTTP GET http:// 192.168.9.147:49153/xml/dial.xmlfailed: http:// 192.168.9.147:49153/xml/dial.xml
2018-10-16 10:12:14.396 [me.event.ThingUpdatedEvent] - Thing ‘entertaintv:receiver:bb5e21ce-2222-11b2-f918-AC6FBB2F1EC4’ has been updated.
==> /var/log/openhab2/openhab.log <==
2018-10-16 10:12:16.690 [WARN ] [ore.internal.thing.ThingTypeResource] - Cannot find channel type: entertaintv:playStatus

This was not successful, the thing remains in OFFLINE status (Error sending HTTP GET)

I will now continue with the MR401 and try to determine the top of my UserID with the script.

If I should test something with the MR400, let me know.
But I currently have only one OpenHAB 2.3 installation to test and no 2.4.

Hi, I’m running OH 2.3 as well - that’s not a problem.

2018-10-16 09:56:45.579 [ERROR] [very.EntertainTVDiscoveryParticipant] - EntertainTV: Unable to create thing: null

Is it possible that you had a previous version of the binding installed? I had this issue while upgrading and having an old discovered entry.

If there is any thing from a previous installation make sure to remove them using PaperUI.

and check that

userdata/jsondb/org.eclipse.smarthome.config.discovery.DiscoveryResult.json

has no entries for entertainrv. If there is one stop OH, manually edit the file and restart OH. If you run a manual discovery from the Paper UI Inbox check if the binding title is displayed like “Entertain TV Binding”, class entertaintv. If it shows only entertaintv (no binding title) I’m pretty sure you have some left overs from a previous installation.

If the problem persist open the OH console, set the binding to trace mode (“log:set TRACE org.openhab.binding”) and restart OH.

MR401: I see

2018-10-16 09:59:15.087 [INFO ] [ertaintv.internal.EntertainTVControl] - EntertainTVControl: Send Pairing Request (firendlyName=‘PAD:OPENHAB_OH2’, deviceID=‘26A5F0FD7A02C93E07CFC428C499D182’, userID=’’)

that the userID is still empty. You shouldn’t be able to save the config without filling this field?

MR401:

2018-10-16 10:11:06.173 [WARN ] [ore.internal.thing.ThingTypeResource] - Cannot find channel type: entertaintv:playStatus

That’s really strange. Please make sure that you have a clean install. Remove all things in Paper UI, change to userdata/jsondb and run

grep entertaintv *.json

If there is any match stop OH, edit the file, remove the entry and restart OH (keep backup copies in a different folder).

— Lets focus on the MR401 first, because that’s what I’m having here.

Hi, I’m running OH 2.3 as well - that’s not a problem.

You mean I should use this version in my 2.3 OpenHAB installation?:
https://github.com/markus7017/org.openhab.binding.entertaintv/blob/master/target/org.openhab.binding.entertaintv-2.4.0-SNAPSHOT.jar

that the userID is still empty. You shouldn’t be able to save the config without filling this field?

Yes, I left UserID blank when testing.

I have now from a Wireshark dump my UserID and this entered in the thing. I can control MR401 remotely, but i do not receive any feedback from the MR.

But that is also the state that I have read here in the forum for the version I tested 2.3.

After your answer which binding jar version i should test now, I’ll continue.