Creating a custom integration (Climote)

Hey all,

We got a free “Climote” smart heating control from our electricity provider here in Ireland. Communication with the control is over GSM, and then there is an app which connects to Climote’s servers. I just ran my phone through Charles proxy and there is a lovely HTTP protocol going on in the background behind the app. A couple of curl statements later and i can get the status from the heating control (and its attached temperature sensors) and i managed to turn on and off the heating. Wonderful! Everything returns nicely formatted JSON data.

I am going to start by trying to get the data from the status response into home assistant. curl and JSON response looks like this:

curl -H ‘Host: climote.climote.ie’ -H ‘Authorization: Basic [redacted]’ -H ‘Accept: /’ -H ‘X-Requested-With: XMLHttpRequest’ -H ‘Accept-Language: en-gb’ -H ‘Content-Type: application/x-www-form-urlencoded; charset=utf-8’ -H ‘User-Agent: Appcelerator Titanium/5.1.1 (iPhone/10.1.1; iPhone OS; en_IE;)’ -H ‘Cookie: [redacted]; PHPSESSID=[redacted]’ -H ‘X-Titanium-Id: [redacted]’ --data-binary “force_update=0” --compressed ‘https://climote.climote.ie/api/get-status

{“message”:{“unit_time”:“13:04”,“zone1”:{“burner”:1,“hold”:“00”,“boost”:“00”,“temperature”:“23”,“thermostat”:25},“oillevel”:null,“holiday”:“00”,“alarm”:null,“creditwarning”:null,“maxtext”:null,“updated_at”:“13:04”}}

Question: How would people go about making the request to the api, retrieving the JSON, and creating sensors in HA for temprature, thermostat, hold and boost?

My thinking:

  • Command line script would be easy enough but from reading the documentation i think i can only return one value to HA from the script, where I might want 1 call to update 4-5 sensor values?
  • HTTP sensor does’nt seem to support authentication?
  • I suppose I could write a cron job outside ha that polls the API, parses the response and writes it to different topics on my MQTT server?
1 Like

interesting, I have the same problem for a different system.

I should be possible to control and intereract with the panel I am already using because you can control everything through their web based app.

Unfortanately for me, I have NO clue how to do it or even where to start.

1 Like

The commands are pretty straight forward. I am just not sure of the best way to approach the home assistant integration.

1 Like

Hey Mick,

sorry if I’m reviving an old post - did you manage to make it work?

thanks!

Hi there, I came here seeing if there was an API approach for climote. I need to be able to switch temperatures around during the day/night. I put together a python script to do this and saved it in /usr/bin/climote so I simply have to run “climote 20” to set temp to 20. I hope you can use this as a basis for any climote integration.

#!/usr/bin/env python
import requests
import sys

temp = sys.argv[1]

def climote_set_temp(temp):
    email = 'YOUR EMAIL GOES HERE'
    id = '12 DIGIT CLIMOTE ID GOES HERE'
    headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0'}
    with requests.Session() as s:
        url="https://climote.climote.ie/manager/login"
        login_request = s.post(url, data={'password': email, 'rememberEmail': 'on', 'username': id, 'rememberUnitNumber':'on', 'passcode':''}, headers=headers)
        cs_token_rf = str(login_request.text[ login_request.text.find('cs_token_rf" value="')+20:login_request.text.find('cs_token_rf" value="')+20+40]).strip()
        url="https://climote.climote.ie/manager/temperature"
        thing_request = s.post(url, data={'temp-set-input[1]': temp, 'do': 'Set', 'cs_token_rf': cs_token_rf}, headers=headers)

climote_set_temp(temp)

exit()
1 Like

sorry to wake this old thread.
how to use this python to work with climote and HA?

1 Like

Hey there! Sorry I didn’t see your reply. Thanks for that! Do you have the commands handy? I only use climote to turn on and off the water, if I manage to gather the python command to do so, I’ll be happy! :slight_smile:

1 Like

Hi Mick,

Thanks for posting this.
I’m trying to get it working on POSTman first but I keep getting Unauthorised Login Token which is to do with the basic auth?
What combination of username:password did you use?
username=email or username=35386xxxxxx password=???

Thanks,

1 Like

Did anyone get any further with this?

Hi,
I will be looking in the next few months to add climote to home assistant. Just started my smart home journey and so nice to see that there are so many integrations built by various guys…

We probably need to start a git project for this and I have asked Climote for some integration support integration.

What would be useful is to have an integration with few buttons that we mostly use like boot water 30 min, boost living heating for 30 min and boost upstairs heating for 30 min etc.

1 Like

It seems someone tried already building this


I will try to play around with it and maybe get in touch with the Dev behind.
If anything, we potentially can reuse some of this and i can try to help with the build

OK, to give update. I think i am on right track. THe communication with Climote page works fine (at least login and getting Zones data). Now have trouble to overall build it for HASS. Will play around for another day or two and if cannot figure out will set fork on git and give you details

1 Like

ok, first commit


so far the Entities are added, the current and set temperatures are read form Climote website.
Still to look into Actions
1 Like

Hi there, am looking to test this and hopefully provide feedback to you. I am unsure how to get it added, I downloaded the code and placed into a subfolder of “custom_components”. When I add the config to the config yaml and then do a Check Config, I get

Platform error climate.climote - Integration ‘climote’ not found. HAve I copied the files into the wrong location?

1 Like

Actually have it working now. I had to restart HA first, then add the lines to configuration.yaml. Presumbly the restart caused HA to “re-read” the custome_components folder and then it knew what I was trying to configure afterwards.

Have the entity now climate.living which coresponds to my single zone. can see the temp on it.
HAve it on a lovelace card now

have spotted that it only appears to update the values read from the device on HA startup.

  1. Started HA, can see the set temp on the Climote
  2. Change the temp on the Climote (using their mobile app)
  3. Temp doesnt update on the lovelace card (multiple hard browser refreshes).
  4. restart HA, it reads the “new” set-temp value (after about 3 minutes)

I waited 15 minutes between #3 and #4.

Once I restarted HA, I get a few of these entries in the HA log:

2021-02-15 20:56:19 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for climote doing I/O at custom_components/climote/climate.py, line 313: r = self.s.post(_LOGIN_URL, data=self.creds)

thanks for testing @deccos
so the list of to-do goes

  • Refresh interval
  • move i/o outside of event loop
  • Proper actions (i.e Boost)
  • config entries
  • HACS integration / install instructions

Will keep working on it :0)

1 Like

That is great guys. I will be trying it soon too. Well done @VatzU !

Hi All,
Ok, small update. I have pretty poor signal where i live so the test are coming quite delayed but overall seems to work
List of to-be done:

  • Proper actions Set temperature and Boost heating (1h by default)
  • Config entries
  • Refresh interval see config and comment on git
  • Move i/o outside of event loop
  • HACS integration / install instructions

Updated files on github

will test it tomorrow. late here in Ireland