MagentaTV Binding for Deutsche Telekom MR 4xx

MENU…

Yeah… that makes sense… but i dont know how other Media Receivers handle this?
Which one do you have?

Does anybody have a other model to test this?

2020-06-14 12_46_22-Window

Maybe this “home” button could be used as “Menu” key?! Does this make sense?

Hi, I tried to install the binding today, but I get the following WARN message:

    2020-06-15 23:01:52.146 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab2/addons/org.openhab.binding.magentatv-2.5.6-SNAPSHOT.jar

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.magentatv [279]

  Unresolved requirement: Import-Package: org.apache.commons.net.util; version="[3.3.0,4.0.0)"

	at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]

	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]

	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

I am not sure what is missing, any help would be appreciated.

check beta installation

Could you elaborate on your „volume rule“?
Please.

Thanks, Thomas

I tried to install the feature, but I am getting an error message, that it cannot be found.

openhab> feature:install esh-io-transport-upnp
Error executing command: No matching features for esh-io-transport-upnp/0

Any idea what I need to do?

I will post it hopefully today.

try

feature:install openhab-transport-upnp

This is the list of key codes: https://support.huawei.com/hedex/pages/DOC1100366313CEH0713H/01/DOC1100366313CEH0713H/01/resources/dsv_hdx_idp/DSV/en/en-us_topic_0094619112.html

You could send a 0xhhhh code directly to the key channel and play around. Maybe you find the time to discover all codes for the keys on the remote. I could easily add additional codes.

MENU uses code 0x0110, which is defined as PORTAL. This works for my setup (MR401B)

The list above is not complete, maybe we are able to find the media keys by just trying other codes. No so easy within 65535 different code :slight_smile:

I found here Upgrade Openhab 2.4.0 => 2.5.0M4 - KNX-User-Forum) that

feature:install esh-io-transport-upnp

changed to

feature:install openhab-core-io-transport-upnp

But openhab-transport-upnp (as you wrote in your answer) and openhab-core-io-transport-upnp are both already started on my system

openhab> openhab> feature:list|grep openhab-transport-upnp
> openhab-transport-upnp                            x 2.5.0            x          x Started     x distro-2.5.5             x UPnP Transport


feature:list|grep openhab-core-io-transport-upnp
openhab-core-io-transport-upnp                    x 2.5.0            x          x Started     x distro-2.5.5             x

I have always problems understanding those error messages, but does

Unresolved requirement: Import-Package: org.apache.commons.net.util; version="[3.3.0,4.0.0)"

mean I need the feature or bundle “Apache Commons Net Util”?

I found the solution in an older conversation between us when I googled the error :wink:

I had to uninstall the Hue binding, install magentatv, install hue again and the receivers where found immediately.

see, we already knew the solution :wink:

1 Like

I’m going to extend the key code table:

       keyMap.put("POWER", "0x0100");
        keyMap.put("MEDIA", "0x0462");
        keyMap.put("TTEXT", "0x0560");
        keyMap.put("0", "0x0030");
        keyMap.put("1", "0x0031");
        keyMap.put("2", "0x0032");
        keyMap.put("3", "0x0033");
        keyMap.put("4", "0x0034");
        keyMap.put("5", "0x0035");
        keyMap.put("6", "0x0036");
        keyMap.put("7", "0x0037");
        keyMap.put("8", "0x0038");
        keyMap.put("9", "0x0039");
        keyMap.put("SPACE", "0x0020");
        keyMap.put("POUND", "0x0069");
        keyMap.put("STAR", "0x006A");
        keyMap.put("UP", "0x0026");
        keyMap.put("DOWN", "0x0028");
        keyMap.put("LEFT", "0x0025");
        keyMap.put("RIGHT", "0x0027");
        keyMap.put("PGUP", "0x0021");
        keyMap.put("PGDOWN", "0x0022");
        keyMap.put("DELETE", "0x0008");
        keyMap.put("ENTER", "0x000D");
        keyMap.put("SEARCH", "0x0451");
        keyMap.put("RED", "0x0113");
        keyMap.put("GREEN", "0x0114");
        keyMap.put("YELLOW", "0x0115");
        keyMap.put("BLUE", "0x0116");
        keyMap.put("EPG", "0x0111");
        keyMap.put("OPTION", "0x0460");
        keyMap.put("OK", "0x000D");
        keyMap.put("BACK", "0x0008");
        keyMap.put("EXIT", "0x045D");
        keyMap.put("MENU", "0x0110");
        keyMap.put("PORTAL", "0x0110");
        keyMap.put("TVMENU", "0x0454");
        keyMap.put("VODMENU", "0x0455");
        keyMap.put("TVODMENU", "0x0456");
        keyMap.put("NVODMENU", "0x0458");
        keyMap.put("PVR", "0x0457");
        keyMap.put("VOLUP", "0x0103");
        keyMap.put("VOLDOWN", "0x0104");
        keyMap.put("INFO", "0x010C");
        keyMap.put("INTER", "0x010D");
        keyMap.put("HELP", "0x011C");
        keyMap.put("SETTINGS", "0x011D");
        keyMap.put("MUTE", "0x0105");
        keyMap.put("CHUP", "0x0101");
        keyMap.put("CHDOWN", "0x0102");
        keyMap.put("REWIND", "0x0109");
        keyMap.put("PLAY", "0x0107");
        keyMap.put("PAUSE", "0x0107");
        keyMap.put("FORWARD", "0x0108");
        keyMap.put("TRACK", "0x0106");
        keyMap.put("PREVCH", "0x010B");
        keyMap.put("NEXTCH", "0x0107");
        keyMap.put("RECORD", "0x0461");
        keyMap.put("STOP", "0x010E");
        keyMap.put("BEGIN", "0x010B");
        keyMap.put("END", "0x010A");
        keyMap.put("REPLAY", "0x045B");
        keyMap.put("SKIP", "0x045C");
        keyMap.put("LAST", "0x045E");
        keyMap.put("SUBTITLE", "0x236");
        keyMap.put("RECORDINGS", "0x045F");
        keyMap.put("FAV", "0x0119");
        keyMap.put("SOURCE", "0x0083");
        keyMap.put("SWITCH", "0x0118");
        keyMap.put("IPTV", "0x0081");
        keyMap.put("PC", "0x0082");
        keyMap.put("PIP", "0x0084");
        keyMap.put("MULTIVIEW", "0x0562");
        keyMap.put("F1", "0x0070");
        keyMap.put("F2", "0x0071");
        keyMap.put("F3", "0x0072");
        keyMap.put("F4", "0x0073");
        keyMap.put("F5", "0x0074");
        keyMap.put("F6", "0x0075");
        keyMap.put("F7", "0x0076");
        keyMap.put("F8", "0x0077");
        keyMap.put("F9", "0x0078");
        keyMap.put("F10", "0x0079");
        keyMap.put("F11", "0x007A");
        keyMap.put("F12", "0x007B");
        keyMap.put("F13", "0x007C");
        keyMap.put("F14", "0x007D");
        keyMap.put("F15", "0x007E");
        keyMap.put("F16", "0x007F");

but still missing TV, RADIO, MUSIC, MEDIA keys. Maybe some trial help to find them.

Okay thanks for this link… will play a bit in the next days when i have time :slight_smile:

As promised my volume rule. This is not a perfect solution, but for me it is acceptable. It could be optimized by initializing the receiver volume once and the only calculate differences. Problem with this is that any RC usage breaks the algorithm because the system did not see the RC changes.

First i created a dimmer item that is shown im my sitemap. Additionaly the volume cloud be controled by Alexa. So here are the items

/ RB_GF_LR_TVReceiver
Group					gRB_GF_LR_TVReceiver
                        "RB_GF_LR: TV Receiver"
                        <it_television>
                        (gRB_GF_LivingRoom, gMedia, gSpeechCmnd)
                        {alexa="Endpoint.TV" [category="TV"],
                         speechctrl="" [roomHint="Wohnzimmer", friendlyName="Fernseher"]}

Dimmer					RB_GF_LR_TVReceiver_Volume
                        "RB_GF_LR: TV Receiver volume [%d %%]"
                        <audio_volume_high>
                        (gRB_GF_LR_TVReceiver)
                        {alexa="Speaker.volume" [category="TV", increment="3"]}

Next is the python rule. It simply lowers the volume to 0 and the to the desired value.

from core.rules import rule
from core.triggers import when
import math
import time

@rule("Adjust receiver volume", description="Set volume of receiver to a defined value", tags=["Rule", "Receiver"])
@when("Item RB_GF_LR_TVReceiver_Volume received update")
def adjust_receiver_volume(event):

adjust_receiver_volume.log.debug(u'Receiver volume target is {}'.format(items["RB_GF_LR_TVReceiver_Volume"]))

# set volume to 0
for i in range(0, 31, 1):
    events.sendCommand("RB_GF_LR_TVReceiver_Key", "VOLDOWN")
    #time.sleep(0.001) found this not neccessary

# set volume to desired value
for i in range(0, int(math.ceil(float(str(items["RB_GF_LR_TVReceiver_Volume"]))*30.0/100.0)), 1):
    events.sendCommand("RB_GF_LR_TVReceiver_Key", "VOLUP")
    #time.sleep(0.001) found this not neccessary

adjust_receiver_volume.log.debug(u'Volume adjusted.')

And thats it for the moment. Unfortunately i have serious network issues with my receiver to enhancing the rule wil take a while until the other problems are solved.

1 Like

I updated the DEV build to include the latest review changes and the additional keys.
Please note: Depending on the model or the mode not all keys will work, e.g. wenn some media is playing only specific keys work.

Please helpwith final testing.

1 Like

After removing things and items and uninstall the old binding, i have added the new dev build and the autodiscovered thing.

This is the error message i get… Thing went online anyway and all seems to work.

2020-06-17 07:57:23.318 [ERROR] [st.core.internal.thing.ThingResource] - Exception during HTTP PUT request for update config at 'things/magentatv:receiver:7a8a7cd6-853c-5c60-b136-AC6FBB756476/config'
java.lang.IllegalStateException: Handler should not be null here
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.initializeHandler(ThingManagerImpl.java:647) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl.access$13(ThingManagerImpl.java:623) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingManagerImpl$1.configurationUpdated(ThingManagerImpl.java:290) ~[?:?]
	at org.eclipse.smarthome.core.thing.binding.BaseThingHandler.handleConfigurationUpdate(BaseThingHandler.java:111) ~[?:?]
	at org.openhab.binding.magentatv.internal.handler.MagentaTVHandler.handleConfigurationUpdate(MagentaTVHandler.java:209) ~[?:?]
	at org.eclipse.smarthome.core.thing.internal.ThingRegistryImpl.updateConfiguration(ThingRegistryImpl.java:93) ~[?:?]
	at org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.updateConfiguration(ThingResource.java:438) [bundleFile:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:?]
	at java.lang.reflect.Method.invoke(Unknown Source) ~[?:?]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [bundleFile:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) [bundleFile:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) [bundleFile:?]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) [bundleFile:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) [bundleFile:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) [bundleFile:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) [bundleFile:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) [bundleFile:?]
	at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [bundleFile:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [bundleFile:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [bundleFile:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [bundleFile:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [bundleFile:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [bundleFile:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [bundleFile:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [bundleFile:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [bundleFile:?]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) [bundleFile:?]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [bundleFile:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [bundleFile:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [bundleFile:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [bundleFile:?]
	at com.eclipsesource.jaxrs.publisher.internal.ServletContainerBridge.service(ServletContainerBridge.java:76) [bundleFile:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:544) [bundleFile:9.4.20.v20190813]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceServletHandler.doHandle(HttpServiceServletHandler.java:71) [bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) [bundleFile:9.4.20.v20190813]
	at org.ops4j.pax.web.service.jetty.internal.HttpServiceContext.doHandle(HttpServiceContext.java:293) [bundleFile:?]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [bundleFile:9.4.20.v20190813]
	at org.ops4j.pax.web.service.jetty.internal.JettyServerHandlerCollection.handle(JettyServerHandlerCollection.java:80) [bundleFile:?]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.Server.handle(Server.java:494) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:782) [bundleFile:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:918) [bundleFile:9.4.20.v20190813]
	at java.lang.Thread.run(Unknown Source) [?:?]
2020-06-17 07:57:23.345 [me.event.ThingUpdatedEvent] - Thing 'magentatv:receiver:7a8a7cd6-853c-5c60-b136-AC6FBB756476' has been updated.
==> /var/log/openhab2/openhab.log <==
2020-06-17 07:57:28.323 [INFO ] [tv.internal.handler.MagentaTVHandler] - MagentaTV Media Receiver - DMS_AC6FBB756476: Authenticate account dach-hase@t-online.de
==> /var/log/openhab2/events.log <==
2020-06-17 07:57:29.665 [me.event.ThingUpdatedEvent] - Thing 'magentatv:receiver:7a8a7cd6-853c-5c60-b136-AC6FBB756476' has been updated.
2020-06-17 07:57:29.676 [me.event.ThingUpdatedEvent] - Thing 'magentatv:receiver:7a8a7cd6-853c-5c60-b136-AC6FBB756476' has been updated.
2020-06-17 07:57:29.695 [hingStatusInfoChangedEvent] - 'magentatv:receiver:7a8a7cd6-853c-5c60-b136-AC6FBB756476' changed from UNINITIALIZED (HANDLER_MISSING_ERROR) to ONLINE
2020-06-17 07:57:29.699 [me.event.ThingUpdatedEvent] - Thing 'magentatv:receiver:7a8a7cd6-853c-5c60-b136-AC6FBB756476' has been updated.

looks like a timing issue. Do you see it again after an OH restart?

No… no errors at all

is this binding also support MR601?