Lennox iComfort S30, E30 or M30 thermostat API?

I posted this on reddit but seems like there isn’t much action there on this topic.

For the life of me, I can’t understand what Lennox is doing. They have two different iComfort smart communicating thermostat brands that utilize two different API backends.

Does anyone have anything on this? My Google-FU isn’t working as I can’t find anything substantial.

Is there any way to scrape the communications between Alexa/HomeKit to reverse engineer it?

.

.

For the S30 models:

  • The S30 already comes with Alexa + HomeKit integration as listed in their mar-com

  • No public API published

  • /u/fr33kster also has a similar frustration with the two different API’s as he has an S30

.

For the non S30 models:

  • API is available here with details here

  • /u/KeightAich made a Alexa Skill - Details here.

  • /u/ut666 created a /r/homeassistant component that can do basic control - Details here.

  • These guys sell a driver to control the other iComfort with Control4

The Lennox iComfort S30 & E30 thermostats recently integrated Apple Homekit as a supported interface. (Info)

Home Assistant recently integrated Homekit Climate (thermostat) support in version .73.

So now I’m looking at the cheapest means of setting up a Homekit controller (such as an AppleTV 3rd gen or older iPad) to get this working. I have no other use for Homekit but for iComfort S30 control via HA, so this isn’t an ideal solution, but at least it is a supported solution on both ends.

I have been working in the background on a Pypy scraping library for S30-generation models (simulates what the website does), but I did not have any affirmation from Lennox that is was acceptable. I have quite a bit of the interaction working, and I understand the path forward for the rest. It’s in VERY rough shape right now, but it does work (login, change temp, away mode, set schedule, etc).

I have FINALLY received a “we won’t stop you, but it may break” message from Lennox, so I will post this here. As a note, this will likely be supplanted when/if more stable APIs are available. I am hoping I can get a bit of help and testing by posting the codebase here. Again, this is VERY early, and still a WIP:

Next steps are to fill out the function calls, get some wider testing, and then start working on the HA integration.

This is great news Ben! I will gladly help you test this. I was just about to order a used AppleTV for Homekit/HA integration, but will hold off to see how this goes. Direct integration, even if it may change later, is much preferred to adding another hub.

EDIT: I cross-posted this to the HA subReddit where the OP (@poldim) also posted tjhis request. Maybe you will get some additional testers from that forum.

Great work Ben! I’ll try to get this up and running at my folks home next week.

Do you have any steps for how to install this on a HASSio install?

FYI: You’re missing the l in my screen name

I would suggest you save yourself some cash: Use this homebridge if you are on HASSio or run it in a docker or VM.

Since I don’t use Siri/Apple devices, I did not realize that HA had native support for Homekit. (The link in your post points to a now deprecated community Homebridge add-on). Thanks very much for pointing out a Homekit hub isn’t actually needed since HA can emulate one directly.

So have you tried to enable the Homekit feature in your Lennox S30 thermostat and bind it to HA/Homekit? if this works, then that seems like a good way to go since it does have Lennox support along with a native HA component to talk to it.

I have two s30’s currently connected to HomeKit via an Apple TV, Gen 4. One s30 controls 4 zones. The other s30 manages a single zone. I’m a novice at HA, but would be willing to install and test on my Hassio / Pi3B+ if given comprehensive instructions.

Maybe you will have better luck than me since you already have your S30’s connected to a Homekit hub. You could try adding the HA Homekit integration by referring to these simple instructions. Supposedly it should auto-discover your S30’s and create new climate entities. Please let us know if that works.

I don’t have a Homekit hub to pair the S30 with (via WAC). I haven’t been able to figure out how or if this HA Homekit component can discover anything and start the WAC pairing process unless the S30 is already registered on a Homekit network.

Discovery didn’t detect the s30 thermostats. I did a homekit factory reset, initiated WAC mode, and restarted HA. No joy. Discovery did find the previously configured myq hub. Did a second test with a homekit factory reset, no WAC mode, reestablish a network connection, and restarted HA. No go.

It appears the s30 isn’t recognized as a homekit accessory. WAC mode takes the s30 offline and doesn’t present a pairing code until after the iOS device passes network details and presents the s30 as an accessory to add.

Thanks GaryK for the testing. It could be that the only way the HA Homekit emulation would be able to find the S30 was if it were already registered and connected. It discovered your registered MyQ device just fine.

“Climate” devices are supported, so I don’t know of any reason why a previously connected iComfort S30 could not be discoverable. It may be that the component doesn’t support WAC pairing.

Did you try re-registering it with your AppleTV homekit hub, then see if HA/Homekit can discover it?

Yes. No UI card for the s30s. Only one way that I’ve found to get a pairing code for HA. Perhaps in the future s30 firmware will support direct pairing. Lennox smart hub operations support service technicians, not end users.

I wonder if the original Homebridge add-on (now deprecated, but still functional) would pair with the S30? This is what @poldim was suggesting I try.

Hi @BenMenchaca

I’ve downloaded your icomfort3-scraper and all associated files to Windows and am struggling to figure out how to configure and run it. I haven’t found where my iComfort userid/pw is set up. Also, please provide some pointers on how to run these test modules.

I’ve installed Python 3.7/64bit on Windows, open one of the test_.py apps via the Python shell, then “run module”, and get errors such as “no module named requests” (from session.py - import requests). So apparently I’m missing some dependencies as there wasn’t a requests.py in your repository.

Thanks for the help!

Gary,

secrets.py: This uses the same secrets paradigm as home assistant (since it will eventually live there). I have pushed an example_secrets.py for your reference.

dependencies: Bad dependency management on my part. I have added an install_requires for the requests module, and a requirements.txt just for fun. You can add dependencies by doing:

pip install -r requirements.txt

tests: To run a test, you can do:

python test_away_mode.py

And then verify magic happened in the regular UI, or on your thermostat. You can also use test_update.py to pull current status and check that way.

Please let me know if this helps.

Getting a lot closer Ben. Got pip installed, and then got all the ‘requests’ dependencies installed but now am needing a bs4 module…

  File "session.py", line 17, in <module>
    from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'

A quick search says this refers to beautifulsoup, so I’ll try installing it too
(pip install bs4) and see how much further I get.

Update: bs4 installed, and now getting errors that suggest I install a parser library. Not sure what I really need, so thanks for any more tips on getting the python environment in a usable shape.

python test_update.py

Traceback (most recent call last):
  File "test_update.py", line 8, in <module>
    s.login(secrets.icomfort_username, secrets.icomfort_password)
  File "session.py", line 271, in login login_page_soup = BeautifulSoup(login_page.content, "lxml")
  File "C:\..s\Python\Python37\lib\site-packages\bs4\__init__.py", line 198, in __init__
    % ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

Thanks to someone posting this exact error on stackoverflow, the solution was to ‘pip install lxml’.

Now, running python test_update.py executes without errors, but simply returns “200”.

Running python test_away_mode.py results in the following error:

Traceback (most recent call last):
  File "test_away_mode.py", line 10, in <module>
    for home in s.homes:
AttributeError: 'IComfort3Session' object has no attribute 'homes'

Any suggestions for me to look at and tweak?

UPDATE: test_update works! I had just inserted some debug print statements and ran it again, and it dumped all sorts of info about my Tstat . I have no idea why it just showed 200 before and nothing else, but anyway - this is promising!

Great news - I definitely need to add some more error handling…there are frequent unexplained connection terminations from their side, and EVERYTHING takes 2-10 seconds to return. It’s painful, but I am glad you got it working. Please let me know if the “setters” work (set away, in particular). If so, we have bidirectional comms working. Change zone schedule ID (which changes to summer/winter/spring/fall/scheduleIQ schedules) seems…odd. The change almost always happens, but it’s occasionally delayed by up to a minute (although the response comes back right away). I will investigate.

I am now also getting the 200 response with no content occasionally too, and I will investigate that further to try to reduce the frequency, or ultimately retry when it happens.

  • Ben

Hey Ben,

No go on test_away_mode… as mentioned in my last reply, there is an object attribute error ‘homes’ that is ocurring.

I see you updated the requirements to include lxml but you should also include ‘bs4’ in the requirements. Other than that, I think I have all the requirements in place. Just need your help on the attribute error.

Fixed. However, I am still getting an empty homes list, so it’s likely the wire protocol has changed a bit since I checked last. I will look into this today.