Horizon TV mediabox binding

I am working on a HorizonTV mediabox binding. The Horizon mediabox is a settopbox which is used by the biggest dutch cable companies (Ziggo/UPC) for their HorizonTV service. The mediabox is manufactured by Samsung (SMT-G7400 and SMT-G7401). Please let me now if there is any need for such a binding and I will create a pull request for sharing it with the main openhab repo.

I use a Horizon box (SMT-G7401) and would love to have a binding for it.

Gert

I am interested in this as well.

Thanks for working on it.

Guido

+1
UPC is providing this box in Switzerland as well

I am also interested in a Binding.
Greetings Peter

I have tested the binding myself on the SMT-G7401. Is anyone willing to test the new binding? Snapshot url: dropboxlink. On the wiki page you can find how to use the binding: wiki

Hi Kuijp, I’m trying to get the status from the box but I get no response on port 62137.
Did you do anything else to the Horizon box? I’ve tried it op the SMT7400 and 7401. Same result…

Hmm strange, sure you’re using the correct IP address? Maybe the port isn’t the same on every box.

I used a linux tool called gssdp-discover (from gupnp-tools), to search for UPNP services on my network. Then my horizonbox showed up as the upnp MediaServer:1 service. This service is only exposed when the box is not in standby. Maybe you should use the same tool to see if you get the same result, or maybe a different port.

My result:

gssdp-discover -i eth0 --target=urn:schemas-upnp-org:device:MediaServer:1
Using network interface eth0
Scanning for resources matching urn:schemas-upnp-org:device:MediaServer:1
Showing "available" messages
resource available
  USN:      uuid:bladie-bladie-bla::urn:schemas-upnp-org:device:MediaServer:1
  Location: http://192.168.1.206:62137/DeviceDescription.xml

Nope… the discover tool doesn’t find the horizon… only a few windows systems appear.

Are there other people the used your solution? I don’t think I’ve done anything weird with the box.

I haven’t done anything special with the box either. I am using it on a SMT-G7401 provided by Ziggo in Holland. Using the latest firmware. I have connected it to my home network with a LAN kabel.

When you scan your network for devices with an app like “Net Analyzer”, does it popup? So you’re sure it is properly connected to your home network. It is known that it can be a bit of a pain to get the box properly connected to a LAN.

Is it just the power status check that isn’t working or doesn’t the binding work either?

Using the gssdp-discover tool without the “target” property should show some other services provided by the box as well.

I discovered that most of the services are on a different ip address than I configured but the “MediaServer” isn’t one of them.

I believe the binding is done on the VNC port?

Do you see the media service under windows? These are the services (in the red square) that I see:

Sorry for the late response.

Yes that’s right the binding is using the vnc port. I am afraid I don’t own a windows PC and my virtual box doesn’t show any upnp devices.

Is the binding working ok and is it just the power status check that isn’t working or are both not working?

I tested the binding with Openhab 2.0 and I have a strange problem: The binding seems to repeat the command endlessly. If I push the button again it sometimes stops, but not always. I have the items configured with autoupdate=“false” and with mapping ON only in the sitemap. I see the command changes in the log and they only occur on button press.

Hmm I don’t have an Openhab running on 2.0 yet. That’s still on my todo list. Do you see this behavior with every command or specific commands?

Unfortunately with every command.

Van: Kuijp bot@community.openhab.org
Verzonden: dinsdag 7 juni 2016 20:21:42
Aan: Jan-Willem Spuij
Onderwerp: [openHAB] [Add-ons/Bindings] Horizon TV mediabox binding

[https://community.openhab.org/letter_avatar_proxy/v2/letter/k/838e76/45.png] kuijphttps://community.openhab.org/users/kuijp
June 7

Hmm I don’t have an Openhab running on 2.0 yet. That’s still on my todo list. Do you see this behavior with every command or specific commands?

Visit Topichttps://community.openhab.org/t/horizon-tv-mediabox-binding/6642/15 or reply to this email to respond

In Reply To
[https://community.openhab.org/user_avatar/community.openhab.org/jspuij/45/2630_1.png] jspuijhttps://community.openhab.org/users/jspuij Jan-Willem Spuijhttps://community.openhab.org/users/jspuij
May 24

I tested the binding with Openhab 2.0 and I have a strange problem: The binding seems to repeat the command endlessly. If I push the button again it sometimes stops, but not always. I have the items configured with autoupdate=“false” and with mapping ON only in the sitemap. I see the command changes…

Visit Topichttps://community.openhab.org/t/horizon-tv-mediabox-binding/6642/15 or reply to this email to respond

To stop receiving notifications for this particular topic, click herehttps://community.openhab.org/t/horizon-tv-mediabox-binding/6642/unsubscribe. To unsubscribe from these emails, change your user preferenceshttps://community.openhab.org/my/preferences

Sorry for my late response this time :slight_smile:
I’m only looking at the power status check. Did anyone else have sucess with this?
I still find it stange that you have a mediaserver upnp service on the horizon and I can’t find it. I used the same tool to scan the network but this only shows a windows system.
Are you using an extra horizon (the small box) media box?

You can control powercycle by this script:

<?php
/*
Script (C) KixAss 2016 - horizon@kixass.net

Possible keys:
KEY_POWER        = E0 00
KEY_OK             = E0 01
KEY_BACK         = E0 02
KEY_CHAN_UP        = E0 06
KEY_CHAN_DWN    = E0 07
KEY_HELP        = E0 09
KEY_MENU        = E0 0a
KEY_GUIDE        = E0 0b
KEY_INFO        = E0 0e
KEY_TEXT        = E0 0f
KEY_MENU1        = E0 11
KEY_MENU2        = E0 15
KEY_DPAD_UP        = E1 00
KEY_DPAD_DOWN    = E1 01
KEY_DPAD_LEFT    = E1 02
KEY_DPAD_RIGHT    = E1 03
KEY_NUM_0        = E3 00
KEY_NUM_1        = E3 01
KEY_NUM_2        = E3 02
KEY_NUM_3        = E3 03
KEY_NUM_4        = E3 04
KEY_NUM_5        = E3 05
KEY_NUM_6        = E3 06
KEY_NUM_7        = E3 07
KEY_NUM_8        = E3 08
KEY_NUM_9        = E3 09
KEY_PAUSE        = E4 00
KEY_STOP        = E4 02
KEY_RECORD        = E4 03
KEY_FWD            = E4 05
KEY_RWD            = E4 07
KEY_MENU3        = Ef 00
KEY_UNKNOWN_0     = Ef 06;    // TIMESHIFT INF
KEY_UNKNOWN_1    = Ef 15;    // POWE
KEY_UNKNOWN_2    = Ef 16;    // N
KEY_UNKNOWN_3    = Ef 17;    // RC PAIRIN
KEY_UNKNOWN_4    = Ef 19;    // TIMIN
KEY_ONDEMAND    = Ef 28
KEY_DVR         = Ef 29
KEY_TV = Ef 2a;
*/

function makeBuffer($data)
{
    $data = str_replace(" ", "", $data);
    return hex2bin($data);
}


$localip = "192.168.192.100";
$localport = 5900;
$key = "E0 00"; // Power toggle


if ($sock = fsockopen($localip, $localport))
{
    $data = fgets($sock); // readVersionMsg
    echo "recv version: " . $data . "<br>";
    echo "recv version: " . makeBuffer2($data) . "<br>";

    echo "-----------------------------<br>";

    fwrite($sock, $data); // Send the same version back

    $data = fgets($sock, 2); // Get OKE
    echo "recv: " . $data . "<br>";
    echo "recv: " . makeBuffer2($data) . "<br>";

    echo "-----------------------------<br>";

    fwrite($sock, makeBuffer("01")); // Send Authorization type (none)

    $data = fgets($sock, 4); // Get OKE
    echo "recv: " . $data . "<br>";
    echo "recv: " . makeBuffer2($data) . "<br>";

    echo "-----------------------------<br>";

    $data = fgets($sock, 24); // Get init data
    echo "recv: " . $data . "<br>";
    echo "recv: " . makeBuffer2($data) . "<br>";
    
    fwrite($sock, makeBuffer("04 01 00 00 00 00 " . $key)); // Turn key on
    usleep(400);
    fwrite($sock, makeBuffer("04 00 00 00 00 00 " . $key)); // Turn key off

    fclose($sock);
}
?>

Thanks for the Java implementen @kuijp. Based on your code I just started a API wrapper for the Horizon box in Python: Einder.

I was wondering, how did you discovered the API of the Horizon box and found out the details?

No problem. I found sources of a very old Android app on the web somewhere. It was used to control one of the first versions of the samsung box when there wasn’t even an official app. I tried pushing some of the key_codes used by that app on the open port (5900) of the horizonbox and found some of them working and some of them had to be changed. In the end, got them to work.

I have been quite busy these last month’s. But I will try to get this binding finished and tested on openhab2.0 this month so it can be pushed to the main repo.