Hisense TV Control

All the MQTT actions I can find in MQTT Explorer are limited to what you can do through RemoteNow. The app has a picture settings section, letting me see what action is required to change the settings there. But I’d like to be able to access other menu areas too like sound settings, which is not available in RemoteNow. I’m finding that running a sequence of MQTT actions with remote commands is very unreliable. ADB sequences work much more consistent.

Is the Hisense MQTT broker really limited to what is present in the RemoteNow app or are there other unused actions? Has anyone been able to extract the MQTT broker package to take an internal look? I have the ROM for one of the 2021 Hisense TV models, but I’m unable to extract the files from within the PKG file. I’m not sure if it’s encrypted and that’s why?

EDIT: I’m guessing the MQTT server is RemoteNowServer (com.hisense.tv.hisremotenowserver). Force stopping it breaks the MQTT connection, and closes port 36669

/system/app/RemoteNowServer/RemoteNowServer.apk (if anyone wants the apk to try to deconstruct it, PM me)

mosquitto.conf

Hey folks,

I have full root access to my hisense tv. Here is the remoteapp/remoteapp_tv_api.js

1 Like

EDIT: It looks like

Topic: /remoteapp/tv/remote_service/MY_PHONE_MAC$normal/actions/sendkey
action: KEY_POWER

works to both turn off and on the TV

####################

My TV is on a different VLAN/subnet than my HA server. Is there another way to power on the TV other than WOL which would require some elaborate router rules? I can power the TV on via ADB, but I’m hoping to get things fully running with MQTT so that I can remove the ADB add-on.

Hello there.
Unfortunately, I’m not a pro when it comes to Home Assistant. However, I want to add my Hisense TV in Home Assistant, but I can’t get along with the instructions.
I downloaded the Add.On with HACS.
I got my certificate from the TV with OpenSSL and copied it in the SSL folder.
I added the hisense.conf file in the created Mosquitto folder and set the customize folder to true in the mqtt app.
What else do I have to change in the MQTT add on? When I want to install the Hisense TV addon, only the loading icon rotates.

Thanks for your help.

Since the device is effectively in sleep mode, its difficult to do anything but WOL Or you could use a IR blaster device to send the power on button? I think Xiaomi/aqara made one.

I decided to keep the Mqtt server running even when the TV is off.

I am using the developer options menu to set USB configuration to MTP on my TV (U8G). This prevents the TV from going into full sleep, and keeps the MQTT server running when the TV screen is off. The TV obviously uses more power compared to full standby. For the U8G, the OS is using 10W/hr while the TV screen is off. This is still better than the 33W/hr when using the TV in audio only mode.

I have a FireTV Cube, and this TV configuration will let me continue to play TV/movie audio while the TV screen is off. I can also stream audio through Alexa and keep the TV screen off.

Because the MQTT server on the TV continues to run, I can get the ON/OFF state, control the ON/OFF state of the TV all through MQTT, without having to do any pinging

I posted my power sensor and TV switch here:

1 Like

Thats awesome - thanks for sharing!

This is fantastic, thanks!

After a bit of fiddling around with mosquitto it works fine on U7QFT.

:slight_smile:

Same here. Hope you figure it out.

Hey there,

first, I wanna say thanks to this awesome Thread which might get My Tv in to Home Assistant. I’m using the Hisense 55U8QF Modell. I’m reading through this hole Thread and there are so many different ways to implement that my mind ist stuggling now.

Does anyone else have the same TV as I have. And can give me some advises?

Most of the problems comes from stetting ab the MQTT Bridge, if I’m change the mosquitto Addon config
activity: from false to true
my hole broker doesnt work anymore an my devices become unavailable.

is there a List maybe wich modell requieres which settings an config?

i Hope u have some advices for me.

Thanks

I’ve managed to get MQTT explorer work with my Hisense TV, with the certificates from GitHub - d3nd3/Hisense-mqtt-keyfiles: Some version of mqtt hisense require keys

It seems i have almost the same behaviour as @NeeeeB so I’ve tride his route und genereted an cert file via the Linux Terminal from the tutorial GitHub - tiagofreire-pt/Home_Assistant_Hisense_TV: Integration of smart TVs from Hisense on Home Assistant Core.

But there are some Problems i cant solve,

  1. If I change my mosquitto Add-on configuration from this
customize:
  active: false
  folder: mosquitto

to this

customize:
  active: true
  folder: mosquitto

the Addon does start but gives me some errors

here is my log:

Error: Unable to open include_dir '/share/mosquitto'.
Error found at line /etc/mosquitto/mosquitto.conf:33. 
[09:12:35] INFO: Successfully send discovery information to Home Assistant.
[09:12:35] INFO: Successfully send service information to the Supervisor.

do i have to change the Path of the mosquitto.conf because mine is located in /usr/share/hassio/share/mosquitto/…

Hi guys

This is my first post, thanks to everyone who helps the community.

I’m able to connect to the TV using MQTT explorer with key_files certs from GIT d3nd3/Hisense-mqtt-keyfiles. I have managed to configure as per GIT sehaas/ha_hisense_tv. The MQTT broker bridge works as I have tested it with MQTT explorer. I have also tested newAM/hisensetv (I had to fix the SSL as per newAM/hisensetv/issues/14 comments) and managed to authorize and can control the TV

But When I try the first setup and the TV is turned on. The integration ask a PIN code from the TV. The TV shows the PIN, however the integration doesn’t provide a way to input the pin. would it need to be put into a config file? or I need RemoteNOW app (I don’t have android phone)

Logs:

022-05-01 18:08:53 DEBUG (MainThread) [custom_components.hisense_tv.config_flow] async_step_user INFO None
2022-05-01 18:10:43 DEBUG (MainThread) [custom_components.hisense_tv.config_flow] async_step_user NOT task_mqtt
2022-05-01 18:10:43 DEBUG (MainThread) [custom_components.hisense_tv.config_flow] _async_pin_needed

Yeah change the path or put the file(s) in /share/mosquitto

Thanks, I’ve changed the path but it gives me the same errors

I can’t help you more unfortunately, looks like we’re not on the same hardware, maybe @sehaas can guide you ?

I hope this helps, as you mentioned your path is located in /usr/share/hassio/share/mosquitto/… I am guessing you are using Docker.
Maybe the post Hisense TV Control - #202 by Fabz helps as it discuss “where do I put the hisense.conf file or define the path to it?”

kinda. im Running Home Assistant on an Unraid Server via VM. But im getting on step closer.
All my config files and Certificates must be located in

/share/mosquitto/

instead of

/usr/share/hassio/share/mosquitto/

or

/usr/share/mosquitto/

which was really confusing

but now I’m getting a LOG in Mosquitto wich give me some Error

LOG FILE MOSQUITTO:

05:14:10] INFO: Starting mosquitto MQTT broker...
1651634050: Loading config file /share/mosquitto/acl.conf
1651634050: Loading config file /share/mosquitto/hisense.conf
1651634050: Warning: Bridge hisensetv using insecure mode.
1651634050: Warning: Mosquitto should not be run as root/administrator.
[05:14:10] INFO: Successfully send discovery information to Home Assistant.
[05:14:10] INFO: Successfully send service information to the Supervisor.
1651634050: mosquitto version 2.0.11 starting
1651634050: Config loaded from /etc/mosquitto/mosquitto.conf.
1651634050: Loading plugin: /usr/share/mosquitto/go-auth.so
1651634050:  ├── Username/password checking enabled.
1651634050:  ├── TLS-PSK checking enabled.
1651634050:  └── Extended authentication not enabled.
1651634050: Opening ipv4 listen socket on port 1883.
1651634050: Opening ipv6 listen socket on port 1883.
1651634050: Opening websockets listen socket on port 1884.
1651634050: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651634050: mosquitto version 2.0.11 running
1651634050: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)
1651634050: Error: Unable to load CA certificates, check bridge_cafile "hisense.crt".
1651634050: OpenSSL Error[0]: error:02001002:system library:fopen:No such file or directory
1651634050: OpenSSL Error[1]: error:2006D080:BIO routines:BIO_new_file:no such file
1651634050: OpenSSL Error[2]: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
1651634050: Bad socket read/write on client local.HomeAssistant: The client is not currently connected.
.
.
.
1651634055: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651634055: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)
1651634055: Error: Unable to load CA certificates, check bridge_cafile "hisense.crt".
1651634055: OpenSSL Error[0]: error:02001002:system library:fopen:No such file or directory
1651634055: OpenSSL Error[1]: error:2006D080:BIO routines:BIO_new_file:no such file
1651634055: OpenSSL Error[2]: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
1651634055: Bad socket read/write on client local.HomeAssistant: The client is not currently connected.

Ive got new log issue after moving my certificate an to /ssl/…instead of /share/ssl.

1651656079: Client local.HomeAssistant disconnected: Protocol error.
1651656089: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651656089: New connection from 172.30.32.2:54482 on port 1883.
1651656089: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)
1651656089: Client <unknown> closed its connection.
1651656092: Client local.HomeAssistant disconnected: Protocol error.
1651656113: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651656113: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)
1651656116: Client local.HomeAssistant disconnected: Protocol error.
1651656147: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651656147: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)

Why does it connect twice?
What does Client local.HomeAssistant disconnected mean?

This Mornin I’ve some additional Steps to get this running.

I’ve tried to dissable both cert files an see waht happens

#bridge_certfile /ssl/rcm_certchain_pem.cer
#bridge_keyfile /ssl/rcm_pem_privkey.pkcs8

1651806272: OpenSSL Error[0]: error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure
1651806272: Client local.HomeAssistant disconnected: Protocol error.
1651806303: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651806303: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)

Which doesn’t help a lot

then I enableed both dert files back again and disabled
#bridge_tls_version tlsv1.2

1651806624: Error: Unable to load client key file, check bridge_keyfile "/ssl/rcm_pem_privkey.pkcs8".
1651806624: OpenSSL Error[0]: error:0909006C:PEM routines:get_name:no start line
1651806624: OpenSSL Error[1]: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib
1651806624: Bad socket read/write on client local.HomeAssistant: The client is not currently connected.
1651806655: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651806655: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)

doesn’t help, errors still exist

Now, i deleted both of my cert files an reuploaded both cert files from GitHub - d3nd3/Hisense-mqtt-keyfiles: Some version of mqtt hisense require keys

[05:35:28] INFO: Starting NGINX for authentication handling...
[05:35:28] INFO: Starting mosquitto MQTT broker...
1651808128: Loading config file /share/mosquitto/acl.conf
1651808128: Loading config file /share/mosquitto/hisense.conf
1651808128: Warning: Bridge hisensetv using insecure mode.
1651808128: Warning: Mosquitto should not be run as root/administrator.
[05:35:29] INFO: Successfully send discovery information to Home Assistant.
[05:35:29] INFO: Successfully send service information to the Supervisor.

Now there are no Errors in the Log file, which is a good sign i think.

its still the same as long the TV is on, I also can see the published commands in MQTT Explorer.
As soon I turn off the TV it gives me the Errors that I’m talking erlier about

1651656089: Client <unknown> closed its connection.
1651656092: Client local.HomeAssistant disconnected: Protocol error.
1651656113: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651656113: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)
1651656116: Client local.HomeAssistant disconnected: Protocol error.
1651656147: Connecting bridge (step 1) hisensetv (192.168.192.76:36669)
1651656147: Connecting bridge (step 2) hisensetv (192.168.192.76:36669)

So that the bridge is up and running with no Errors, How to get it to Home Assistant?
I’ve treid to install the integration “Hisense MQTT Bridge” from @sehaas, put in the MAC address of the TV, but nothing happens, the wheel ist spinning arround endless.

What to do now?

Hey @NeeeeB how long does it take until it starts working? To see the TV in HA.
I Have pretty much the same behaviour as your setup
TV: 55U8qf and HyperHDR so i need it to to get the HDR flag.

Hi @epictechlab,
That shouldn’t take more than a minute.

Did you have a look at all the closed issues from Sehaas github ?
Especially that one :

Might help you (browser problem)

Let me sumup how I made it work on my setup :
first I did put the .conf file in here

now this is what the .conf file looks like
image

You can see you need 3 files, that I put in ssl folder (but I think you can put them anywhere as long as the paths are correct in the .conf file)
hisense.crt is the one you have to generate yourself with the instructions from this repo :

the 2 other files can be found here :

and now this is how my MQTT broker is configured :

When all this is done, just install Sehaas integration from HACS, run it, fill the TV MAC address and you should be good to go.
Try with Chrome, not Firefox.

I wish this will help you solve your problem.

PS: the “folder” filled in the mosquitto configuration must be the folder where hisense.conf file is.