Support for a Toshiba Smart TV

I noticed that a few other TV’s that use the Smart Alliance TV SDK are supported, and was hoping it might be easy to add a Toshiba smart tv as well. When I search UPNP devices on my Android’s test app, it shows the TV on there. It allows already for it to be turned on, off, volume changed, and content changed as well because it is shown as a ‘UpNp renderer’.

Think this could be easy since other smart tv brands exist?

Anyone have any luck controlling their Toshiba yet?

Bit of an old thread I know but looking to do something similar. Have figured out that the TV has a rest APi aviable at you-tvs-ip:56789/apps/SmartCenter but as I know next to nothing when it comes to coding I’ll be of little help.
Have seen a few places around the web that you can send commands such as
curl “http://xxx.xxx.xxx.xxx:56789/apps/SmartCenter
-X POST
-d “<?xml version=\"1.0\" ?><key code=“1013”/>”
which should mute the TV but I get nothing but at least it’s somewhere to start after months of trying to find a solutions (even looked into flashing android TV frimware on the TV but didn’t get very far with that)
I managed to find most of this from this thread here:
Toshiba/Medion/Telefunken TV Control Script Ver 0.1 - Domoticz
If anyone has any luck would be really interested in how they did it

With a bit more investigation found that the TV uses the DIAL Protocol.
more info here

and

Thought I’d do a bit more exploration today. Please bare in mind that I am still learning but have managed to mute and unmute the TV by sending the command bellow:

curl "http://aaa.bbb.ccc.ddd:56789/apps/SmartCenter" -X POST -d "<remote><key code=1013/></remote>"

a step in the right direction i suppose. How I would go about getting this into a plugin or integration I have no clue

A few more bits I’ve figured out from the script in the link above and some trial and error

Function Code
0 1000
1 1001
2 1002
3 1003
4 1004
5 1005
6 1006
7 1007
8 1008
9 1009
back 1010
ratio 1011
on 1012
mute 1013
presets 1014
lang 1015
Vol up 1016
Vol Down 1017
info 1018
down 1019
up 1020
left 1021
right 1022
Stop 1024
Play 1025
rewind 1027
Forward 1028
??? 1029
??? 1030
sub 1031
prog up 1032
Prog Down 1033
Swap 1034
Audio (stero Dual mono) 1035
??? 1036
close 1037
??? 1038
??? 1039
fav 1040
??? 1041
timer 1042
quick 1043
??? 1044
Channel 1045
web 1046
epg 1047
menu 1048
pause 1049
yellow 1050
rec 1051
blue 1052
ok 1053
green 1054
red 1055
input 1056
media 1057
USB 1059
teletext 1060
??? 1061
YouTube 1062
FreeView Play 1063
Netflix 1064
internet 1065
??? 1066
system menu 1067
4 Likes

This is great work buddy!

Is there anything to return the state of the TV? Im about to take a look into this further…

To call this in AA though you need to add it as a shell command, then you can call it from an HA script:

shell_command:
  annexe_tv: curl "http://192.168.0.21:56789/apps/SmartCenter" -X POST -d "<remote><key code=1012/></remote>"

Then all you need to do in HA is create a script and select the name you used above.

Returning the state would be epic…

1 Like

I downloaded the apk file of the Toshiba TV Smart Center app and then used a java decompiler to be able to sift through the files to try to figure some things out. I found the full list of built in codes:

        map.put(RemoteCommand.BUTTON_HOME, "1046");
        map.put(RemoteCommand.BUTTON_POWER, "1012");
        map.put(RemoteCommand.BUTTON_POWER_NAV, "1012");
        map.put(RemoteCommand.BUTTON_POWER_PLAYER, "1012");
        map.put(RemoteCommand.BUTTON_POWER_PVM, "1012");
        map.put(RemoteCommand.BUTTON_POWER_GES_NAV, "1012");
        map.put(RemoteCommand.BUTTON_POWER_GES_PLAYER, "1012");
        map.put(RemoteCommand.BUTTON_POWER_GES_PVM, "1012");
        map.put(RemoteCommand.BUTTON_RECORD, "1051");
        map.put(RemoteCommand.BUTTON_PLAY, "1025");
        map.put(RemoteCommand.BUTTON_PAUSE, "1049");
        map.put(RemoteCommand.BUTTON_STOP, "1024");
        map.put(RemoteCommand.BUTTON_PREVIOUS, "1034");
        map.put(RemoteCommand.BUTTON_REWIND, "1027");
        map.put(RemoteCommand.BUTTON_FORWARD, "1028");
        map.put(RemoteCommand.BUTTON_NEXT, "1255");
        map.put(RemoteCommand.BUTTON_SCREEN, "1011");
        map.put(RemoteCommand.BUTTON_LANG, "1015");
        map.put(RemoteCommand.BUTTON_SUBTITLE, "1031");
        map.put(RemoteCommand.BUTTON_PRESETS, "1014");
        map.put(RemoteCommand.BUTTON_EPG, "1047");
        map.put(RemoteCommand.BUTTON_TEXT, "1255");
        map.put(RemoteCommand.BUTTON_FAV, "1040");
        map.put(RemoteCommand.BUTTON_3D, "1040");
        map.put(RemoteCommand.BUTTON_SLEEP, "1042");
        map.put(RemoteCommand.BUTTON_0, "1000");
        map.put(RemoteCommand.BUTTON_1, "1001");
        map.put(RemoteCommand.BUTTON_2, "1002");
        map.put(RemoteCommand.BUTTON_3, "1003");
        map.put(RemoteCommand.BUTTON_4, "1004");
        map.put(RemoteCommand.BUTTON_5, "1005");
        map.put(RemoteCommand.BUTTON_6, "1006");
        map.put(RemoteCommand.BUTTON_7, "1007");
        map.put(RemoteCommand.BUTTON_8, "1008");
        map.put(RemoteCommand.BUTTON_9, "1009");
        map.put("48", "48");
        map.put("49", "49");
        map.put("50", "50");
        map.put("51", "51");
        map.put("52", "52");
        map.put("53", "53");
        map.put("54", "54");
        map.put("55", "55");
        map.put("56", "56");
        map.put("57", "57");
        map.put(RemoteCommand.BUTTON_MENU, "1048");
        map.put(RemoteCommand.BUTTON_MUTE, "1013");
        map.put(RemoteCommand.BUTTON_UP, "1020");
        map.put(RemoteCommand.BUTTON_LEFT, "1021");
        map.put(RemoteCommand.BUTTON_OK, "1053");
        map.put(RemoteCommand.BUTTON_RIGHT, "1022");
        map.put(RemoteCommand.BUTTON_DOWN, "1019");
        map.put(RemoteCommand.BUTTON_VOL_UP, "1016");
        map.put(RemoteCommand.BUTTON_VOL_DOWN, "1017");
        map.put(RemoteCommand.BUTTON_VOL_UP_2, "1016");
        map.put(RemoteCommand.BUTTON_VOL_DOWN_2, "1017");
        map.put(RemoteCommand.BUTTON_PROG_UP, "1032");
        map.put(RemoteCommand.BUTTON_PROG_DOWN, "1033");
        map.put(RemoteCommand.BUTTON_BACK, "1010");
        map.put(RemoteCommand.BUTTON_EXIT, "1037");
        map.put(RemoteCommand.BUTTON_RED, "1055");
        map.put(RemoteCommand.BUTTON_GREEN, "1054");
        map.put(RemoteCommand.BUTTON_YELLOW, "1050");
        map.put(RemoteCommand.BUTTON_BLUE, "1052");
        map.put(RemoteCommand.BUTTON_INFO, "1018");
        map.put(RemoteCommand.BUTTON_MMEDIA, "1057");
        map.put(RemoteCommand.BUTTON_SOURCE, "1056");
        map.put(RemoteCommand.BUTTON_SWAP, "1034");
        map.put(RemoteCommand.BUTTON_CHAN, "1045");
        map.put("BUTTON_TV", "1030");
        map.put("BUTTON_MY_BUTTON", "1062");
        map.put("BUTTON_MY_BUTTON_2", "1063");
        map.put(RemoteCommand.BUTTON_QMENU, "1043");
        map.put(RemoteCommand.KEYBOARD_BACKSPACE, "8");
        map.put("KEYBOARD_NEW_LINE", "10");

I’m too lazy to sort through that to make that look nicer, but I think it should be helpful. I started on this quest because I would like to launch Plex with a curl command, but am not having any luck. I would also like to have feedback if possible so if anyone else has any further insight, I would truly appreciate it.

I went through and cleaned up my last comment and combined it with the previous collection of codes. It didn’t really provide much extra information, but hey, maybe it will help someone. There were several codes that were in the app that don’t appear to do anything that I’ve listed at the bottom.

Key Code
0 1000
1 1001
2 1002
3 1003
4 1004
5 1005
6 1006
7 1007
8 1008
9 1009
back 1010
ratio 1011
on 1012
mute 1013
presets 1014
lang 1015
Vol up 1016
Vol Down 1017
info 1018
down 1019
up 1020
left 1021
right 1022
- 1023
Stop 1024
Play 1025
- 1026
rewind 1027
Forward 1028
- 1029
- 1030
sub 1031
prog up 1032
Prog Down 1033
Swap/Previous 1034
Audio (stero Dual mono) 1035
- 1036
close 1037
- 1038
- 1039
fav/3D 1040
- 1041
timer 1042
quick menu 1043
- 1044
Channel 1045
web/home 1046
epg 1047
menu 1048
pause 1049
yellow 1050
rec 1051
blue 1052
ok 1053
green 1054
red 1055
input 1056
media 1057
- 1058
USB 1059
teletext 1060
- 1061
YouTube/My Button 1 1062
FreeView Play/ My Button 2 1063
Netflix 1064
internet 1065
??? 1066
system menu 1067
- 1068
- 1069
- 1070
remote pop up 1071
remote pop up 1072
Rakuten TV 1073

map.put(RemoteCommand.KEYBOARD_BACKSPACE, “8”);
map.put(“KEYBOARD_NEW_LINE”, “10”);
map.put(“48”, “48”);
map.put(“49”, “49”);
map.put(“50”, “50”);
map.put(“51”, “51”);
map.put(“52”, “52”);
map.put(“53”, “53”);
map.put(“54”, “54”);
map.put(“55”, “55”);
map.put(“56”, “56”);
map.put(“57”, “57”);
map.put(“BUTTON_TV”, “1030”);
map.put(RemoteCommand.BUTTON_NEXT, “1255”);
map.put(RemoteCommand.BUTTON_TEXT, “1255”);

Still not much luck on the feed back from the TV to Home Assistant front though. Lots of 403 forbidden errors so if anyone has any thoughts on how you can use the pairing process with the Toshiba TV Smart Center app to get credentials or how to find these credentials, I think that’s where I’m stuck.

If you use this command (replace the IP with your tv’s IP):

curl "http://192.168.1.10:56789/apps/SmartCenter"

You’ll get an output that looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<service xmlns="urn:dial-multiscreen-org:schemas:dial"
    dialVer="2.2">
  <name>SmartCenter</name>
  <options allowStop="false"/>
  <state>running</state>
  <link rel="run" href="run"/>
  <additionalData>

  </additionalData>
</service>

Which you can parse in Home Assistant. “Running” means that the tv is on. If the TV is off, this command will fail and you get no feedback. So maybe turn the tv on with an IR blaster command and then verify that it turned on using this information. Alternatively, you can parse it with this command:

curl -s "http://192.168.1.10:56789/apps/SmartCenter" | grep -oPm1 "(?<=<state>)[^<]+"

This should simply output ‘running’ if the tv is on. I also go tired of copying, pasting, and changing the code to change the different keys so I used this code where you can enter a number to change the code to that number, n to increment the code by one, or q to quit the command (again, change the IP to your TVs IP):

TV_IP="192.168.1.10"
ENDPOINT="http://$TV_IP:56789/apps/SmartCenter"

# Starting key code
CODE=1000

echo "Interactive key code tester for SmartCenter"
echo "-------------------------------------------"
echo "Press Enter to repeat the current code."
echo "Press n + Enter to go to the next code."
echo "Type a number + Enter to change the next code."
echo "Press q + Enter to quit."

while true; do
    read -p "Press a key or enter a number: " INPUT

    if [[ "$INPUT" == "q" ]]; then
        echo "Exiting..."
        break
    elif [[ "$INPUT" == "n" ]]; then
        CODE=$((CODE + 1))
        echo "Moving to next code: $CODE..."
    elif [[ "$INPUT" =~ ^[0-9]+$ ]]; then
        CODE=$INPUT
        echo "Changing code to: $CODE..."
    else
        echo "Repeating code $CODE..."
    fi

    curl -s -X POST "$ENDPOINT" -d "<remote><key code=$CODE/></remote>"
done

On my tv in the built in manual I did find that my tv uses the HbbTV ver 2.0.2. standard. There’s probably some useful tidbits in their information, but it’s a 300+ page document of pretty dense info so I don’t know that I’ll get anything out of it.

Hopefully this will help someone and maybe one day we’ll figure out the full functionality that we’re going for.