Hisense TV Control

here you have to add auth mac address from Remote Now app

1 Like

I’ve had it before, but it doesn’t work either

Edit: I have now put the Mac from the Remote Now app into the config again and the problem was that all the letters in the MAC address were capitalized.

1 Like

Hey folks. I have a U78G and I’ve gone through all the setup steps.

I’ve installed this via HACS:
GitHub - sehaas/ha_hisense_tv: Hisense TV integration for Home Assistant

I’m not getting this prompt. What value am I supposed to enter? Regardless of what I enter, the prompt keeps reappearing

Mosquitto log doesn’t show anything:

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] mosquitto.sh: executing…
[22:10:12] INFO: SSL is not enabled
[cont-init.d] mosquitto.sh: exited 0.
[cont-init.d] nginx.sh: executing…
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[22:10:12] INFO: Starting NGINX for authentication handling…
[22:10:12] INFO: Starting mosquitto MQTT broker…
[services.d] done.
1672197012: Loading config file /share/mosquitto/hisense.conf
1672197012: Warning: Bridge hisens_tv_emqtt using insecure mode.
1672197012: Warning: Mosquitto should not be run as root/administrator.
[22:10:13] INFO: Successfully send discovery information to Home Assistant.
[22:10:13] INFO: Successfully send service information to the Supervisor.

Ahh nm - I figured out that was for the PIN that pops up on the TV. Thanks for all the help folks!

what am i doing wrong?
i provided all the infos


when i click on submit, all i get is a spinning wheel
image

this is the TV i recently got Hisense - 65" Class U6GR

1 Like

********* Got the Bridge Working - See Edit 3 below ************

I’ve just bought a Hisense TV (50A7HQTUK 50 due Saturday). I want to integrate it to HA running native on a NUC with Mosquito broker.
Been looking through this very long thread and, being an old fart, can’t pick out the current position or best wat to approach it.
Can some kind soul please provide a summary of where we are now and what I need to do. Just a few pointers and links would be good.
Edit 1: I’ve got the TV now and have successfully connected MQTT Explorer to it using the client cert and client key files downloaded from GitHub - d3nd3/Hisense-mqtt-keyfiles: Some version of mqtt hisense require keys and used as per the readme file there.
Edit 2. Got Wake on LAN working with the following in my configuration.ymal file…

wake_on_lan:

switch:
  - platform: wake_on_lan
    name: lounge tv on
    host: 192.168.x.y
    mac: de:ad:be:ef:ff:00

Followed this video - https://www.youtube.com/watch?v=n5zWj7QurLI
Added switch.lounge_tv_on to an Entities card.
Found that the TV had to be off for about 4 minutes before it would work (RemoteNow works without this wait time)! And it doesn’t work at all if the TV has been powered off and on (neither does RemoteNow).

Also created a ping platform binary sensor but found it doesn’t work. The telly doesn’t even respond to the ping command in a cmd terminal window!
Edit 3. Success!!! I should add that I have no idea of what I’m doing or trying to achieve. I could not find a mosquitto.conf file anywhere and am guessing mosquitto has moved on since the posts above or the configuration I’m running on does things differently.
I followed the steps here…

That didn’t work, but the mosquitto log file at least showed that the hisense.conf was being loaded, albeit with errors.
I have zero understanding of credentials and keys etc but could see the 2 files to download from the web and the 1 file with 2 things in it created by interrogating the TV (All of this is covered in posts above).
I noticed in another post above that all 3 files were referenced in someones hisense.conf file so tried that and it worked.
My mosquitto config looks like…

logins:
  - username: redacted
    password: redacted
require_certificate: false
certfile: fullchain.pem
keyfile: privkey.pem
customize:
  active: true
  folder: mosquitto
anonymous: false
retain: true

I’m assuming the folder: mosqitto line refers to /share/mosquitto by default, which is where my hisense.conf file is stored which looks like…

connection hisensemqtt
address 192.168.x.y:36669
username hisenseservice
password multimqttservice
clientid DE:AD:BE:EF:99:99
bridge_cafile /ssl/hisense.crt
bridge_insecure true
bridge_tls_version tlsv1.2
try_private false
start_type automatic
topic +/remoteapp/# both
bridge_certfile /ssl/rcm_certchain_pem.cer
bridge_keyfile  /ssl/rcm_pem_privkey.pkcs8

After restarting mosquitto and checking the logs I could see the hisense stuff loading with no errors.
My next step was to add the 2 MQTT sensors as per the post instructions I was following, and they worked.
This was all done with the TV switched on.
That’s as far as I’ve got but now it’s working it’s down to me to start doing stuff with it. I tried sehaas thing, I think I got as far as trying to configure it but just got the non-stop spinning wheel. That was before I did the above so am not sure what I will achieve with it now and am too scared to give it another go in case I break it.

Hi All,
I found a way around the HACS plugin not connecting by handing the connection to the TVs MQTT broker from within Node-Red (as it allows an easy way to upload certificates via GUI and handles multiple brokers at once), nodered in this case is running from within HA on an old pi3.

MY TV is a 75U9HAU running Vidaa U6

some tricks:

The Tv seems to time out and disconnect if I don’t ping it for a while, so I have a “/remoteapp/tv/platform_service/3c:2a:d7:d5:30:64$vidaa_common/actions/gettvinfo” send every 10 seconds. (the MAC address in there is the one I used to authenticate the vidaa app on my phone initially, I copied it out of MQTT explorer when monitoring that communication).
It still disconnects occasionally, which I’m assuming is an issue with using wifi or perhaps the way i’m doing it is wrong, but i’m still working on that, perhaps I could just detect if the mqtt is disconnected then instead of turning on via mqtt, fire an ir on command via my video matrixes handy ir commands (i can send pronto codes to any source or display via a rest api) to wake it up instead.

I use the “/remoteapp/mobile/broadcast/ui_service/state” to find flags like “fake_sleep_0” and “fake_sleep_1” which are the tvs standby on/off modes when wake on lan/wlan is enabled and the tv is set to fast start up, it never fully turns off in this state unless it is doing the occasional reboot which it seems to do every few weeks on its own.

using the node-red-companion plugin via HACS I have a switch in my lovelace ui that not only sends the commands to the tv via virtual keypresses “/remoteapp/tv/remote_service/3c:2a:d7:d5:30:64$vidaa_common/actions/sendkey” with the payload of “KEY_POWER” for example but it also is constantly checking the tvs state so that the button in the ui accurately tracks the tvs state even if the remote is used, thus even though i don’t have separate power on and power off commands I can keep the state in sync.

It’s all a mess because I’m not good at homeassistant, nodered or MQTT but it’s working and has saved me a lot of trouble with IR control as well as the seemingly broken WOL/WOW on my tv that only works once in a blue moon. my controls required for the tv are very simple as everything else is handled from a HDMI matrix and a receiver, but if the Tv ever gets accidentally set to the wrong input, it now will be able to change back automatically when I select a source on my control panel.

Hi!
I’m having a lot of trouble getting my Hisense television to communicate with the homeassistant.

Could someone make a video of how to do this step by step?

Thanks

2 Likes

Hi Carlos,
Have you tested from within an app like MQTT Explorer?
I think the trick is having the certificate files (TLS), but not requiring certificate verification.

You also need to be able to connect via the VIDAA app or the RemoteNow app, to send commands you will need to use the mac address of that device (you can see mine copied into my commands above)

Some modern phones use randomised macs that cause issues with that so disable it, make the connection in the app, confirm it works, then copy that address down so you can re-enable random macs.

Hi! Thanks for your response!
Well… I use another app, the name is MQTTX. I get the certificate files (only 2) via terminal (SSH).
I cant make the connection! its very strange!
I cant understand how i put the tv connected with mqtt! :confused:
Ok, i understand, but if i used an “old” android phone and not open anymore the vidaa app, works forever?? Thanks a lot!

Have you disabled verification on those certificates? perhaps try MQTT Explorer, at least them I can give you screenshots of my setup.

The MQTT server in the TV only runs when the TV is awake, it seems to shut down after a while in standby. make sure it is on and you have an active connection on the phone app, then you should be able to view the communication in MQTT Explorer, copy some commands and test them from within your HA setup, in my case I used node-red running within HA to handle the sending of MQTT commands.

1 Like

I got MQTT Explorer connected to my new TV. See post 271 Edit 1 above. I’m trying now to send it a message but not finding any examples just yet!

if you send a command from the phone app, you can see the command and the valid MAC address in MQTT explorer, you can then copy those messages to try sending your own commands.

Thanks. I just needed that nudge. Got it responding to commands from MQTT Explorer now. :slight_smile:
My next step is to create the MQTT bridge. I’ve started from the top of this thread but can’t help thinking the guidance offered there is out of date. At the moment I’m trying to locate mosquitto.conf but cannot find it! I’m running on a NUC with Generic x86-64.

I didn’t try to get the Homeassistant side of things working, I’ve just manually done it within node-red and made switches within my HA dashboard to trigger those commands using the node-red-companion HACS module, since I only wanted on/off control.

It does look like it is possible to have the TV open a web page from an MQTT command though, that could be useful for cameras or a custom dashboard. now that I have it all working I will play with that.

I found the same thing, you cant predict when the internal broker or WOL will sleep and stop responding. so that is why I’ve stuck with using an IR command for power on.
We don’t have discrete power on and power off commands so the MQTT broker on the TV is used to detect the state so everything stays in sync, so if I turn the TV off with its remote the HA dashboard updates with the correct state.

Is this a Hisense TV with android, or without?
I have ping sensor working properly with my 2 Hisense U6G Android TVs

For android-tvs, you want to turn on developer mode and there is also another setting that needs to be on (i forget off of top of my head but it is in the network settings).

If android TV then the writeup I created at Hisense U6G (and possibly other) Android TV Control - #8 by JasonLee still does work.
I do need to make one revision though as HA made mqtt sensors separate from other sensors.

If the TV is an Android model then you can hit me up with any other questions (preferably in the Android TV specific thread I created).

Writer of the thread you found at Hisense U6G (and possibly other) Android TV Control - #8 by JasonLee

Did you get all the MQTT control working?

Yes, sort of. Using your (OPTIONAL) code, I’ve got a switch that turns the TV off with the KEY_POWER payload. It’s not working fully as it doesn’t seem to know the TV is turned on and I have to catch the time when it is showing as on to turn it off. And I have to wait around 4 minutes after turning the TV off before it will respond to the magic packet and turn on again. I guess that’s a TV issue though.
I’m going to try more over the next few days when I get time.
Thanks for your post explaining how you got it working.
Edit: Just added a few scripts (TV, HDMI2 and HOME). The KEY_Home worked as you gave it but the TV and HDMI2 sources had to be amended as per a few differences I spotted using MQTT Explorer and RemoteNow.

Cant remember now if HA changed anything in regards to the switch from the (OPTIONAL) section. Here is my current config with mac redacted to YOURMAC

switch:
  - platform: template
    switches:
      mbr_hisense_tv:
        icon_template: >
          {% if is_state('switch.mbr_hisense_tv','on') %}
            {{ 'mdi:television-classic' }}
          {% else %}
            {{ 'mdi:television-classic-off' }}
          {% endif %}
        friendly_name: 'MBR Hisense TV'
        turn_on:
          service: wake_on_lan.send_magic_packet
          data:
            mac: 'YOURMAC'
        turn_off:
          service: mqtt.publish
          data:
            topic: '/remoteapp/tv/remote_service/YOURMAC$normal/actions/sendkey'
            payload: 'KEY_POWER'

I also have a binary sensor to ping the TV (set to 30 second interval), then I have an automation that Trigger - ping sensor state switches to on, Condition - switch = off, Action - set switch to on. Then the reverse for off.

If ping is not working, I would first test to see if pinging from a PC works as intended. If not then the issue in the TV. As stated, there is some setting in android that has to be set to be on for ping to work reliably.

I cant remember what it was that I did, but I did mess up when I was initially configuring and caused an MQTT loop that was DoS’ing the TV