IntesisHome WiFi AC Control

Yes I believe you could use the REST API for HomeAssistant https://home-assistant.io/developers/rest_api/

It might be simpler to use the IFTTT integration with Homeseer and IFTTT with Intesis?

This component is using the same method used by the IntesisHome mobile apps, not the public API, so doesn’t use an oAuth key in this case. Details of the authentication method be found in pyIntesisHome library on Github

I was also very disappointed by their lack of making a private API available for personal use

Thanks for the very quick reply. I am currently using IFTTT to integrate Intesis and Homeseer, but it requires an idiotic number of events to really make it work (i.e. one event if the temperature drops below 67; a second event if it drops below 66; a third event if it drops below 65; a fourth event if it goes above 65; a fifth event if it goes above 66; and so on. It’s absurd). I’ve only written the first few events and I don’t want to have to go through the entire process, as we live in Vermont, where the temperature can vary by 100 degrees during a year.

I’ve got the plugin up and running in Windows 10 - it works perfectly. For what it’s worth, two important instructions on how to implement HomeAssistant on Windows 10 are incorrect, or at least they were for me. For those also struggling with this, here are two important pieces of information:

  1. If you use the pip install method to install HomeAssistant the configuration folder is located at
    C:\Users\XXXX\AppData\Roaming.homeassistant (substitute your user name for XXXX)

  2. There are several different commands that are given in the documentation to launch Homeassistant in a command prompt (using cmd.exe). The only one that worked for me was python -m homeassistant --open-ui. Note that two dashes precede the word ‘open’. On the Homeassistant website one of those dashes is mistakenly an ‘em-dash’.

Hope this is helpful, and thanks so much for building this interface - it’s great work.

Now that the plugin is up and running, I think I’ve found a small error (or perhaps I have not configured the plugin properly?).

When I see my Intesis thermostats in Homeassistant, they are indicating that the temperature is in Fahrenheit, but the numbers that are being reported are actually the temperature in Celcius. For example, one thermostat is reporting a temperature of 22F inside my house, when the temperature is actually 71F (which is about 22C).

Did I do something wrong, or is the component forgetting to convert?

Regards.

jnimmo, thank you so much for this! I can’t emphasize how happy I am to have support for IntesisHome :slight_smile:

I’m experiencing a small problem though - when trying to turn off the heating from HA, my AC turns off and then immediately turns on again.
The IntesisHome app is showing that the AC is off, but it is in fact still on, and it will stay on until I turn it ON & OFF manually from the remote, or from the original IntesisHome app. I’m not sure what the problem is.

Would you mind helping me understand the problem?

Thank you!!!

Thanks very much shlomki, great to find someone else to make use of it!
Interesting, so the IntesisHome app thinks it has been turned off, but it is not off?
But normally it turns off fine using the IntesisHome app (and pressing the Off button)?

Probably what I need to see is

  1. Run Home Assistant interactively to see the logs
  2. Send a command from Home Assistant (i.e. setting temperature or mode) so it connects to the API
  3. Turn the AC off from the IntesisHome app
  4. See what changes come through through on the logger

However I possibly don’t have enough logging setup on the pyIntesisHome library to monitor which UID/item is being changed

If you had any facility easily to do a packet capture from the mobile device that would be the most useful
(would only need the traffic being sent to/from the server which is logged when you send the first command from Home Assistant, i.e.
17-01-12 12:20:22 DEBUG (Thread-9) [pyintesishome.pyintesishome] Server: 212.XX.XX.XXX:5220

jnimmo,

Hi, I’m wondering if you have given some thought to the earlier post regarding fahrenheit and centigrade? It appears that the temperatures are coming back in centigrade, but they state that they are in fahrenheit. Not a big problem (I can convert them) but it might be a little confusing.

Thanks.

Hey sorry forgot about that one -
Can you try changing line 53 of climate\intesishome.py

from
temp_unit = hass.config.units.temperature_unit
to
temp_unit = TEMP_CELSIUS

If that fixes it will tidy up the code on the repository
Cheers

jnimmo,

I made the change to line 53 but it had no effect. Maybe the code in line 98 is relevant?

I don’t want to waste your time because it is easy to convert once the data is retrieved from Intesis, so I’ll leave it up to if you want to continue to modify this. I’m happy to test other changes if you would like, just let me know.

At the same time, I’m going to focus on building a similar capability in Homeseer in a .ASP script. Following your code I’ve been able to write an ASP routine in Homeseer to pull info from the thermostats via polling, which will work fine for my needs. However, I’m unable to figure out if there is a POST method (rather than an asyncio method) to set the thermostats. From your code I can see the format of the message payload and how to communicate the deviceID, the uid and the value (thanks for the very clear documentation) but I’m not sure how the API authenticates the request as coming from a valid user. I tried adding username and password to the payload but that didn’t work.

Could you provide a brief explanation of how to POST to set the thermostat, or let me know if the POST method is not possible?

Thanks for figuring out that the mobile API even existed - I and everyone in the Homeseer community is or will be very grateful, once I can convert your methods to that platform.

Regards.

Good idea line 98 would be worth a try (revert that first change I got you to make, then change 98 to return self._unit )

IF that doesn’t help can you just check what temperatures it shows in the logs running hass from command line?
I wonder if IntesisHome API spits out celsius regardless and then somehow need to get Home Assistant to convert it? No not wasting my time appreciate the help getting it to work globally.

Regarding porting to ASP, nice work that sounds good!
To control the thermostat, you need to save the auth token which should come back in response to the HTTP POST

You open a TCP socket to the serverIP and serverPort also in that response, and then authenticate the socket connection by sending

{"command": "connect_req","data":{"token":<TOKEN>}}

That should return “status”:“ok”, then you’re authenticated and can send the commands to the TCP socket.

I should really try blocking all outbound traffic one day on the iPhone and see if it falls back to an HTTP POST as that would be much easier…

The traffic on the TCP socket looks like this (every second line is the response), should be ASCII encoded.
Note some lines have another {“command”:“status”}… this is a status update showing the state change.

{“command”:“connect_req”,“data”:{“token”:89144470}}
{“command”:“connect_rsp”,“data”:{“status”:“ok”}}
{“command”:“set”,“data”:{“deviceId”:100000000000,“value”:1,“uid”:1,“seqNo”:0}}
{“command”:“set_ack”,“data”:{“deviceId”:100000000000,“seqNo”:0,“rssi”:196}}{“command”:“status”,“data”:{“rssi”:197,“deviceId”:100000000000,“uid”:1,“value”:1}}
{“command”:“set”,“data”:{“deviceId”:100000000000,“value”:0,“uid”:1,“seqNo”:0}}
{“command”:“set_ack”,“data”:{“deviceId”:100000000000,“seqNo”:0,“rssi”:197}}{“command”:“status”,“data”:{“rssi”:197,“deviceId”:100000000000,“uid”:1,“value”:0}}{“command”:“status”,“data”:{“rssi”:197,“deviceId”:100000000000,“uid”:10,“value”:205}}

OK, thanks. I will revert to the original on line 53, make the change to line 98, and then let you know the results. I’m not that expert on command line programming - in fact, the command ‘hass’ isn’t how I start Hopmeassistant on Windows 10 (if I recall, ‘hass’ doesn’t work). I use ‘- python -m homeassistane --open-ui’. So if you could explain how to run the command line to display the log file I’d be happy to do it. (Or perhaps you can wait to see if changing line 98 works - if it does, we probably don’t need to print the logs)

Thanks also for the info on how to communicate using the TCB socket. I’m not that comfortable yet with socket communications - I think I will simply, for now, run Homeassistant on the same box that is running Homeseer and see how stable it is. If it is stable and doesn’t hurt performance, I’ll just use your component and communicate with Homeassistant using HTTP communications, which I can do easily, and let your component do the communications with Intesis. Thankfully, your document is very clear, so I know I can make this approach work.

Regards.

I reverted to the original in line 53 and modified line 98, but there is no change - Homeassistant is still returning Centigrade temperatures and reporting them as Fahrenheit.

I’m not sure how to get access to the log files, but this is an example of what appears in my DOS command window while Homeassistant is running - perhaps it provides the info you need?

INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state c
limate.office=Off; temperature=None, operation_list=[‘Auto’, ‘Cool’, ‘Heat’, ‘Dr
y’, ‘Fan’, ‘Off’], fan_list=[‘Auto’, ‘Quiet’, ‘Low’, ‘Medium’, ‘High’], operatio
n_mode=Off, run_hours=124, max_temp=30.0, unit_of_measurement=°F, friendly_name=
Office, current_temperature=19.5, min_temp=16.0, rssi=213, ha_update_type=Push,
fan_mode=High @ 2017-01-16T15:44:49.439600-05:00>, entity_id=climate.office, old
_state=<state climate.office=Off; temperature=None, operation_list=[‘Auto’, ‘Coo
l’, ‘Heat’, ‘Dry’, ‘Fan’, ‘Off’], fan_list=[‘Auto’, ‘Quiet’, ‘Low’, ‘Medium’, ‘H
igh’], operation_mode=Off, run_hours=124, max_temp=30.0, unit_of_measurement=°F,
friendly_name=Office, current_temperature=19.5, min_temp=16.0, rssi=215, ha_upd
ate_type=Push, fan_mode=High @ 2017-01-16T15:44:49.439600-05:00>>
INFO:homeassistant.core:Bus:Handling <Event state_changed[L]: new_state=<state c
limate.bens_room=Off; temperature=None, operation_list=[‘Auto’, ‘Cool’, ‘Heat’,
‘Dry’, ‘Fan’, ‘Off’], fan_list=[‘Auto’, ‘Quiet’, ‘Low’, ‘Medium’, ‘High’], opera
tion_mode=Off, run_hours=158, max_temp=30.0, unit_of_measurement=°F, friendly_na
me=Ben’s room, current_temperature=19.0, min_temp=16.0, rssi=205, ha_update_type
=Push, fan_mode=High @ 2017-01-16T15:44:49.446600-05:00>, entity_id=climate.bens
_room, old_state=<state climate.bens_room=Off; temperature=None, operation_list=
[‘Auto’, ‘Cool’, ‘Heat’, ‘Dry’, ‘Fan’, ‘Off’], fan_list=[‘Auto’, ‘Quiet’, ‘Low’,
‘Medium’, ‘High’], operation_mode=Off, run_hours=158, max_temp=30.0, unit_of_me
asurement=°F, friendly_name=Ben’s room, current_temperature=19.0, min_temp=16.0,
rssi=199, ha_update_type=Push, fan_mode=High @ 2017-01-16T15:44:49.446600-05:00

Ok thanks yeah that’s all I needed - so IntesisHome must just use celsius in the back end.
I’ll have another look at it tonight, I think both of the lines of code will need to refer to UNIT_CELSIUS then, and I’ll ask developers whether it is supposed to automatically convert celsius to fahrenheit or if I need to add functionality to do that

Thanks that’s very helpful - you may like to delete that section of logging from post, I don’t think is sensitive but probably want to remove token, device IP and their server IP

I’ve just pushed an update to my Github for the climate file which I suspect will resolve the issue - sending a set temperature right after the off command does actually seem like a probable cause, so I’ve changed the way that code works.

I’ve also fixed the issue for @jwshome - turned out I was overwriting the current temperature (which Home Assistant would have converted correctly). Should be sorted for you now hopefully!

Oops, didn’t notice that. I had to delete my post altogether because of edit history :slight_smile:
Thanks so much for the fix! I will try that out tomorrow and let you know how it goes.

1 Like

It works!!! :tada::confetti_ball: Thanks!
I can now be at peace :slight_smile:

I have a few more, very minor, suggestions, if you’re interested. I’m still completely happy with the current solution and I think most users will be too, but still have a few suggestions to make this interface even better than it is.

  1. I think it would be nice to have a dedicated “on/off” switch, instead of selecting from the list of operation modes. It’s much more intuitive because you don’t have to browse through the different options of “heat/fan/auto…”. It’s much quicker to just flick a switch to turn on and off. It also avoids choosing the wrong mode by mistake (choosing Cooling in the winter, for example).

  2. The history graph is really really useful, but there is a small problem with it: Say for example I had the AC on between 10am-11am, and then on again between 4pm-5pm, it would show as the AC was on from 10am to 5pm, instead of just showing it was on for two separate hours. Do you think this could be fixed?

  3. For some reason, the Fan Mode setting could only be set to Medium, Low, or Auto, even though my AC also supports High. When I select High, the interface jumps right back to Medium, but I think my AC is running on High anyway, even when Medium is selected. -Edit: I think I’ve found the problem. My AC doesn’t support the Quiet setting, so the values are mapped incorrectly: Quiet is mapped to Low, Low is mapped to Medium, and Medium is mapped to High, and High is mapped to nothing :slight_smile: I confirmed my assumption with the IntesisHome app and it seems that this is indeed the case.

Again, these are just very small minor issues that would be nice to have, but are not necessary. I appreciate all of your work and help :slight_smile:

Hi again Shlomi
Thanks for your help testing

  1. Would require some changes to the Climate Component UI - I’ve just written a feature request for this here(On/Off control for Climate component card) if you would like to vote - it would be nice

  2. Can you post a screenshot of the history graph you’re looking at? I’ve only seen the current temperature/setpoint graph, which does seem to correctly only show the setpoint if there has actually been a setpoint active (and no line otherwise)

  3. I’ll try and get back to you about this sometime - I know you sent through that JSON but it might be something else I need to see,

Cheers!

Hi
after updated HA to 0.39.3, the intesishome dosent work, i have copyed the newest intesishome.py to custom_components, and updated the intesishome.py in folder climate
but getting this error:

17-03-04 08:45:51 ERROR (MainThread) [homeassistant.loader] Error loading custom_components.intesishome. Make sure all dependencies are installed
Traceback (most recent call last):
File “/usr/local/lib/python3.4/dist-packages/homeassistant/loader.py”, line 141, in get_component
module = importlib.import_module(path)
File “/usr/lib/python3.4/importlib/init.py”, line 109, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 2254, in _gcd_import
File “”, line 2237, in _find_and_load
File “”, line 2226, in _find_and_load_unlocked
File “”, line 1200, in _load_unlocked
File “”, line 1129, in _exec
File “”, line 1471, in exec_module
File “”, line 321, in _call_with_frames_removed
File “/home/pi/.homeassistant/custom_components/intesishome.py”, line 13, in
from homeassistant.components.discovery import load_platform
ImportError: cannot import name ‘load_platform’
17-03-04 08:45:51 ERROR (MainThread) [homeassistant.loader] Unable to find component intesishome

in the file the link for details is not working, I might need some dokumentation on how to install and configure this component, the old version from November worked just fine until upgrading from 0.39.0 to 0.39.3

For more details about this component, please refer to the documentation at
IntesisHome - Home Assistant

Any clue of what to do?
/Thomas

Hi Thomas
Error message seems to imply it is loading the climate part ok but not the base IntesisHome module

I’ll try upgrading when I’m back home tonight.

I am planning on just merging it all into the climate component for simplicity at some stage too
Cheers

Thank you :slight_smile:

I upgraded today and have the same issue