Hisense TV Control

Hey all,
I have currently have this working in HassOS, I am mostly through migrating to Docker container in bridge mode and trying to get this back to working again.

I have MQTT broker and HA talking to each other successfully. I currently have MQTT configured by the UI. I am stuck in getting HA/MQTT to talk to the TV.

Using MQTT explorer I can successfully connect to each HA and the TV on their own.

I am fairly certain its to do with where I am putting the hisense.conf and hisense.crt as I can’t actually work out where they are supposed to go. Currently, I have them in folders the same level as my HA /config folder replicating the way it is in HassOS being /share/mosquitto and /ssl. I am assuming either there are specific paths already where these should go or I need to define them somewhere, but I am not exactly sure where.

After arranging my thoughts while writing this I think the question to my problem is, where do I put the hisense.conf file or define the path to it? (As it will then point to the hisense.crt file)

Anyone got this to successfully work with HA in a Docker container, and MQTT in its own contianer?

This is my HA docker config:

homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ./data/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    networks:
      - proxy
    ports:
      - 8123:8123
      - 1400:1400
      - 51827:51827
      - 5353:5353
      - 21063:21063
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
      - /dev/ttyUSB1:/dev/ttyUSB1
      - /dev/ttyACM0:/dev/ttyACM0
    expose:
      - 8123
      - 1400
    environment:
      - TZ=Australia/Sydney

This is my mosquitto docker config:

mqtt:
    container_name: mosquitto
    image: eclipse-mosquitto:latest
    ports:
      - 1883:1883
      - 9001:9001
    network_mode: host
            # - proxy
    restart: unless-stopped
    environment:
      - PUID=1000
    volumes:
      - ./data/mosquitto/config:/mosquitto/config
      - ./data/mosquitto/log:/mosquitto/log
      - ./data/mosquitto/data:/mosquitto/data

This is my mosquitto.conf:

persistence true
persistence_location /mosquitto/data/

user mosquitto

# Listen on all interfaces
listener 1883 192.168.10.60

#Allow connection without authentication
allow_anonymous true

socket_domain ipv4

log_dest file /mosquitto/log/mosquitto.log
log_dest stdout

password_file /mosquitto/config/pwfile

This is my hisense.conf:

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

You need to take that repository URL.

  • Go into HACS > Integrations.

  • 3 Dots top right.

  • Custom repositories.

  • Add the repository URL there.

NVM Worked it out.

But for those who may find this useful, I needed to define an “include_dir” parameter in mosquitto.conf to tell it where to look for the hisense.conf file.

Then updated the hisense.conf file to point to the hisense.crt file. I moved both files into paths under the /mosquitto/config directory.

New mosquitto.conf:

persistence true
persistence_location /mosquitto/data/

user mosquitto

# Listen on all interfaces
listener 1883 192.168.10.60

#Allow connection without authentication
allow_anonymous true

socket_domain ipv4

include_dir /mosquitto/config/devices/

log_dest file /mosquitto/log/mosquitto.log
log_dest stdout

password_file /mosquitto/config/pwfile

New hisense.conf:

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

I’m trying to get this setup working with my new Hisense TV but I’m stuck on the RemoteNow part, as this app just will not find my TV on my network. Is this a known issue? Is there any way to use a different device’s MAC address in the part where you are supposed to put in your phone’s MAC after connecting with RemoteNow?

Hello,

Need help !
I cannot connect my TV to HA.

I can access the TV MQTT with the data:

address 192.168.1.xx:36669
username hisenseservice
password multimqttservice

First problem:
Either my TV doesn’t have certificates, or I’m doing something wrong:

Integration always looks like this:

Sem Título (1)

Thanks

1 Like

I am a total noob and found this thread while looking for a way to turn my tv on and off with my pc. Is that possible?
Thanks

Hey all, I figured out how to get this working on a U6G Android TV.

Most of it is the same as ReDaLeR’s post, however the connection settings needed a slight modification, and several of the MQTT command payloads are now different.

Here is a link to my thread: Hisense U6G (and possibly other) Android TV Control

Hi all, I’m trying to get this working on a H78G, which is the Canadian version of H8G I believe. But I cannot for the life of me get RemoteNow to detect it, so I’m stuck at the first step. Is there an alternative to RemoteNow or some other method that can be used?

Thank you.

I’m having a strange issue. This was working fine however I’ve now lost the ability to control the TV. All the state information gets pulled through, if I change the volume with the remote etc it updates in home assistant however I can’t control anything/turn off the TV from hass. Anyone any ideas? I’ve tried readding the tv but the same result.

Didn’t notice your post when I made mine, but I somehow got it to work! Turning on content sharing didn’t help. Neither did messing with android TV Remote Service. I read somewhere people having problems after updating their TV so I tried a factory reset and now it works!

@sehaas
Is there any way to get the signal info with that integration ?
If not, would it be possible to add a binary sensor to the integration where it would return True or False regarding if the TV is displaying HDR or not ?
I’d like to know when the TV is displaying HDR in order to enable the tone mapping on my HyperHDR ambilight installation.

Many thanks.

@NeeeeB I haven’t found such information yet.
/remoteapp/mobile/broadcast/ui_service/state gives you something like this:

{
  "statetype": "livetv",
  "list_param": "sl5824ec82-db05-4acf-85d1-404b560ac198",
  "channel_num": "1",
  "eventid": "",
  "progname": "FIS Skispringen Weltcup Bischofshofen HS 142",
  "starttime": 1641740100,
  "endtime": 1641747600,
  "detail": "live aus Bischofshofen\n\nKommentar: Michael Roscher\nCo-Kommentar: Andreas Goldberger und Martin Koch\nModeration: Boris Kastner-Jirka",
  "channel_param": "8#ch1e71308f-8015-4217-bee3-92f9bbe4746e#sl5824ec82-db05-4acf-85d1-404b560ac198#4",
  "channel_name": "ORF1 HD",
  "sourceid": "TV",
}

But I don’t know any HDR channel nor do I have any HDR content to try with.

Thanks for your answer.
I’ve checked with MQTT Explorer while I was running HDR content on my LibreElec device, plugged in HDMI 1, looks like we don’t have that info available…
This is what state returns :

{
  "statetype": "sourceswitch",
  "sourceid": "HDMI1",
  "sourcename": "HDMI1",
  "is_signal": 0,
  "is_lock": 0,
  "hotel_mode": 0,
  "displayname": "HDMI1"
}

Found /remoteapp/mobile/broadcast/platform_service/data/picturesetting
Looks related and it gets trigged really often with different values.

{
	"action":	"notify_value_changed",
	"menu_id":	7,
	"menu_value_type":	"int",
	"menu_value":	0
}

If we have mapping for menu_id and menu_value we may get the desired information.

/edit: found the SES UHD Demo Channel, it broadcasts in UHD with HDR. With that I have HDR options under Settings -> Picture -> Picture Mode

Good News Everyone.
The picturesetting delivers plenty of values including flags for UHD, HDR, Brightness,…

My current implementation adds a single sensor with all key/value pairs as additional attributes. I’m not sure if this is the best way to handle this information. Maybe every key should be a separate sensor, but I don’t know how to handle a set of dynamic sensors yet.
Does someone know how to implement such a SensorEntity?

1 Like

Oh that is a really great news !!
I wish I could help you with this…
EDIT:
@sehaas Damn…I had remove the integration, just reinstalled with with HACS, I can see the folder in custom_components, but I can not find it in HA Integrations…there is only one Hisense integration showing up when I type “Hisense”, and it is not yours…
I’ve already restarted HA 3 or 4 times with no luck…
Any idea ?

EDIT2:
nvm, did clear the cache and it finally showed up :wink:

EDIT3:
Would you mind sharing your card’s YAML ?
the one showed in the post above with all picture infos ?
thx

EDIT4 (sorry lol):
I’ve managed to create a binary sensor based on the VideoHdrType attribute.
Now I can finally enable tone mapping in HyperHDR automatically based on what the TV HDR mode is !!
Many thanks for this, you made my day @sehaas !!

Any idea if it is possible to detect the picture mode, and change the picture mode via MQTT?

No need to define a separate binary sensor. You can read a specific attribute of the sensor. It works for Lovelace and in automations.

type: entity
entity: sensor.hisense_tv
attribute: HdrFlag
name: HDR

As far as I dug into it, it should be possible. Some settings will be published automatically (if you switch the channels, edit settings,…). For others you have to query for them (by publishing a request).
You could take a look at the topics I use in the sensor. I have only used them to read the values, but writing/setting should work the same way.

1 Like

Thank you, I was able to find the action.

Topic: /remoteapp/tv/platform_service/MY_PHONE_MAC$normal/actions/picturesetting
Action: {"action":"set_value","menu_id":4,"menu_value":1,"menu_value_type":"int"}

menu_id: 4 is the ‘picture mode menu’
menu_value: 0-10 are the different picture modes

There is a hidden picture mode 8. Everything is really dark, and black&white. It also looks like you can create more picture modes with custom settings if you’d like by just picking higher menu_values.

I think using this action template, I should be able to select any menu item in all the settings menus