AndroidTV and MagentaTV One 2.0

Unfortunatelly the Telekom migrated our existing MagentaTV from the old M400/MR200 installation to the new MagentaTV One-Boxes. With the old MagentaTV binding i had everthing under control, the AndroidTV binding challanges me more.

Espacially the keycodes for programming a virtual remote in Openhab is a problem, i have read that @dk8pn have started some work on this, maybe he oder anyone else who have done this can share their code?

I have a “simple graphics” setup as virtual remote using the openHAB BasicUI and item state mappings. Here are the channels used by the binding:

This is a screenshot of the BasicUI:

Here is my sitemap code which generates the buttons as in the BasicUI screnshot above:

Group item=MagentaTV_One_Wohnzimmer icon="screen" {
   Switch item=MagentaTV_One_2_Generation_2051F5360A4F_Betrieb label="Ein/Aus []" icon="switch" mappings=[ ON="Ein", OFF="Aus" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="MenĂĽ []" icon="screen" mappings=[ KEY_BACK="BACK", KEY_HOME="HOME" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Up / Down []" icon="movecontrol" mappings=[ KEY_UP="   Ë„   ", KEY_ENTER="  OK   ", KEY_DOWN="   Ë…   " ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Left / Right []" icon="movecontrol" mappings=[ KEY_LEFT="  <  ", KEY_ENTER="  OK   ", KEY_RIGHT="  >  "  ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Select []" icon="tastatur" mappings=[ KEY_1="  1   ", KEY_2="  2  ", KEY_3="  3  " ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Select []" icon="tastatur" mappings=[ KEY_4="  4  ", KEY_5="  5  ", KEY_6="  6  " ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Select []" icon="tastatur" mappings=[ KEY_7="  7  ", KEY_8="  8  ", KEY_9="  9  " ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Select []" icon="tastatur" mappings=[ DELETE="", KEY_0=" 0 ", TTEXT="" ]
   //Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Löschen []" icon="delete" mappings=[ DELETE="DELETE" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Kanal / Zippen []" icon="screen" mappings=[ KEY_UP="CH +", KEY_DOWN="CH -" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Player []" icon="mediacontrol" mappings=[ KEY_REWIND="<<", KEY_PLAY="PLAY", KEY_PAUSE="||", KEY_STOP="STOP", KEY_FORWARD=">>" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Player []" icon="mediacontrol" mappings=[ KEY_PREVIOUS="|<<", KEY_NEXT=">>|" ]
   //Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Aufnahme []" icon="record" mappings=[ KEY_REC="RECORD" ]
   Switch item=MagentaTV_One_2_Generation_2051F5360A4F_Stumm_schalten label="Mute []" icon="soundvolume" mappings=[ ON="mute", OFF="unmute" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Lautstärke One (25 = max.) []" icon="soundvolume" mappings=[ KEY_VOLUP="VOL +", KEY_VOLDOWN="VOL -" ]

Up to now, i have not been able to find commands for EPG or RECORD. If you figure out something i will be happy. But probably there are none.

Hope that this information helps you.

Alternative:

Many thanks for this hint. Did not know this element type up to now.

Played a bit arround with the element type “Buttongrid”. Major disadvantage is that it is stateless and that it can’t use dynamic icons. Thus, for the moment, i ended up with a mix of “Buttongrid” and “item state mapping” commands.

BasicUI screenshot of the openHAB remote control from my Windows 11 computer:

BasicUI screenshot of the openHAB remote control from my iPhone:

Due to the “Buttongrid” implementation it looks definetely better than before :grinning_face: .

Sitemap code:

Group item=MagentaTV_One_Wohnzimmer icon="screen" {
   Switch item=MagentaTV_One_2_Generation_2051F5360A4F_Betrieb label="Ein/Aus []" icon="switch" mappings=[ ON="Ein", OFF="Aus" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="MenĂĽ []" icon="screen" mappings=[ KEY_BACK="BACK", KEY_HOME="HOME" ]
   Buttongrid label="" {
   Button row=1 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="Up" staticIcon=f7:arrowtriangle_up_fill stateless click=KEY_UP
   Button row=3 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="Down" staticIcon=f7:arrowtriangle_down_fill stateless click=KEY_DOWN
   Button row=2 column=1 item=MagentaTV_One_Wohnzimmer_Key_Press label="Left" staticIcon=f7:arrowtriangle_left_fill stateless click=KEY_LEFT
   Button row=2 column=3 item=MagentaTV_One_Wohnzimmer_Key_Press label="Right" staticIcon=f7:arrowtriangle_right_fill stateless click=KEY_RIGHT
   Button row=2 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="OK" stateless click=KEY_ENTER
   Button row=4 column=1 item=MagentaTV_One_Wohnzimmer_Key_Press label="1" stateless click=KEY_1
   Button row=4 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="2" stateless click=KEY_2
   Button row=4 column=3 item=MagentaTV_One_Wohnzimmer_Key_Press label="3" stateless click=KEY_3
   Button row=5 column=1 item=MagentaTV_One_Wohnzimmer_Key_Press label="4" stateless click=KEY_4
   Button row=5 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="5" stateless click=KEY_5
   Button row=5 column=3 item=MagentaTV_One_Wohnzimmer_Key_Press label="6" stateless click=KEY_6
   Button row=6 column=1 item=MagentaTV_One_Wohnzimmer_Key_Press label="7" stateless click=KEY_7
   Button row=6 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="8" stateless click=KEY_8
   Button row=6 column=3 item=MagentaTV_One_Wohnzimmer_Key_Press label="9" stateless click=KEY_9
   Button row=7 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="0" stateless click=KEY_0
   Button row=8 column=1 item=MagentaTV_One_Wohnzimmer_Key_Press label="Rewind" staticIcon=f7:backward_fill stateless click=KEY_REWIND
   Button row=8 column=2 item=MagentaTV_One_Wohnzimmer_Key_Press label="Play/Pause" staticIcon=f7:playpause_fill stateless click=KEY_PLAY
   Button row=8 column=3 item=MagentaTV_One_Wohnzimmer_Key_Press label="Forward" staticIcon=f7:forward_fill stateless click=KEY_FORWARD
   }
   Switch item=MagentaTV_One_2_Generation_2051F5360A4F_Stumm_schalten label="Mute []" icon="soundvolume" mappings=[ ON="mute", OFF="unmute" ]
   Switch item=MagentaTV_One_Wohnzimmer_Key_Press label="Volume []" icon="soundvolume" mappings=[ KEY_VOLDOWN="VOL -", KEY_VOLUP="VOL +" ]
   }

Edit: one remark w.r.t. “Forward” and “Rewind”. The original “Magenta One Remote” transmits continuous IR signals if these buttons are pressed. This allows to quickly move back and forth. The network remote control, as setup in openHAB, transmits a 10 secs forward or rewind step once if such button is pressed. Thus, it has to be pressed several times in order to “Forward” or “Rewind” quicker but it can’t replace the IR remote. This limitation could probably be improved by a rule which overtakes and improves this job.

Any other ideas are very welcome!

Thank you very much for the inspiration, with that i build a basic remote for our two MagentaTV One.

I solved the EPG problem with a Functional Item (Switch) called FI_g01_studio_mtv_01_EPG, this triggers a little rule, which will hopefully work until the Telekom changes anything in the layout.

// EPG AKTIVIEREN UND DEAKTIVIEREN
rule "EPG"
when
    Item FI_g01_studio_mtv_01_EPG changed
then
    if (FI_g01_studio_mtv_01_EPG.state == ON) {
        g01_studio_mtv_01_keycode.sendCommand(3)        // HOME
        Thread::sleep(1500)
        g01_studio_mtv_01_keycode.sendCommand(20)       // DOWN
        Thread::sleep(1000)
        g01_studio_mtv_01_keycode.sendCommand(66)       // ENTER
    }

    if (FI_g01_studio_mtv_01_EPG.state == OFF) {
        g01_studio_mtv_01_keycode.sendCommand(3)        // HOME
        Thread::sleep(1500)
        g01_studio_mtv_01_keycode.sendCommand(22)       // RIGHT
        Thread::sleep(1000)
        g01_studio_mtv_01_keycode.sendCommand(66)       // ENTER
    }
end 

This have one constraint, if you hopp through the channels and leave by entering a program with OK, the EPG is ended, but the switch will stay ON, i did not found a solution for that since now. But the rule will go back to the selected channel even if you switch OFF, while you are watching TV within 2.5s. The long time between the commands is necessary to buffer a reaction time of the MagentaTV One. Maybe not the best solution, but it’s functional.

For the record problem i did not find anything since now.

For the switch, you could use “Metadata” → “Expiration Timer”. This makes your switch a push-button which will be OFF again after a configurable time.

For the REC button function you could also use a rule. Select a movie from EPG pressing “Enter”, step to “Record” and pressing “Enter” again (not yet the detailed procedure :winking_face_with_tongue: ).

Applying your method of stepping through the menus, i ended up with the following mix of “Buttongrid” and “item state mapping” commands:

This is my BasicUI sitemap code:

Group item=MagentaTV_One_Schlafzimmer icon="screen" {
   Switch item=MagentaTV_ONE_10763627BABA_Betrieb label="Ein/Aus []" icon="switch" mappings=[ ON="Ein", OFF="Aus" ]
   Switch item=MagentaTV_ONE_10763627BABA_Key_Press label="MenĂĽ []" icon="screen" mappings=[ KEY_BACK="BACK", KEY_HOME="HOME" ]
   Buttongrid label="" {
   Button row=1 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="Up" staticIcon=f7:arrowtriangle_up_fill stateless click=KEY_UP
   Button row=3 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="Down" staticIcon=f7:arrowtriangle_down_fill stateless click=KEY_DOWN
   Button row=2 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="Left" staticIcon=f7:arrowtriangle_left_fill stateless click=KEY_LEFT
   Button row=2 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="Right" staticIcon=f7:arrowtriangle_right_fill stateless click=KEY_RIGHT
   Button row=2 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="OK" stateless click=KEY_ENTER
   Button row=4 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="1" stateless click=KEY_1
   Button row=4 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="2" stateless click=KEY_2
   Button row=4 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="3" stateless click=KEY_3
   Button row=5 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="4" stateless click=KEY_4
   Button row=5 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="5" stateless click=KEY_5
   Button row=5 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="6" stateless click=KEY_6
   Button row=6 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="7" stateless click=KEY_7
   Button row=6 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="8" stateless click=KEY_8
   Button row=6 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="9" stateless click=KEY_9
   Button row=7 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="0" stateless click=KEY_0
   Button row=8 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="TV_REC" stateless click=KEY_TVREC
   Button row=8 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="EPG" stateless click=KEY_EPG
   Button row=8 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="EPG_REC" stateless click=KEY_EPGREC
   Button row=9 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="Rewind" staticIcon=f7:backward_fill stateless click=KEY_REWIND
   Button row=9 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="Play/Pause" staticIcon=f7:playpause_fill stateless click=KEY_PLAY
   Button row=9 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="Forward" staticIcon=f7:forward_fill stateless click=KEY_FORWARD
   }
   Switch item=MagentaTV_ONE_10763627BABA_Stumm_schalten label="Mute []" icon="soundvolume" mappings=[ ON="mute", OFF="unmute" ]
   Switch item=MagentaTV_ONE_10763627BABA_Key_Press label="Volume []" icon="soundvolume" mappings=[ KEY_VOLDOWN="VOL -", KEY_VOLUP="VOL +" ]
   Switch item=MagentaTV_ONE_10763627BABA_Key_Press label="Channel []" icon="screen" mappings=[ KEY_DOWN="CH -" , KEY_UP="CH +" ]
   }

These are my rules:

rule "EPG MagentaTV Schlafzimmer"
    when
        Item MagentaTV_ONE_10763627BABA_Key_Press received command KEY_EPG
    then
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(3)        // HOME
        Thread::sleep(1500)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(20)       // DOWN
        Thread::sleep(1000)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)       // ENTER
end
 
rule "EPG REC MagentaTV Schlafzimmer"
    when
        Item MagentaTV_ONE_10763627BABA_Key_Press received command KEY_EPGREC
    then
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)        // Enter
        Thread::sleep(500)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(22)        // RIGHT
        Thread::sleep(500)
		MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)        // ENTER
        Thread::sleep(500)
		MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)        // ENTER
end 

rule "TV REC MagentaTV Schlafzimmer"
    when
        Item MagentaTV_ONE_10763627BABA_Key_Press received command KEY_TVREC
    then
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)        // Enter
        Thread::sleep(500)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(19)        // UP
        Thread::sleep(500)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(22)        // RIGHT
        Thread::sleep(500)
		MagentaTV_ONE_10763627BABA_Keycode.sendCommand(22)        // RIGHT
        Thread::sleep(500)
		MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)        // ENTER
        Thread::sleep(500)
		MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)        // ENTER
end 

I need no switch because i apply the buttongrid. The button codes KEY_EPG, KEY_TVREC and KEY_EPGREC are “freestyle” but this is sufficient in order to be recognized by the rules.

In order to record (REC), the steps are different for a REC in running live TV (KEY_TVREC) or a REC for a future element within the EPG (KEY_EPGREC).

Disadvantage to be handled with care: the buttons both also delete the programmed records again if pressed a 2nd time. The buttons TV_REC and EPG_REC could probably be separated more in order to prevent to be pressed by accident. Or the final “ENTER” could be taken out of the rule procedure in order to be pressed/confirmed manually?

Edit 27.08.2026:

For EPG recording, different programs unfortunately require different steps. Thus, this button doesn’t make much sense. For the button TV_REC i have not yet seen limitations.

Thanks in advance for any other reporting.

Found a better solution for the RECORD issue. The Android Keycode 130 can be applied. This works from EPG as well as from live TV and all programs. The opened screen can be confirmed manually. Also integrated most functions into the buttongrid except the power ON/OFF switch due to the dynamic icon.

The keycode command can be applied directly from the buttongrid. Thus, finally we only need the rule for EPG.

My BasicUI sitemap code:

Group item=MagentaTV_One_Schlafzimmer icon="screen" {
   Switch item=MagentaTV_ONE_10763627BABA_Betrieb label="Ein/Aus []" icon="switch" mappings=[ ON="Ein", OFF="Aus" ]
   Buttongrid label="" {
   Button row=1 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="BACK" stateless click=KEY_BACK
   Button row=1 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="HOME" stateless click=KEY_HOME
   Button row=1 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="EPG" stateless click=KEY_EPG
   Button row=1 column=4 item=MagentaTV_ONE_10763627BABA_Keycode label="REC" stateless click=130
   Button row=2 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="Up" staticIcon=f7:arrowtriangle_up_fill stateless click=KEY_UP
   Button row=4 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="Down" staticIcon=f7:arrowtriangle_down_fill stateless click=KEY_DOWN
   Button row=3 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="Left" staticIcon=f7:arrowtriangle_left_fill stateless click=KEY_LEFT
   Button row=3 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="Right" staticIcon=f7:arrowtriangle_right_fill stateless click=KEY_RIGHT
   Button row=3 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="OK" stateless click=KEY_ENTER
   Button row=5 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="1" stateless click=KEY_1
   Button row=5 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="2" stateless click=KEY_2
   Button row=5 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="3" stateless click=KEY_3
   Button row=5 column=4 item=MagentaTV_ONE_10763627BABA_Key_Press label="CH+" stateless click=KEY_UP
   Button row=6 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="4" stateless click=KEY_4
   Button row=6 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="5" stateless click=KEY_5
   Button row=6 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="6" stateless click=KEY_6
   Button row=7 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="7" stateless click=KEY_7
   Button row=7 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="8" stateless click=KEY_8
   Button row=7 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="9" stateless click=KEY_9
   Button row=7 column=4 item=MagentaTV_ONE_10763627BABA_Key_Press label="CH-" stateless click=KEY_DOWN
   Button row=8 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="0" stateless click=KEY_0
   Button row=9 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="Rewind" staticIcon=f7:backward_fill stateless click=KEY_REWIND
   Button row=9 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="Play/Pause" staticIcon=f7:playpause_fill stateless click=KEY_PLAY
   Button row=9 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="Forward" staticIcon=f7:forward_fill stateless click=KEY_FORWARD
   Button row=10 column=1 item=MagentaTV_ONE_10763627BABA_Key_Press label="VOL-" stateless click=KEY_VOLDOWN
   Button row=10 column=2 item=MagentaTV_ONE_10763627BABA_Key_Press label="MUTE" staticIcon=soundvolume_mute stateless click=KEY_PLAY
   Button row=10 column=3 item=MagentaTV_ONE_10763627BABA_Key_Press label="VOL+" stateless click=KEY_VOLUP
   }
   }

Remaining EPG rule:

rule "EPG MagentaTV Schlafzimmer"
    when
        Item MagentaTV_ONE_10763627BABA_Key_Press received command KEY_EPG
    then
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(3)      // HOME
        Thread::sleep(1500)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(20)     // DOWN
        Thread::sleep(1000)
        MagentaTV_ONE_10763627BABA_Keycode.sendCommand(66)     // ENTER
end

Screenshot of the remote control from my iPhone: