homebridge-mqttthing icon indicating copy to clipboard operation
homebridge-mqttthing copied to clipboard

Hisense TV authentication code

Open sebasjunca opened this issue 5 years ago • 14 comments

Hi, I've been trying to use the mqttthing plugin to make the Hisense TV available in Homekit. The issue is that some models (including mine) requires an authentication or certificates in order to make it work through MQTT commands (Communication between broker and service client are encrypted). Is there any way to make the authentication process through the pluggin or other way to have this working.

Thanks in advance!

sebasjunca avatar Jun 01 '20 12:06 sebasjunca

Hi

I don't have any answers for you regarding authentication but I don't think that my TV requires authentication and was wondering if you would send me the JSON or the config that you've set up for your TV so that I could try to get mine working?

magichew avatar Jun 08 '20 15:06 magichew

Sure, you can see the info here: https://www.reddit.com/r/homebridge/comments/e9o2c0/homebridge_and_hisense_tv/

I managed to make it work via HASS and https://github.com/newAM/hisensetv_hass but is limited only to power on and off.

hope this helps.

sebasjunca avatar Jun 09 '20 13:06 sebasjunca

Hi

I've looked at that thread, I was hoping to see you JSON specifically for you controlling the TV which topics you use and commands you set, I don't think my TV needs authentication but then I can't get anything working with any commands to make it do anything.

I've connected to TV with MQTT explorer and observed the information as I do things with the remote but can't decipher how to translate that information in to the settings (JSON) I need to use with MQTT Thing.

magichew avatar Jun 09 '20 14:06 magichew

You can check this thread (I know is from HASS, but it has a lot of examples of commands that might work for you) https://community.home-assistant.io/t/hisense-tv-control/97638 also here: https://github.com/Krazy998/mqtt-hisensetv/blob/master/README.md I'm pretty sure you can use the same commands and adapt them into the config file in homebridge.

Mine does require authentication and Mqttthing didn't work for me, that is why I decided to install HASS too and use the hisensetv_hass, easier setup and no need for mqtt commands or tls certificates

sebasjunca avatar Jun 09 '20 14:06 sebasjunca

Thanks for that, I don't seem to be able to summon the brain power to make this work, I've got the following in my JSON via HOOBS. The TV shows in Home App but there's no functionality.

There's a power button there and an empty source list (I expected the source list to be empty as I haven't defined anything) but the power button does nothing.

{
            "accessory": "mqttthing",
            "plugin_map": {
                "plugin_name": "homebridge-mqttthing",
                "index": 0
            },
            "type": "television",
            "name": "Hisense Kitchen",
            "url": "192.168.1.26:36669",
            "username": "hisenseservice",
            "password": "multimqttservice",
            "topics": {
                "getActive": "remoteapp/tv/ui_service/actions/gettvstate",
                "setActive": "<topic to set the status>",
                "getActiveInput": "<topic to get the active input source (optional)>",
                "setActiveInput": "<topic to set the active input source (optional)>",
                "getVolume": "remoteapp/tv/platform_service/actions/getvolume",
                "setVolume": "remoteapp/mobile/broadcast/platform_service/actions/volumechange",
                "setRemoteKey": "remoteapp/tv/remote_service/actions/sendkey"
            }
        }
    ],

Can anyone point me in the right direction?

magichew avatar Jun 09 '20 19:06 magichew

"setActive": "<topic to set the status>" <-- don't you need the MQTT topic that controls the power in there?

arachnetech avatar Jun 11 '20 21:06 arachnetech

I am in the same boat here @magichew, only just got my Hisense (65S8 2020 model) to discover I cannot even ping it (therefore cant use that as state feedback for broadlink integration like my previous Hisense). I was hoping after reading through that HA thread that this plugin could be the answer...

mitch7391 avatar Jul 07 '20 15:07 mitch7391

@arachnetech fo you think your plug-in is capable of running what they have managed to sniff out in this HA thread?

https://community.home-assistant.io/t/hisense-tv-control/97638

I gave it a go but not sure if I’m doing it wrong or if your plug-in can’t do it. In particular I’m not sure how to structure the commands in that thread for the required inputs in the config for your plug-in. Any help or guidance would be greatly appreciated 😊

mitch7391 avatar Jul 08 '20 04:07 mitch7391

@arachnetech to save you reading through that thread, here is a summary of what one person (post 95) put together:

Button presses are as follows. These work over CEC.

/remoteapp/tv/remote_service/XX:XX:XX:XX:XX:XY$normal/actions/sendkey

Power = KEY_POWER Back = KEY_RETURNS Menu = KEY_MENU Exit = KEY_EXIT Pause = KEY_PAUSE Play = KEY_PLAY (play and pause work the same) Stop = KEY_STOP Up = KEY_UP Down = KEY_DOWN Left = KEY_LEFT Right = KEY_RIGHT Fast Forward = KEY_FORWARDS Backwards = KEY_BACKWARDS Home = KEY_HOME Back = KEY_BACK Menu = KEY_MENU RGYB Buttons = KEY_RED, KEY_BLUE, etc. Numkeys = KEY_0, 1, 2, 3, etc. Channeldot = KEY_CHANNELDOT Channel Up = KEY_CHANNELUP Channel Down = KEY_CHANNELDOWN Closed Captions = KEY_CC

For app launching, here’s an example MQTT publish and the JSON for it. This launches the app immediately, from every screen and input I could try.

/remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XY$normal/actions/launchapp

{ "appIcon": "", "appId": "", "has_detail_page": 0, "isLocalApp": 1, "name": "Plex", "storeType": 0, "type": 0, "url": "com.plexapp.android", "urlType": 0 }

Sources basically work identically to the app launching. You can just copy and paste the JSON and change HDMI 1 to the other numbers, they’re identical. I don’t use OTA or cable TV, so I cannot test channel inputs, though it would probably work okay with the remote codes above.

/remoteapp/tv/ui_service/XX:XX:XX:XX:XX:XY$normal/actions/changesource

{"displayname":"HDMI 1","hotel_mode":"","isDemo":false,"is_lock":"","is_signal":"","sourceid":"3","sourcename":"HDMI 1"}

mitch7391 avatar Jul 12 '20 23:07 mitch7391

I guess what I am after is some guidance on how to get this structured in your plug-in or if it is not possible.

mitch7391 avatar Jul 12 '20 23:07 mitch7391

@arachnetech or anyone else able to provide any sort of guidance?

mitch7391 avatar Jul 20 '20 10:07 mitch7391

Sure, you can see the info here: https://www.reddit.com/r/homebridge/comments/e9o2c0/homebridge_and_hisense_tv/

I managed to make it work via HASS and https://github.com/newAM/hisensetv_hass but is limited only to power on and off.

hope this helps.

How does this method look in HomeKit for you? Is it a Switch or a TV accessory? Started looking at HASS as I am getting no luck here, but HASS really makes no sense to me as I am used to Homebridge...

mitch7391 avatar Jul 20 '20 10:07 mitch7391

I have a Hisense running Software Version V0000.01.00a.M0208. I could authenticate with another client on the same machine, and afterwards it would accept my commands. Just install the pip package hisensetv

Then you can run hisensetv <ip> --authorize After authorization I was able to post commands with other clients as well, as long as I used the same topic path.

It is helpful to listen to all mqtt traffik with tools like MQTT Explorer or mosquitto for debugging.

gothma avatar Mar 31 '22 22:03 gothma

The TV support in mqttthing was added by @tobekas, and I haven't used it personally.

Looking at the documentation (https://github.com/arachnetech/homebridge-mqttthing/blob/master/docs/Accessories.md#television), you can switch inputs but not much else.

I'm not sure that the 'Active' characteristic (https://developer.apple.com/documentation/homekit/hmcharacteristictypeactive) is intended to be used to turn the TV power on and off.

arachnetech avatar Apr 03 '22 15:04 arachnetech