Telekom TV / MagentaTV / EntertainTV Binding

binding
Tags: #<Tag:0x00007fe05dac5c48>

(Markus Michels) #1

Hi all,

I’m thinking on creating a binding for the Telekom Entertain receiver after completing my binding for the Rachio sprinkler controller.

I already did some basic work could power on/off the receiver and send keys based on a bash script. Using a binding makes it more stable and simplifies the usage for the community.

What are your thoughts? Is there interest for such a binding?


UPDATE 11/14/2018:

  • beta1 is done and merged with the master branch.
  • The binding will developed on OH 2.4-SNAPSHOT, runs on OH 2.3-stable and OH 2.2 should not a problem. Maybe you need to install OH/ESH’s UPnP feature (see README)
  • The binding supports MR400, 401 and should support MR201 incl. auto-discovery
  • MegentaTV (aka EntertainTV) is also supported
  • Your t-online credentials could be used to query the required userID from the Telekom platform, otherwise if could be configured manually and get auto-removed from the thing config to respect security aspects
  • The binding supports the programEvents and playEvents and maps them to corresponding channels/items

beta2 adds the following features (maybe still under development):

  • support for multiple MRs within the same network (done, e.g. MR401 as primary and MR201
    Open:

  • Improved recovery features, so that the connection gets auto-recovered when MR was disconnected etc. This requires additional development and testing.

  • The userID query with t-online credentials doesn’t work if you don’t have provisioned e-mail address and just want to use the T-Online “Anschlussnummer” - reported by @ibot1989

  • UPnP will be used to detect a power-off of the receiver (90% done). The MR only supplies a POWER toggle not a real ON/OFF switch - this is tricky to detect and handle

UPDATE 11/22/2018: New name
Due to the fact that the Telekom renamed their TV service into MagentaTV I renamed the binding to TelekomTV. This ist based on the old one, which is now depricated. You need to remove all existing entertaintv things and, remove the jar from the addons folder and only the new one.
secondary)

  • UPnP will be used to detect a power-off of the receiver (90% done). The MR only supplies a POWER toggle not a real ON/OFF switch - this is tricky to detect and handle
  • some re-factoring

Code and documentation could be found on Github: https://github.com/markus7017/org.openhab.binding.telekomtv/blob/beta2
README.md provides information on installation and the various channels.
Make sure to switch to the beta2 branch before downloading. A compiled jar could be found under target.

Any feature requests welcome - you could also open an Issue on GitHub or send me a PM.

Looking forward to any feedback.


(Hans-Jörg Merk) #2

If you are talking about the 4xx series of receivers, yes, would be interested.


(Markus Michels) #3

yep, I have a MR400, series 3 will not be supported


(Hans-Jörg Merk) #4

Great, in the meantime, I would be interested in you bash script :wink:


(Markus Michels) #5

this can be found here: https://github.com/markus7017/EntertainTV_Control
make sure to change
remote_ip="192.168.0.1"
remote_mac="AA:BB:CC:DD:EE:FF"
and install the proper packages (nc, md5sum, wakeonlan).

The receiver has to be set to standard standby mode. If it’s off the scripts sends a wakeonlan and then PINGs until it comes up before trying to do a pairing. That’s one thing I want to work on and be able to safely detect the power status, because the Power button is a toggle, which means you have to know the power status, before pressing Power and the receiver goes off even you want to send commands.


(Hans-Jörg Merk) #6

Thanks Markus, I will give it a try


(Hans-Jörg Merk) #7

Hi Markus,
I just get

Pairing request failed: -2

Any idea what could be the reason ? IP and MAC are set properly.


(Martin Herbst) #8

I am definitely interested and can offer to help testing a binding.


(Markus Michels) #9

Good to know, give me some time to get up to speed.

First I would like to get the script running with your setup. This might provide some additional information useful for the binding dev. I’ll come back latest at the weekend with some more information.


(Martin Herbst) #10

Sounds good, will try the shell script this weekend.


(Markus Michels) #11

soap_pair.xml and request_pair.log should be created while running the script. could you please provide them, what’s about screen output
-2 could be a file not found

Please make sure

  • curl, nc, wakeonlan, md5sum, awk, grep, tr are installed
  • to create a tmp sub-folder. Logs and temporary xml files go there.

Try to run

./entertain_control.sh log status

(Hans-Jörg Merk) #12

Thanks for your response.
Screen output :

Telekom Entertain Control
:49154 -> 192.168.0.55:49152; local MAC=
nc: Address already in use
Send pairing request (pairingDeviceID='D41D8CD98F00B204E9800998ECF8427E', friendlyName='oh-pi', userID='5903A68E8E31CF7EFC9718C635FC037D')
Result=-2
Pairing request failed: -2
OFFsult>-2</result>

soap_pair.xml

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:X-pairingRequest xmlns:u="urn:schemas-upnp-org:service:X-CTC_RemotePairing:1">
<pairingDeviceID>D41D8CD98F00B204E9800998ECF8427E</pairingDeviceID>
<friendlyName>oh-pi</friendlyName>
<userID>5903A68E8E31CF7EFC9718C635FC037D</userID>
</u:X-pairingRequest>
</s:Body></s:Envelope>

request_pair.log

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:X-pairingRequestResponse xmlns:u="urn:schemas-upnp-org:service:X-CTC_RemotePairing:1">
<result>-2</result>
</u:X-pairingRequestResponse>
</s:Body> </s:Envelope>

log status output

Telekom Entertain Control
:49154 -> 192.168.0.55:49152; local MAC=
Receiver is powered ON
ON


(Markus Michels) #13

The script is unable to detected the local ip / mac address.
which environment are you using?
Raspbian, macOS…?

Please try

ip link show eth0

and

ifconfig en0

one of them should work.

what does

uname

show?


(Hans-Jörg Merk) #14

I am running Ubuntu 16.04 LTS server on an Intel NUC.
This system does not have eth0 but enp3s0 as primary network interface.


(Markus Michels) #15

we could fiddel around that later

as a work around:

  • open the script and search for “function get_mac”
  • set ip_addr to your local IP address and mac_addr to your local MAC address
    at the end of the function:
    local_ip="192.168.x.x"
    mac_addr=“xx:xx:xx:xx:xx:xx”
  • run “./entertain_control.sh log status”

please also run the commands above and send the output


(Hans-Jörg Merk) #16

ip link show eth0

Device "eth0" does not exist

ifconfig en0

en0: Fehler beim Auslesen der Schnittstelleninformation: Gerät nicht gefunden

uname

Linux

Setting IP and MAC manually like you suggested does not change the result.
entertain_control.sh log status

Telekom Entertain Control
192.168.0.112:49154 -> 192.168.0.58:49152; local MAC=B8:AE:ED:70:16:25
Receiver is powered ON
ON

(Markus Michels) #17

ok, now try

./entertain_control.sh log on
./entertain_control.sh log off

and provide output from

ifconfig enp3s0
ip link show enp3s0

Polycom Telephony Event Notification XML format?
(Hans-Jörg Merk) #18

./entertain_control.sh log on

Telekom Entertain Control
192.168.0.112:49154 -> 192.168.0.58:49152; local MAC=B8:AE:ED:70:16:25
nc: Address already in use
Send pairing request (pairingDeviceID='ADA7A411BB1FD7A406F0AACE1C840A7E', friendlyName='oh-pi', userID='5903A68E8E31CF7EFC9718C635FC037D')
Result=-2
Pairing request failed: -2
OFFsult>-2</result>

./entertain_control.sh log off

Telekom Entertain Control
192.168.0.112:49154 -> 192.168.0.58:49152; local MAC=B8:AE:ED:70:16:25
nc: Address already in use
Send pairing request (pairingDeviceID='ADA7A411BB1FD7A406F0AACE1C840A7E', friendlyName='oh-pi', userID='5903A68E8E31CF7EFC9718C635FC037D')
Result=-2
Pairing request failed: -2
Press Power/result>
Send key '0x0100'
Result=
OFF

ifconfig enp3s0

enp3s0    Link encap:Ethernet  Hardware Adresse b8:ae:ed:70:16:25
          inet Adresse:192.168.0.112  Bcast:192.168.0.255  Maske:255.255.255.0
          inet6-Adresse: fe80::baae:edff:fe70:1625/64 Gültigkeitsbereich:Verbindung
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metrik:1
          RX-Pakete:40913666 Fehler:0 Verloren:0 Überläufe:0 Fenster:0
          TX-Pakete:28189254 Fehler:0 Verloren:0 Überläufe:0 Träger:0
          Kollisionen:0 Sendewarteschlangenlänge:1000
          RX-Bytes:26962718005 (26.9 GB)  TX-Bytes:3224939340 (3.2 GB)

ip link show enp3s0

2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether b8:ae:ed:70:16:25 brd ff:ff:ff:ff:ff:ff

(Markus Michels) #19

is curl installed?
please post request_pair.log


(Hans-Jörg Merk) #20

Hi Markus,
yes, curl is installed and working
request_pair.log

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:X-pairingRequestResponse xmlns:u="urn:schemas-upnp-org:service:X-CTC_RemotePairing:1">
<result>-2</result>
</u:X-pairingRequestResponse>
</s:Body> </s:Envelope>

Thanks for your support