Krazy998 / mqtt-hisensetv

Details to connect to Hisense Smart TV MQTT broker for home automation
MIT License
120 stars 12 forks source link

A bit more info on using mosquitto from the command line #1

Closed niczoom closed 4 years ago

niczoom commented 5 years ago

Thanks for all this information. I ended up here as I was looking for discrete commands (IR) to turn my 75P7 on & off. Unlike my Samsung 65" UHD TV which has discrete IR codes for on & off this tv doesn't seem to. I've found a few resources which state discreet codes but they must of been for older models.

I've spent a bit of time now using mosquito MQTT from the command line and would like mention some findings I made, perhaps to update your readme file.

  1. Anywhere you have 'HomeAssistant', I've found this can be replaced with any word of your choosing, perhaps something to represent your use case.

  2. Subscribe to all topics

mosquitto_sub -v -h -p 36669 -P multimqttservice -u hisenseservice -t #

  1. Get the tv state (Publish)

mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -m 0 -t /remoteapp/tv/ui_service/AutoHTPC/actions/gettvstate.

It needs the -m message paramater filled otherwise you get an error "Error: Both topic and message must be supplied"

Subscribe to topic: mosquitto_sub.exe -h -p 36669 -t /remoteapp/mobile/broadcast/ui_service/state -P multimqttservice -u hisenseservice

  1. Change/Set the volume

Get current volume: mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/tv/platform_service/AutoHTPC/actions/getvolume -m ""

Change/Set Volume (-m = volume level 0-100) mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/tv/platform_service/AutoHTPC/actions/changevolume -m 50

Subscribe to topic: mosquitto_sub.exe -h -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/mobile/broadcast/ui_service/volume

  1. Change/View current source

Show current state: mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -m 0 -t /remoteapp/tv/ui_service/AutoHTPC/actions/gettvstate

Show all available sources: mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -m 0 -t /remoteapp/tv/ui_service/AutoHTPC/actions/sourcelist

Change source. The 'sourceid' is all thats required to change to a new source. For example to change to HDMI1: mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/tv/ui_service/AutoHTPC/actions/changesource -m {\"sourceid\":\"3\"}

The '\' are needed to escape the quotes when run from the command line.

You can use 'sourcename' as well but its not necessary. If you are then do not put a space in 'HDMI 1' eg: Use \"sourcename\":\"HDMI1\". I found using a space, which is what is shown when using 'sourcelist' above, gives an error.

  1. TV Power

mosquitto_pub.exe -h -p 36669 -P multimqttservice -u hisenseservice -t /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey -m KEY_POWER

  1. Other

Navigation: /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_UP /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_RIGHT /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_LEFT /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_DOWN /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_MENU /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_RETURNS (Back) /remoteapp/tv/remote_service/AutoHTPC/actions/sendkey KEY_EXIT

Krazy998 commented 4 years ago

Thanks alot! ill update the readme with the additional keys. Very much appreciated

Krazy998 commented 4 years ago

Updated Readme with your additions. Thank you @niczoom