Hisense TV Control

I am glad I found this thread! The app does not work on my phone and I thought I hit a dead end for controlling my TV via MQTT. Thank you for all the information you shared @rya!

I started writing a python API for this: https://github.com/newAM/hisensetv

The basics are in, though it is very hack-and-slash right now. There will be bugs until I can get around to writing unit tests.

./hisensetv.py --help                 
usage: hisensetv.py [-h] [--authorize] [--get {sources,volume}] [--key {back,down,exit,left,menu,power,right,up}] [-v] hostname

Hisense TV control.

positional arguments:
  hostname              Hostname or IP for the TV.

optional arguments:
  -h, --help            show this help message and exit
  --authorize           Authorize this API to access the TV.
  --get {sources,volume}
                        Gets a value from the TV.
  --key {back,down,exit,left,menu,power,right,up}
                        Sends a keypress to the TV.
  -v, --verbose         Logging verbosity.

One time setup:

./hisensetv.py 10.0.0.128 --authorize   
Please enter the 4-digit code: 7815

Then there is a little CLI interface to try it out:

./hisensetv.py 10.0.0.28 --key up    
INFO:__main__:sending keypress: up
./hisensetv.py 10.0.0.28 --get volume 
INFO:__main__:volume: {
    "volume_type": 0,
    "volume_value": 0
}

@CaptainMalu I have not been able to get SSL to work, are you able to go more into depth about your example above? What text exactly should I copy from that command into hisense.crt?

4 Likes

A certificate starts with “—BEGIN CERTIFICATE—” and ends with “—END CERTIFICATE—”.
You have to copy all certificates.

Unfortunately no dice with getting Mosquitto to listen to a conf as you exampled in the past. Below is my code in /share/mosquitto/hisense.conf

connection hisensemqtt
address 192.168.xx.xx:36669
username hisenseservice
password multimqttservice
cleansession false
clientid hisenseservice
try_private false
start_type automatic
bridge_capath /ssl/hisense.crt
tls_version tlsv1.2
bridge_insecure false
topic # both

Can someone help

@govabm - It’s a bit hard to know what you’re asking. Perhaps you can clarify.
There’s lots here about trying to get TV control working. We haven’t really solved it.
If your problem is just that you want to get control working, then I think you’re in the same situation as most of us. If it’s something more specific, then let us know exactly what you’re after.

Hi,

First of all, I want to thank you for the work.

I am not a Hass user, but I am a Jeedom user and I bought a Hisense TV and I want to connect it to my home automation.

Can I follow your work and try to implement it on a plugin for jeedom?

My tv is a Hisense 55U8B, and for the moment only the ‘volume’ function is not responding.

Thank you.
Regards

you can definitely try it

Same with me, everything works but the volume.
I have an ARC - CEC receiver plugged into my TV, I wonder if this has anything to do with it?

Thanks. :slight_smile:

@Patrick123
Hi Patrick.

I don’t have anything to just plug in the TV

I’m still trying to get a bridge to work too.
I can connect no problem with MQTT explorer and NodeRED. I don’t understand why a bridge wont work.
I’m positive my cert is okay, but I’m not sure that it is the problem. Why can everything else connect without a cert, but not the bridge?..

1579873392: Connecting bridge hisensemqtt (192.168.1.17:36669)
1579873392: Socket error on client local.HomeAssistant, disconnecting.

This is all I get in logs. if I add a cert, authentication fails.

I currently have NodeRED listening for topics identical to the TVs topics coming from HA broker, then it spits out the same payload to the same topic back to the Hisense broker…
Then another node listening for the broadcast topics from the Hisense broker which feeds it back to HA. It’s stupid, I want to get rid of this, but it works.

EDIT:

I got it working as a bridge! no more bridging brokers with nodeRED!
I carefully read the mosquitto documentation:

One of bridge_cafile or bridge_capath must be provided to allow SSL/TLS support.

So I guess cert is needed to actually use SSL/TLS.

connection hisensemqtt
address 192.168.1.17:36669
username hisenseservice
password multimqttservice
clientid HomeAssistant
bridge_cafile /ssl/hisense.crt
bridge_insecure true
bridge_tls_version tlsv1.2
try_private false
start_type automatic
topic +/remoteapp/# both

So I’ve got this working the best I can I feel…
Source selects channel. I haven’t integrated actual sources like HDMI yet seem CEC switches automatically and that works for me.
Even google integration works to set volume with voice. “set TV to 18” :grin:
TV2

2 Likes

What do you mean when you say volume is not working?
For volume stepping I’m using topic

/remoteapp/tv/remote_service/XX:XX:XX:XX:XX:XX$normal/actions/sendkey

Value:

KEY_VOLUMEDOWN

Even though its not a command the app can do, this just worked…
And volume set I’m using:

/remoteapp/tv/platform_service//XX:XX:XX:XX:XX:XX$normal/actions/changevolume

Value:

6.0

If you connect to the TV with MQTT explorer, then use the app to change volume, what values and topic do you see?

Can you connect to the TV with MQTT explorer?
And your TV works with the RemoteNOW app?

FYI, this app is broken on android 10 as far as I can tell…

Yes, I am able to do everything but the volume. Even the Remote Now app does not change the volume. I tested your suggestions with my MAC address with no happiness.
The TV Remote changes the volume and then the TV sends this MQTT message:

/remoteapp/mobile/broadcast/platform_service/actions/volumechange

{"volume_type":0, "volume_value":11}

As I live in South Africa, I am assuming that it is the SA firmware that is installed.

Can you select this icon


Then adjust this volume slider

Whilst monitoring MQTT Explorer?

Does this do anything? Very odd if it doesn’t… Have you tried using built in speaks?
What model TV do you have? If we cant get the app to work, you may have to contact Hisence…

I’ve started on EPG, might add show times and next shows as attributes when I get a chance, this took a lot of time (and sensors) to do.
Every 10 minutes it polls the TV with an automation if the TV is on.
I may be able to get EPG info online so the TV doesn’t have to be on, but i wouldn’t know where to start looking for a free online EPG service that i can pull into HA…

Hi all,
I have been trying to make the script work for some time but since my last impossible attempt … I end up with this error:

Do you know if there is a way to reset the ‘authorize’?

I also can’t do it with MQTT Explorer, it certainly has the same problem.

I am currently testing in a debian VM.

Thank you for your feedback and sharing.

Regards.

EDIT: Ok, I just deleted the caches and restart the TV and I was able to try my tests and my connection with MQTT Explorer is OK.

Thank you @Alex-M-GitHub, @K-1 and all of you in HA community who shared priceless info, with your python file I was able to connect to my Hisense TV 8UB with a custom client id since I was able to register to mqqt but the client id was unknown, I only could send commands using my cellphone MAC address. :smiley:

my 55R6 received the K0109 update, delayed it and have called Hisense to see if it removes MQTT functionality. Dude on the phone had no idea what MQTT even was.

Has anyone here taken the plunge and updated? I believe it’s groundwork for the Google Assistant integration lined up for release on the 21st of Feb.

It would be awesome if you could share what you’ve done with the EPG!

Good work with the bridge config! Unfortunately I’m still receiving

1582166090: Connecting bridge hisensemqtt (192.168.1.68:36669)
1582166093: Socket error on client local.hisenseservice, disconnecting.

However the TV isn’t on at the moment. Will have to test when home! Thanks again!

You can get Australian EPG data from here…

http://www.xmltv.net/