Hisense TV Control

Hi all,

Anyone played around with controlling the Hisense TV via it’s built in MQTT broker? It seems you can completely control the tv.

I found you can connect to the MQTT service with the following:

Host: IP Address of your TV
Port: 36669
Username: hisenseservice
Password: multimqttservice

I’ve documented up some of the topics as well on github.

https://github.com/Krazy998/mqtt-hisensetv/blob/master/README.md

Anyone got any examples on how best to control TV’s (particularly with MQTT) via home assistant?

Thanks

6 Likes

More particularly what would be the best way to control the TV in Hass?

I am able to get most of the state of the tv by setting up a sensor on the /remoteapp/mobile/broadcast/ui_service/state topic and parsing the json.

{"statetype":"livetv","list_param":"1#0","channel_num":"22","eventid":"","progname":"Bananas In Pyjamas","starttime":1549661988,"endtime":1549662423,"detail":"Rita and Crocodile are making an allotment in Granny's garden. They plant carrots, cucumber and peas. But here comes a bird. They need one more thing. A scarecrow! Nobody can be scarier than Crocodile, right?","channel_param":"1#5767297#0#0","channel_name":"ABCComedy/Kids","sourceid":"0"}

However im not really sure how to control state of the TV and how to do the turn on the TV via WOL but send KEY_POWER to

/remoteapp/tv/remote_service/EFD97888EA564C9AA6174950C3A985B2/actions/sendkey

I managed to get it work by just using a switch template and multiple switches (to turn on and off) and using ping to determine if the device is on or off but I would say it’s quite poor method to do it.

I’ve updated the github to better document the mqtt topics which should help someone build a better integration which allows you to change channels, sources and launch apps.

Happy to share my config to date if it helps anyone else.

Great thread mate! I was only looking for a solution for a hisense TV last week but couldn’t find anything. I bought the TV anyway and it arrives Tuesday, fingers crossed it works.

I’ve got the H50A6200UK model

Hey Rich

Thanks for responding. Let me know how you go. Curious to see how you get it automated. I have just setup a simple basic on and off for controlling the tv.

I also added EPG (if on live tv) or the source (hdmi etc) it’s set to (just a sensor with Json attributes)

Cheers

what are you using to set this up? Can you share more info?

Host: IP Address of your TV
Port: 36669
Username: hisenseservice
Password: multimqttservice

Is that a switch? Im running hassbian cheers mate

Just got the tv out

ignore me - thats another mqtt broker… just testing it now matey

It would be good to see your switches aswell to turn it on/off and report state if possible?

Sure no problem here is my switch config:

Switches template which has on and off + using a binary sensor which is just ping.

  - platform: wake_on_lan
    name: "theatre_tv_on"
    mac_address: "40-cd-XX-XX-XX-XX"
  - platform: mqtt
    name: "theatre_tv_off"
    state_topic: "/remoteapp/mobile/broadcast/ui_service/state"
    command_topic: "/remoteapp/tv/remote_service/HomeAssistant/actions/sendkey"
    payload_on: "KEY_POWER"
    optimistic: false
    qos: 0
    retain: false
  - platform: template
    switches:
      theatretv:
        value_template: "{{ is_state('binary_sensor.theatre_tv', 'on') }}"
        turn_on:
          service: switch.turn_on
          data:
            entity_id:  switch.theatre_tv_on
        turn_off:
          service: switch.turn_on
          data:
            entity_id:  switch.theatre_tv_off

Sensors:

sensor:
  - platform: mqtt
    name: "theatre_tv_state"
    state_topic: "/remoteapp/mobile/broadcast/ui_service/state"
    value_template: "{% if states.theatre_tv_state.attributes.statetype == none %}off{% else %}{{ states.sensor.theatre_tv_state.attributes.statetype }}{% endif %}"
    json_attributes: 
    - statetype
    - list_param
    - channel_num
    - channel_name
    - progname
    - starttime
    - endtime
    - displayname

binary sensor:

  - platform: ping
    host: xxx.xxx.xxx.xxx
    name: Theatre TV
    count: 2
    scan_interval: 2

I personally dont think its an ideal config. Yes it works fine but i think its quite crude. Curious to see what others come up with.

4 Likes

I didn’t know that my TV ( H55U7A) knows what MQTT is. Great Work :clap:

great work on this @K-1
I’ve just brought a hisense especially to play around with this.

Seems if you can control the whole TV via MQTT this could be an easy component to create
Excited to see where we can take this :slight_smile:

Hey @K-1
Are you going to look at creating a component for this? if not i was going to give it a go, seems it could be easy enough to implement

Hey @Joeboyc2

Its out of my skillset, but you are certainly most welcome to write one - that would be fantastic. Let me know if you need any help testing.

Great stuff, i’ll give it a look over, not something i have done before, but more then willing to give it a try.

i’ll keep you all updated with my progress

The connection to the Hisense MQTT is possible for the Hisense H50U7A as well.

I am also able to send commands to the TV and control it. My problem is, when the television is shut down, after a certain time the MQTT connection is lost. Wake on LAN can turn it on again, but MQTT needs a while to connect back to the TV. I already reduced the keepalive time to 15 seconds - no effect. Is there a way to manually start the MQTT reconnection immediately after I turned on the Hisense with wake on Lan?

Thanks

Have you got it setup your Mqtt to bridge with the tv mqtt? That’s how I have it setup so Hass always has connectivity to local Mqtt and the bridge reconnects pretty fast. Google setting up a Mqtt bridge.

Thanks for your advice!

I followed this instructions. But the Mosquitto log shows all the time “Connecting bridge Hisense (192.168.178.54:36669)” and does not establish any connection. My bridge settings are:

connection Hisense
address 192.168.178.54:36669
remote_username hisenseservice
remote_password multimqttservice
clientid HomeAssistant
start_type automatic
topic # both

What am I doing wrong?

Thanks!

Hello,

Here is my 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

Were you able to resolve this issue? have the same exact error.

No change with K-1’s settings.

I have Hisense H8 series TV. Is there a way to find if it supports MQTT or not?

have you tried connecting with a mqtt client directly to the hisense tv and make sure it works? That will confirm if its working basically first. If that works then we can just focus on sorting out the mqtt bridge issues. If it doesnt maybe hisense changed the password on different models (we can try sniff these out)

I tried connecting with MQTT explorer. It tries to connect, but then throws the similar error message “disconnected from server”.

Any pointers on how to sniff username/password?