Hisense U6G (and possibly other) Android TV Control

There is probably variation from Hisense model to model. I’m guessing the U6G and U8G are fairly similar, at least more so than any of the other Hisense models. I’ve noticed with the U8G, when I press the power button and it goes into standby, that it’s still eating up 10W/hr. It seems to be pretty active when ‘off’

While off, I’m still able to send mqtt remote actions, including KEY_POWER to turn the screen back on. This seems to be different from what I’ve seen a lot of others post with Hisense TVs.

I’m also still able to send “get_menu_info” action while the TV is in standby. Maybe this is because the TV comes with both the RemoteNowServer.apk and RemoteNow.apk installed. And it’s running it’s own remoteapp instance that can still be used to send commands?

I’ve been wondering about the 10W power consumption, and if this is normal. I have almost everything turned off on the TV (google assistant, mic) and use it as a dumb TV with a connected streaming device.

I will try to use the picturesettings info as my on/off sensor, I just don’t know how to pull the info out of the topic in HA and use that in a template. I’m new to making sensors and switches with MQTT.

You will need to add the sensor into configuration.yaml for that topic as I showed with input/volume.
Once you restart HA, and power on/off the TV, show me what that sensor shows in states (under developer tools). Might be able to just do an automation trigger off that, but will likely need an input_helper that uses a value_template off of the sensor

You must be right about variations between models, the U6G does not send KEY_POWER when off.
The nic is not 100% off because it gets some of the (i think it was called) SYS topics, but nothing to/from remoteapp/ topics after it is off. Hence for the U6G you have to use WOL to turn on.

Are you using wifi or wired for connection? The 10w is a little higher then I would have imagined but not that surprising since smart TVs are a computer with a UHF/VHF tuner, even with assistant and other things off). To keep wifi radio on, IR on, and OS in a lower power state likely takes some juice (i also think some USB ports are wired to always provide power).

Alright, I figured out what’s going on. If you toggle USB debugging on (developer options), the TV will never go into full sleep. It will stay in a more active mode (don’t know the name for this) keeping system processes alive, including the MQTT server. This is why I could still send MQTT commands to power the TV on and check the screen status topics. The downside to this is that even when off, the TV is still consuming 10W/hr.

Toggling USB debugging off, the TV goes into full sleep using 0.3-0.5W/hr.

So I guess I’m back to trying to make WOL work across VLANs and relying on pings for on/off status.

EDIT: When the TV is off, just having a device plugged into the eARC port causes the TV to go from 0.3W to 40-50W for ~30s every minute. I also noticed that with the TV in full sleep I can no longer keep my streaming device playing audio. The U8Gs native audio only mode with screen off uses 33W/hr. Long story short, I prefer the way the TV behaves with USB debugging on, even if it’s always consuming 10W.

That makes sense on both the MQTT topics and the power aspect.

Does it still only consume the 10w in debugging mode even with device plugged into eARC port?

Leaving it on debug mode would certainly remove the WOL over VLAN headache.
Was going to say may just be easier to put another HA instance (or at least some other device on the other VLAN that you could send a command over TCP to) that could then be coded to send your WOL

EDIT: going through the settings under USB debugging, I think the change is specifically due to USB configuration. Turning on USB debugging defaults USB into MTP configuration. having that on stops the TV from going to full sleep. Changing the USB configuration to charging lets the TV fully sleep while also keeping USB debugging enabled. This may be useful for anyone that wants to use ADB.

10W seems to be the minimum power consumption of the OS when it’s active (65U8G), but screen is completely off. USB debugging just appears to keep the system from going to sleep. HDMI inputs have a small impact, as well as WiFi. With no WiFi or ethernet, and no HDMI inputs, the TV is at ~9.8W/hr. Using WiFi and one HDMI input for my FireTV, I’m at about 10.7W. In this TV state I don’t see the power cycle between 0 and 50W every minute when using the eARC port, I’m not sure what that is about.

So getting back to pulling the TV on/off status. With your volumechange topic, it seems much more straight forward. For picture settings there is 50menus of data returned, and I only want to pull the menu_flag status (-1 = on, 1 = off) of menu_id 11 (Aspect Ratio). How do I only grab that bit for HA.

This is an example of the picturesettings topic:

{"action":"notify_value_changed","menu_info":[{"menu_flag":0,"menu_id":1,"menu_name":"Dynamic Backlight control","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":2,"menu_name":"Backlight Level","menu_value":35,"menu_value_type":"int"},{"menu_flag":1,"menu_id":3,"menu_name":"Mode","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":4,"menu_name":"Pciture Mode","menu_value":3,"menu_value_type":"int"},{"menu_flag":1,"menu_id":5,"menu_name":"Game","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":6,"menu_name":"Contrast","menu_value":20,"menu_value_type":"int"},{"menu_flag":1,"menu_id":7,"menu_name":"Brightness","menu_value":50,"menu_value_type":"int"},{"menu_flag":1,"menu_id":8,"menu_name":"color","menu_value":55,"menu_value_type":"int"},{"menu_flag":1,"menu_id":9,"menu_name":"Tint","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":10,"menu_name":"Sharpness","menu_value":10,"menu_value_type":"int"},{"menu_flag":-1,"menu_id":11,"menu_name":"AspectRatio","menu_value":3,"menu_value_type":"int"},{"menu_flag":1,"menu_id":12,"menu_name":"Direct","menu_value":0,"menu_value_type":"int"},{"menu_flag":-1,"menu_id":13,"menu_name":"Dot-By-Dot","menu_value":0,"menu_value_type":"int"},{"menu_flag":-1,"menu_id":14,"menu_name":"Panoramic","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":15,"menu_name":"Cinema","menu_value":0,"menu_value_type":"int"},{"menu_flag":-1,"menu_id":16,"menu_name":"Overscan","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":17,"menu_name":"ColorTemperature","menu_value":1,"menu_value_type":"int"},{"menu_flag":191,"menu_id":18,"menu_name":"Motion Enhancement","menu_value":2,"menu_value_type":"int"},{"menu_flag":1,"menu_id":19,"menu_name":"Judder Reduction","menu_value":5,"menu_value_type":"int"},{"menu_flag":1,"menu_id":20,"menu_name":"Blur Reduction","menu_value":5,"menu_value_type":"int"},{"menu_flag":1,"menu_id":21,"menu_name":"Noise Reduction","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":22,"menu_name":"Digital Noise Reduction","menu_value":0,"menu_value_type":"int"},{"menu_flag":-1,"menu_id":23,"menu_name":"Hdmi Dynamic Range","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":24,"menu_name":"Active Contrast","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":25,"menu_name":"color space","menu_value":1,"menu_value_type":"int"},{"menu_flag":1,"menu_id":26,"menu_name":"color(colorTuneColor)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":27,"menu_name":"Hue(colorTuneHue)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":28,"menu_name":"Saturation(ColorTunerSaturation)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":29,"menu_name":"Brightness(ColorTunerBrightness)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":30,"menu_name":"Reset(ResetColorTuner)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":31,"menu_name":"R-offset","menu_value":-1,"menu_value_type":"int"},{"menu_flag":1,"menu_id":32,"menu_name":"G-offset","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":33,"menu_name":"B-offset","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":34,"menu_name":"R-Gain","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":35,"menu_name":"G-Gain","menu_value":-6,"menu_value_type":"int"},{"menu_flag":1,"menu_id":36,"menu_name":"B-Gain","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":37,"menu_name":"Reset(2 point)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":38,"menu_name":"20 point","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":39,"menu_name":"level","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":40,"menu_name":"Red","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":41,"menu_name":"Green","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":42,"menu_name":"Blue","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":43,"menu_name":"Reset(2o point)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":44,"menu_name":"Gamma","menu_value":1,"menu_value_type":"int"},{"menu_flag":1,"menu_id":45,"menu_name":"Input level","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":46,"menu_name":"Gain","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":47,"menu_name":" Restore Gamma Calibration","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":48,"menu_name":"RGB only","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":49,"menu_name":"Apply Picture Settings","menu_value":1,"menu_value_type":"int"},{"menu_flag":1,"menu_id":50,"menu_name":"Reset(ResetPictureSettings)","menu_value":0,"menu_value_type":"int"},{"menu_flag":1,"menu_id":51,"menu_name":"Local Dimming","menu_value":3,"menu_value_type":"int"}],"pic_setting_version":"U4"}

Wow that is a mess, all the templating I have done it is nested with different labels for each layer.

Try adding this to your sensor:

value_template: "{{ value_json.menu_info[10].menu_name }}"

The filter is saying to get the menu_name from line 10 (starting at 0) from the output of menu_info.

If it works, it should output “AspectRatio”. If that works then change menu_name to menu_flag. Then do an automation for when sensor changes from 1 to -1, and another for when it goes from -1 to 1

1 Like
value_template: "{{ value_json.menu_info[10].menu_name }}"

This works perfectly to return Aspect Ratio. But there is a problem with menu_flag

value_template: "{{ value_json.menu_info[10].menu_flag }}"

Nothing is returned. I think this may be because the topic does not include quotes around the menu_flag value. Its just 1 and -1, rather than “1” and “-1”. Is it possible to pull in a value not in quotes?

I checked on my U6G and even with USB debugging on I dont get that specific MQTT message so I can not test it directly.

However, using Template in develop tools I took your JSON data and tried the value template and it worked fine there

Check for typo error, here is what I used:

value_template: "{{ value_json.menu_info[10].menu_flag }}"

EDITED:
Otherwise my next suggestion is to layer 2 sensors. Have the first sensor get your menu_id line using this:

value_template: "{{ value_json.menu_info[10] }}"

then the second senor get the specific data out of it. This also allows you to show on or off:

Sensor:
  - platform: template
    sensors:
      2ND_SENSOR_NAME:
      value template: >-
        {% if is_state('1ST_SENSOR_NAME.menu_flag', '1') %} ON
        {% else %} OFF
        {% endif %} 

You could make automations with change from on to off (and another of off to on) as trigger, and then have it change your switch state appropriately.

1 Like

EDIT: I accidentally overwrote my previous post. I figured out that the problem was that there was other json being published to the topic other than the full menu array. That published data doesn’t include “menu_info”, so the filter was not able to return the AspectRatio menu_flag state.

I changed the sensor to a binary sensor and used this if/else statement. This will ignore any JSON that doesn’t return either a 1 or -1

binary_sensor:
  - platform: mqtt
    name: "TV - Power"
    state_topic: "/remoteapp/mobile/broadcast/platform_service/data/picturesetting"
    value_template: >-
      {% if value_json.menu_info[10].menu_flag == -1 %}
        {{'ON'}}
      {% elif value_json.menu_info[10].menu_flag == 1 %}
        {{'OFF'}}
      {% endif %}

Thank you for that example in the developers tools menu. I was wondering how to debut the json filter, this helped a lot.

Ok good, that was going to be my suggestion to use elseif instead of just if/else.

Yea, that JSON output is completely void of structure. Usually they are nested with unique identifiers so it is WAY easier to pick out the data you need. The menu_info[10] is the “cheat” way to get the data, but it 100% assumes the data structure is the same every single time.
So be willing to bet at some point an update in the TV is going to change the JSON layout of that topic.

the TV has been out 8 months, and there was only one update 6 months ago. I don’t think I’m in danger of too many future updates lol

Is there a way to set retain true just for the Hisense MQTT server, without setting retain true for everything going through my mosquitto broker?

I use my mosquitto broker for a number of other integrations, and prefer retain: false, but since the Hisense MQTT server doesn’t publish frequently, I prefer retain true just for Hisense.

For Publishing:
Do a script with action mqtt.publish, there you can check box retain and also flip the switch. The have HA call the script for any actions you want to do.

DO NOT do this for all topics, especially for the topic for sending button commands like volume, power etc. Otherwise you will get repeating commands and a TV that will turn itself right back off.

For listening:
If you need to retain a variable sent from the tv, then you need to do what I did with volume and input. Create sensor that is listening to topic, create an input helper and then have a automation update the input helper when the value of the sensor changes.

1 Like

I have a working TV power sensor now that requests the TV power state upon HA startup.

Sensor for TV power state

binary sensor
  - platform: mqtt
    name: "Hisense TV Power"
    device_class: power
    state_topic: "/remoteapp/mobile/broadcast/platform_service/data/picturesetting"
    value_template: >-
      {% if  value_json.menu_flag == -1 and value_json.menu_id == 11 %}
        {{'ON'}} 
      {% elif value_json.menu_flag == 1 and value_json.menu_id == 11 %}
        {{'OFF'}}
      {% elif value_json.menu_info[10].menu_flag == -1 %}
        {{'ON'}}
      {% elif value_json.menu_info[10].menu_flag == 1 %}
        {{'OFF'}}
      {% endif %}

TV power switch

switch:
  - platform: template
    switches:
      hisense_tv:
        icon_template: >
          {% if is_state('switch.hisense_tv','on') %}
            {{ 'mdi:television-classic' }}
          {% else %}
            {{ 'mdi:television-classic-off' }}
          {% endif %}
        friendly_name: 'Hisense TV'
        value_template: "{{ is_state('binary_sensor.hisense_tv_power', 'on') }}"
        turn_on:
          service: mqtt.publish
          data:
            topic: '/remoteapp/tv/remote_service/MY_PHONE_MAC$normal/actions/sendkey'
            payload: 'KEY_POWER'
        turn_off:
          service: mqtt.publish
          data:
            topic: '/remoteapp/tv/remote_service/MY_PHONE_MAC$normal/actions/sendkey'
            payload: 'KEY_POWER'

Request TV power state on HA startup automation

alias: Get Hisense TV power state on HA startup
trigger:
  - platform: homeassistant
    event: start
action:
  - service: mqtt.publish
    data:
      topic: '/remoteapp/tv/platform_service/MY_PHONE_MAC$normal/actions/picturesetting'
      payload: ' {"action":"set_value","menu_id":11,"menu_value":3,"menu_value_type":"int"}'
mode: single

This seems work well, and it’s fast since there is no polling/pinging. One little kink is that when the TV switches between HDR and SDR the power state momentarily registers as off, due to the AspectRatio menu_flag flipping to 1 during that 0.5-1s transition time between SDR-HDR.

You could have an automation trigger from the binary sensor going off. Have it reset a helper variable, pool a topic on tv to see if it gets a response (and then changes that variable’s value. If not changed then change your switch to off (and remove your if for if binary sensor off).

Can someone help, this doesn’t work at all for me with a 55U6G. I can’t get the remote now app to even see the TV, when I use openssl (installed on windows) I just get an error message, I’m just trying to get a simple mosquitto command to change power state working from windows, but it just refuses any commands.

On your TV, in the menu under Device Control, make sure IP Control Port is turned on.

Do you have your TV connected to your home network (and phone/device using remotenow on the same wifi network)?

What troubleshooting steps have you taken? have you verified you can ping the IP of the TV?

I am not sure if windows openssl will work.
Are you running HA OS on a pi, or as a docker on debian or how are running home assistant? should be able to run that openssl command from the terminal (from the OS, not from inside Home Assistant).

I apologize if this isn’t the proper place to ask, but it appears to be the biggest group of Hisense users on the forum, and I’m wondering if this integration can help in any way.

I can’t get my u6G’s to display cover art in any media player card. Has anyone been able to get this to work or is it a limitation of these TV’s? It appears they are trying to display but on certain media cards (mushroom) it give a broken image icon. My understanding is that at least some apps (disney+, Hulu, Netflix) should be able to supply screen scrapes of what is being shown. I can get cover art from other sources (i.e. my Echo’s when playing music).

The integration instructions I provided in here does not correlate to a Media Player in HA.

I would first try setting up a generic Android TV integration and then see if its Media Player card works for you (fyi things like the power button wont work without custom configuration).

If that does not work then you will need to setup MQTT explorer and see if there is even info/thumbnail output in the MQTT
If there is MQTT data for it: then you can subscribe to the proper topics in the HA config file, then use the universal media player card to create your own. I have never used the universal media player so I have no experience on setting it up.

On an unrelated note, what kind of car is your Turbo4Door? I have a Stinger GT.

1 Like

Thanks for the reply. All the other controls work as expected, so that’s why I’m a little thrown off as to why this particular aspect doesn’t work. Unrelated, it was a Subaru WRX. Unfortunately it’s now gone to someone else after many years and mods with me :slight_smile: