Hisense TV with MQTT

Hi all,

My Hisense TV does not have an official API, but using instructions from the following thread allowed me to control it using MQTT:

I am now looking how this can be converted so I can control my TV from OpenHAB. First OpenHAB would need to authenticate with a token, certificates and username/password (generated with a specific algorithm, explained in the thread). Authentication requires manual input of a 4 digit key shown on the TV before the token can be generated. After it was generated the token can be refreshed.

Can anyone advice how to convert the mentioned python code into something OpenHAB can use?

Regards,

Nika.

Are you looking to write an add-on or just to control your TV from OH?

If you just want to control the TV, you don’t need to convert anything. As I understand it, you’d run that Python script as a service (that might take some finessing) and it would handle all the key and token handling stuff. Everything you’d want to do would be exposed over MQTT and you’d use the MQTT binding from the OH side of things to get information and control the TV.

If you want this to be an add-on, you’ll need to wholly port that code to Java.

Thanks Rich, I have never developed in Java and not sure where I need to start. For MQTT I am not sure where to start either as it requires me to use a certificate and I do not know how to do that from OpenHAB? I have only integrated with MQTT using subscription of switches, not sure how to get started with a complex situation like this :man_shrugging:

You don’t. The whole point is all of that certificate stuff gets handled by that Python script which runs separately from openHAB. OH and that Python script communicate over MQTT.

To put it another way, OH knows nothing about the TV nor the Python script. It just knows "subscribe to this topic and publish to that topic.

The Python script knows nothing about OH. It only knows MQTT and how to work with the TV.

In short, since you can already control the TV using MQTT, configure OH to do what ever you were already doing with MQTT to control the TV.

1 Like