Hisense TV Control

Unfortunately the ping does not work for me, so I created a binary sensor with nmap, unfortunately it also takes time to reflect.

  - platform: command_line
    command: 'nmap 192.168.x.x|grep wormux | wc -l'
    name: Lounge TV
    scan_interval: 12
    payload_on: 1
    payload_off: 0

I have also set it up as a universal media player so that Kodi merges in with it.
PNG

I don’t know if it is because of my amplifier which is ARC/CEC enabled with it, but I cannot control the volume through MQTT only by the infra-red remote.

Anyone know how to increase volume ?

tryed this, but didn’t work:

mosquitto_pub -u hisenseservice -P multimqttservice -h 192.168.50.25 -p 36669 -t /remoteapp/tv/remote_service/HomeAssistant/actions/sendkey -m "VOLUME_UP"

I found it. Maybe someone is looking for the same thing:

Mosquitto pub:
mosquitto_pub -u hisenseservice -P multimqttservice -h YOUR_TV_IP -p 36669 -t /remoteapp/tv/platform_service/homeAssistant/actions/changevolume -m "YOUR_VOLUME"

Hey, I just wanted to post an update here for anyone trying to make this work with one of the newer (H8 for me) displays - It looks like they’ve moved to an encrypted session. I’ll just paste in what I wrote on github:

Hi, I spent a lot of time trying to figure out how to get this working on my H8 display, and I wanted to share with anyone else who might be trying to make it work. It looks like they’ve moved to an encrypted MQTT session (still on port 36669). I’m using MQTT Explorer for testing, and the options for encryption=on and validate=off (they’re using a self-signed cert), with the same username and password as in the main doc, are working for me. (Sure wish I’d tried just playing with those switches before setting up an android emulator and wireshark…)

I’m still working on getting control functioning, but I can’t tell if that’s just inexperience or other changes to this display yet…

1 Like

I have been playing around with this lately and have managed to get my Hisence R6 controlled by MQTT Explorer. My topics look more like this:

/remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XX$normal/actions/changechannel

{“channel_param”: “1#ch39456902-c904-4939-a3af-2ed18c5b5478#sl35214240-16e7-4cc1-a66b-505956239f1e#4”}

Changing the XX to a device MAC that is paired via RemoteNOW app.
But so far I only have this working with MQTT Explorer. I have no idea how to configure this with user, pass, port and host (broker?) in HA. No way through developer tools to test?
I tried add this in config

mqtt:
broker: 192.168.1.17
port: 36669
username: hisenseservice
password: multimqttservice

But no luck. host instead of broker does not seem to work ether…

1 Like

Hi,

You need to configure your mosquito broker and setup a bridge (recommend do some research)

but this config should work for you (not in HA config but mosquitto config)

connection hisensemqtt
address 172.18.xxx.xxx:36669
username hisenseservice
password multimqttservice
cleansession true
clientid HomeAssistant
try_private false
start_type automatic
topic # both

I couldn’t get bridging working with the Mosquitto broker add-on for the life of me. I added the config to share but it just never seems to read it. I ended up bridging topics in nodered…
The only difference is with my config is the TVs address was at 192.168.xxx.xxx.
Not as clean though.
Ether way I got it going with the platform switch so far, its a shame there is no configurable TV entity type, for channels and sources ect. mediaplayer/universal just dont work well with a TV or IR set up.
This could be a big pain adding channels and other features to HA, then trying to tie them together…

I’m not getting far with media player universal (chromecast as child) . WOL and off command via mqtt is working with it, I’m sure volume + and - can be set. I haven’t looked into adding attributes, but maybe source and source_list can be used for channels, hdmi inputs and apps like netflix. But I also want to be able to remap media_previous_track and next to change to channel up and down.
looking at the source, it could be fixed on line 472 and 479 with “allow_override=True”.

I’m looking here right now as it seems to have a MQTT media player ability. I used to use this with my old IR TV and my own custom json file containing IR codes and sources, then adding it as a child to universal media player and it worked great.

edit:
I got smartIR combined with universal media player going. Source selector selects apps, channels and input sources via MQTT. On + off (WOL on and MQTT off) along with current state (energy monitoring plug) chnl up and down as next and previous (MQTT)
Volume is controlled by it own 0-100 topic with no +1 or -1 command. So this may require and automation that fetches current volume value , +1 or -1 , then return value.
Automation seems to be the next step to keep values in sync with people using the old ir remote and maybe EPG feedback.

Hi folks and thanks to @supagold, @zacnut and @K-1 for all getting me closer to controlling my 2019 Hisense TV (R7) through Home Assistant.
I’ve setup Wake On LAN in HA and can turn on the TV this way.
I also don’t get a response from pinging the IP.
I can control it via MQTT from MQTT Explorer with the connection settings including tls (required) as @supagold found, but not from the command line.
I also found like @zacnut did that my topic has to have what looks like a MAC address in it, not just “HomeAssistant” or any other label. I did not find that the MAC address (discovered via MQTT Explorer) matches my phone or anything on my network. E.g. to change volume:

/remoteapp/tv/platform_service/12:13:BA:DA:SS:00$normal/actions/changevolume 0

So, my next step is to access the TV MQTT via the command line (Raspberry Pi), but I keep getting:
Error: A TLS error occurred
Here’s what I’m trying:

mosquitto_sub -h 192.168.1.34 -u hisenseservice -P multimqttservice -p 36669 -t '#' --cafile /etc/ssl/certs/ca-certificates.crt

Since it works via MQTT Explorer, what am I missing?
The next step would be bridging, but I tried the configs above without success. If I can get command line working first, that should help.
Thanks!

Couldn’t get bridging working, will try again soon though. I never tried command line as I couldn’t get bridge to work using (May be because we using hassio with mosquito as an add-on from integrations). My solution was to use NodeRed, seems it could make a connection like MQTT explorer.
I used a node to listen to the just the TV broadcast topic to fetch info and feed it to home assistant MQTT server on same topic.
And another to listen to hassio command/set channel/ volume etc and feed to TV broker…
Messy, but works great.
Ether way, I got it working as a universal Media player with volume_set, volume_step, channels up and down as media previous and next, on /off, current state, current source and channels as sources.
I still didn’t need automatons but might if I want to add apps to source list, I don’t think I will bother though…

Did you try the --insecure option for mosquitto_sub? It appears to be the equivalent of “verify=off” in MQTT Explorer. Just a guess, since that particular option was a roadblock on my side for awhile.

I wonder if the MAC address thing is because a lot of phones do MAC Address randomization now? I actually missed the previous updates on this, so haven’t seen the progress you guys made until now. I got an H9F a few weeks ago (huge improvement over the H8), and am looking to try integrating again…

Thanks. I tried with and without --insecure and I get the same error (with debug message this time):

Client mosqsub|17581-id sending CONNECT
OpenSSL Error: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
Error: A TLS error occurred.

I also then tried making my own certificates, which I figured should not be necessary since I haven’t set certs in MQTT Explorer… same problems.

Can you please share your flows?

Sorry, I don’t currently have any flows setup that work. So far all my testing has been done in MQTT Explorer. (Haven’t had time to do anything else with this since my last post. Maybe in the new year.) There does seem to be some good progress on the topic, so maybe me or one of the other posters could help if you’re running into a specific problem?

Looks like I answered the wrong post. I wanted to reply to a @zacnut post

Hello, I have a H 55 B 7100 and I have a problem with mqtt.
When I try to connect with mqtt I get a message on the TV with a code for the connection. Does enybody knows where I can input the code?

Best regards
Schiene

Hi all,

Picked up one of the R6 models today, nice TV, but would be nicer with some HA integration! :wink:

Software Version of my TV is J1114.

Been playing around with a lot of the stuff you have all posted here, and here is where I am currently at:

-Unable to ping via command line

-Unable to use Mosquitto broker via hassio, with @K-1’s post above, in /share/mosquitto/hisense.conf, as it returns

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

I’ve attempted to add the TV as an MQTT Broker, and it seems to work! (Although it does ping every 2 minutes with a reconnect in the logs)

I just can’t figure out the sensor and I’ve tried too much tonight that I’m worn out for now. Hopefully someone can work out where I’ve gone wrong.

I’ve used the following in configuration.yaml:

    broker: 192.168.1.68
    port: 36669
    username: hisenseservice
    password: multimqttservice
    tls_insecure: true

and the following for the progname sensor I was testing with:

sensor:
    - platform: mqtt
      name: "TV State"
      state_topic: "/remoteapp/mobile/broadcast/ui_service/state"
      value_template: "{{value_json.progname}}"

For the sensor, I was using mqtt.sensor docs as documentation, which includes a link for the templating.

-Can confirm, thanks to @lindsayward and @zacnut above, I also need to use a MAC address in my topics. My Pixel 4 XL refuses to connect to the TV (going to contact Hisense about this soon), but my partners phone connected and I was able to then use her MAC Address. Spoofing even the TV itself’s MAC wouldn’t let the command register. Thought it had something to do with /remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XX$normal/actions/authenticationcode not existing for other MAC addresses, as {"authNum":"XXXX"} is the value there, and after pairing a phone i can spoof that MAC to control.

I was about to hit send on this post, but I’ve actually just found a way to spoof the MAC address completely.

It seems if you manually publish /remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XX$normal/actions/authenticationcode with the json {"authNum":"XXXX"} (yes, the X’s), it will return {"result":100,"info":"Wrong authNum!!"}. However, if you copy a pre-existing auth code from a device that’s already been configured and push it with the authNum JSON, it will work with the spoofed address.

Further thought on this gave me a brainwave on how to create a new code to show on your TV. If you publish /remoteapp/tv/ui_service/HomeAssistant/actions/gettvstate, your TV will return a code on-screen. You’ll need to be quick, but you can then use this auth code in a json (replace the ones with the code showing on your TV) {"authNum":"1111"} and publish (with the X’s!), /remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XX$normal/actions/authenticationcode. After you’ve done this, you can then use the X MAC address + $normal to replace the HomeAssistant text and then use any command listed in the initial git.

This means that something like /remoteapp/tv/ui_service/HomeAssistant/actions/gettvstate can be used with /remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XX$normal/actions/gettvstate and so on, so forth. Unfortunately sending a KEY_POWER command will not allow you to power on the TV via the same command, but these commands DO seem to persist after the TV powers off and back on (even via power on the remote)

I hope this helps, and I’m sorry if it doesn’t make sense. I’ve spent a good ~10 hours today trying to figure some of this stuff out. If anyone could help me integrate this with my HA, it seems we’re all very close to having it work again! Happy to make heads or tails of anything if you need clarification.

@Schiene, my last rambling there should help you with the code input!

2 Likes

Hi all,

I noticed some people having issues with Wake on Wireless/LAN. I just encountered the same problem after my Hisense 75P7 upgraded to J1008 firmware.

I went snooping around and noticed the tv was doing a full boot after power off. It seems fastboot is turned off on some firmwares.

You can enable it by going into the hisense service menu

Please follow instructions below:

  1. Press the COG WHEEL

  2. Press OK on SETTINGS

  3. Press OK on SOUND

  4. Press OK on SPEAKERS

  5. Highlight BALANCE ensuring it’s set to 0

  6. Press 1-9-6-9 on your remote

  7. The letter M will appear on the top left corner

  8. Press the QUICK SETUP or COG WHEEL button

Change Fastboot option from OFF to ON

Power off TV and try now.

2 Likes

Do you mean you can’t turn on fastboot as a normal setting without this process?
How did you find this out?

@lindsayward That’s correct you need to enable fastboot via the service menu. The reason i started snooping around is I realised I was not able to Wake on WLAN my tv post upgrade and noticed its actually dropping off my unifi network when TV is off and I knew for 100% that prior to that it used to stay connected to wifi even when TV was off.

The instructions are from hisense support who sent this to me when I needed to factory reset my tv. I remembered there was a fastboot option in there and tried it out.

Cheers

2 Likes