Add integration for Hisense devices using ConnectLife

Can you post the code on the github? Not a developer myself (have tried many times to learn how to code without any luvk) but maybe others can jump in and ppl like myself can buy ones a beer?

1 Like

I have this AC unit and idk to control from HA as energy excess from my solar plant.
Pls share with us, thank you.

Reached the HiSense support team as was mentioned above

Let’s keep the fingers crossed

1 Like

same answer to me…hope end of the year

Sorry for the late reply. For the target sensor I used a temperature&humidity sensor’s temperature data and for the heater i’ve made an input_boolean helper. If you don’t have a T&H sensor that you could use for that purpose, an another workaround could be to also querry what the AC reports as indoor temperature and save it to an input_number helper with the input_number.set_value service. I would advise against this option because the AC, when running would report values that are +/- 6 degrees off compared to the actual temperature.

Made a quick proof of concept that’s working pretty well on the console: https://github.com/andy2002a/HA-ConnectLife/blob/main/poc.py

You need to get an API key from here: Swagger UI (connectlife.io)

Only tested on an AC unit so far. If someone knows how to convert this into an HA integration let me know and we can colab on it.

1 Like

Can you give more info how to test your POC script?

Thnx.

  1. Go here: Swagger UI

  2. Click Authorize (leave the default values)

  3. Back on the main page, click on “GET /api/v1/appliance”, then “try it out”, then “execute”

  4. This should generate a curl request that looks like

-H 'Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  1. copy the xxxxx into the access_token variable in the script

  2. Modify the parameters of the functions below to change the respective settings

device.setSystemMode('Cool', True)
device.changeTemperature('68', True)
device.setFanSpeed('Medium', True)

This Is very promising!

Sorry for the very basic question but how do I run that .py script in Home Assistant?

Did everything as you described. Tried running the script from Dev Tools - Services but nothing happened. Tried running it while aircon was off and on.
I guess temp ‘68’ is in F not C?

It’s not an HA integration so you can run it anywhere that allows you to run python scripts. I just ran it on a Linux VM I have for testing. So you would do something like:

  1. Modify the script with your access_token
  2. Modify the script with your desired parameters for changeTemperature, setFanSpeed, etc.
  3. run it: python ./poc.py

Looks like I had a bug with setTemperature try again with the latest version on github.

Should look like this when it runs now:

/poc.py", line 131, in
device = appliance(ApplianceResponse.json()[0])
IndexError: list index out of range

Is there an option to see all the output the script gets?

Also a question on the swagger.

  1. Back on the main page, click on “GET /api/v1/appliance”, then “try it out”, then “execute”

After this point - shall i see the linked appliances in the response there?

You could add this after line 140 to see what the response is:

print('\n\n' + str(ApplianceResponse.json()) + '\n\n')

If you don’t have 2 devices maybe you don’t need the index? So replace 143 with this?

device = appliance(ApplianceResponse.json())

You should see this on the swagger page. The red box is what you copy into the script.

The problem was with the region i used for registration. After switching it.

<Response [200]>
Traceback (most recent call last):
  File "/home/pi/poc.py", line 136, in <module>
    device.setTemperature('35', True)
TypeError: 'str' object is not callable

Code sent

device.setSystemMode('Heat', True)
device.setTemperature('35', True)
device.setFanSpeed('Medium', True)

Where I live - Cooling is done behind the door at this time of year :slight_smile:

1 Like

So this means that an api is freely available? Hopefully someone will get the integration going. Should have learned programming myself but… Too late

Technically it’s not available since you can’t generate your own client_id and client_secret, but it works if you just use theirs.

Did anyone actually managed to implement any ConnectLife device in HomeAssistant?

I received this email this morning.
They are still working.

Since the original request has been denied by the mfgr several times, and since there is no current core integration for this that can be modified, this appears to be more of a third party integration question. It will therefore be moved to that topic category.