Coder Social home page Coder Social logo

lennoxs30api's Introduction

PyPI - lennoxs30api

pip install lennoxs30api

API Wrapper for www.lennoxicomfort.com

By Pete Rager

This asyncio module connects to the Lennox Cloud API to retrieve data from S30 / E30 thermostats. This API does not work for older models that use a different API. Those models are supported by this project: https://github.com/thevoltagesource/myicomfort

Prerequistes:

  1. Python version 3.8.6 or later

  2. A Lennox sign-on (email address and password)

  3. You may need to install aiohttp https://docs.aiohttp.org/en/stable/

Sample program Instructions:

  1. Grab the repo

  2. Edit the test_async.py program to supply the following

    LOG_PATH = '/home/pete/lennoxs30api' # Directoy to stash the log file in

    EMAIL_ADDRESS = '[email protected]'

    PASSWORD = 'mypassword'

Command Line Program Instructions:

The command line program uses asyncio and runs 3 different tasks

  • Task 1 (runner) - this task connects to the cloud API and periodically polls it at a 10 second interval

  • Task 2 (poller) - this task runs on a 15 second interval and prints out information from all active Zones

  • Task 3 (prompt) - this task reads from the command line and executes commands on behalf of the user to enabling API testing. Cmd List

      cool, heat, off - sets the HVAC mode to cool, heat or off.  usage - just type the word followed by enter eg cool
    
      auto, on, circulate - sets the Fan mocde to auto, on, or ciruclate
    
      csp <TempF> - sets the cool setpoint in F.  example  csp 76
    
      hsp <TempF> - sets the heat setpoint in F.  example hsp 65
    

To exit the program hit crtl-c

Reporting Bugs

Please enabled debug logging when reporting bugs and provide sample code. Do not publicly post the debug logs as they contain Personally Identifiable Information that is part of the communication protocol. Your password IS NOT in the logs, but other information such as email, home address, etc., that is part of the lennox communications is.

Enhancements

Submit enhancement requests as issues or better yet send a pull request.

lennoxs30api's People

Contributors

hufman avatar hyperactivej avatar peterager avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

lennoxs30api's Issues

API support for controlling outside air damper

Some Lennox Systems have the ability to pull fresh air from outside. This ventilation is controlled via a damper. We will need API ability to open / close the damper as well as associates status information for the system and zones.

Observation on Test Mode

I had a HVAC tech come to check my refrigerant on my HP and needed to have the system running at full power. So I put the system in test mode at 100% cooling while they checked the pressure. After it was over my dashboard only showed the time as Fan mode and the system as Off.

I think this is an error in my logic as I only accounted for tempOperation to have heating and cooling and if not, off.

Are there other modes for tempOperation that I should account for?

Understanding Demand

I know that I asked this question in item #62 about what Demand was and the response was CFM. But I don't think that is correct. I have never seen a Demand that exceeded 100. Mostly for me its about 35-45, but can go up to 100. My actual CFM limits are much larger (see below).

I am wondering if it actually is the percent that is set for the zone? If you have a zoned system you set each of the zones airflow in the Test section. Don't get me started why they are there. You can set these for (in CFM):

  • Heating
  • Cooling
  • Blower (I guess for fan only use)

The maximum is based on the air handler you have and the installer decides how much they want each zone to get at a maximum.

Looking over the s30api_async.py file I did not see any place to obtain these fan set points. So if my hunch about percent is correct, then there seems to be no way, other than manually entering the values, to actually determine the CFM for a zone at a given time.

Change info log messages to debug

I'm seeing the following in my logs every 10 seconds:

2021-09-07 22:19:16 INFO (MainThread) [lennoxs30api.s30api_async] Request Data - Enter
2021-09-07 22:19:26 INFO (MainThread) [lennoxs30api.s30api_async] Request Data - Enter
2021-09-07 22:19:36 INFO (MainThread) [lennoxs30api.s30api_async] Request Data - Enter
2021-09-07 22:19:47 INFO (MainThread) [lennoxs30api.s30api_async] Request Data - Enter
2021-09-07 22:19:57 INFO (MainThread) [lennoxs30api.s30api_async] Request Data - Enter

It looks like there's many "info" level log messages, such as:

https://github.com/PeteRager/lennoxs30api/blob/master/lennoxs30api/s30api_async.py#L387

Would it be better for those to be at a debug level? I'm not sure method calls are useful for day-to-day operation.

PYTZ Prereq

Small nit. Might want to mention PYTZ is a a prereq and should be installed with PIP first.

Are commands not supported anymore ? Code is commented out and functions aren't available.

Hi,

Are setpoint commands not supported anymore ? The lines to set them are commented out in command_reader_task :

                par = splits[1]
                print("Heat Setpoint [" + par + "]")
                # cmdres = await zone.setHeatSPF(par)
                # print("Command Result [" + str(cmdres) + "]")```
                
 Also, these functions aren't in the "s30api_async.py" file. Since it is mentioned that, wrong parameters can brick the thermostat, what is the right method to do a schedule override (the controller is in schedule mode by default) ?

Thanks!

Help with Poller

My use case is fairly simple. I want to query my two Heat Pumps periodically (every 5 seconds or so) and see what state they are in (heating/cooling/standby) and what the physical characteristics are of the units and the zones they are supporting. There are a total of 2 S30 thermostats and additional slave thermostat that gives a total of 3 zones. I do not want to control or set anything. I want to do all of this locally (not via the cloud).

It would appear that the poller would meet my needs at first glance but I am having some issues getting the results I expect and could use some guidance.

  1. It appears that when you refactored the systemList and zoneList you did not update the poller samples. NBD as it was easy to fix.
  2. Since I only want to try the poller demo I commented out the "cloud_message_pump_task" and "command_reader_task" from the test_async_local.py file. This left me without a connection to the equipment so I copied "await s30api.serverConnect()" and placed it at the top of the poller routine. That does seem to connect to the S30
  3. But when I try to get any value other than the sysID its None or blank. login Success homes [1] systems [1]
  4. Iterating through the zones I get only 1 (should have 2 in this connection) and all the fields are blank.
  5. Lastly - and something to worry about once the above is addressed, how do I get the other S30 that is a different system? Do I need to log off and do the same process with it or create two versions of the s30api variable, one for each system?

Log
2023-07-16 10:42:58,793 [MainThread ] [DEBUG] serverConnect - Entering
2023-07-16 10:42:58,793 [MainThread ] [DEBUG] Closing Session
2023-07-16 10:42:58,793 [MainThread ] [DEBUG] Creating Session
2023-07-16 10:42:58,794 [MainThread ] [DEBUG] authenticate - Enter
2023-07-16 10:42:58,794 [MainThread ] [DEBUG] login - Enter
2023-07-16 10:42:58,942 [MainThread ] [INFO ] Creating lennox_home homeId [local]
2023-07-16 10:42:58,942 [MainThread ] [INFO ] Updating lennox_home homeIdx [0 homeId [local] homeName [local]
2023-07-16 10:42:58,943 [MainThread ] [INFO ] Creating lennox_system sysId [LCC]
2023-07-16 10:42:58,943 [MainThread ] [INFO ] Update lennox_system idx [0] sysId [LCC]
2023-07-16 10:42:58,943 [MainThread ] [INFO ] login Success homes [1] systems [1]
2023-07-16 10:42:58,943 [MainThread ] [DEBUG] Negotiate - Enter
2023-07-16 10:42:58,944 [MainThread ] [DEBUG] serverConnect - Complete
lsystem LCC
lsystem LCC
lsystem LCC
lsystem LCC

messagePump failed due to client response Error

@PeteRager Have you seen this one?

Message pump error (S30Exception(...), "messagePump failed due to client response error [https://192.168.1.224/Messages/Aesculus_Downstairs/Retrieve] ClientResponseError Error while executing request: [Content-Length can't be present with Transfer-Encoding:\n\n b'4B\\r'\n ^]: error=<class 'aiohttp.client_exceptions.ClientResponseError'>, resp.status=[400], resp.request_info=[RequestInfo(url=URL('https://192.168.1.224/Messages/Aesculus_Downstairs/Retrieve?Direction=Oldest-to-Newest&MessageCount=10&StartTime=1&LongPollingTimeout=5'), method='GET', headers=<CIMultiDictProxy('Host': '192.168.1.224', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'User-Agent': 'Python/3.10 aiohttp/3.8.5')>, real_url=URL('https://192.168.1.224/Messages/Aesculus_Downstairs/Retrieve?Direction=Oldest-to-Newest&MessageCount=10&StartTime=1&LongPollingTimeout=5'))], resp.headers=[None]")

It was working fine for 3 days and suddenly it just started this on both of my S30's. Stopping and starting the Docker container resolved the problem.

EDIT: It appears it was only one S30. It is the one with two zones and this was the primary. Did not see any errors on the secondary but its data did not change so assume that it was not getting data either.

Target Temp When S30 Off

Just a caution. I did not notice this in the docs but in case its not there:

If you set the S30 function to Off, then the target temp returns Null on the message pump. If you don't trap this and try to convert it to an integer value then Python will error. I had this issue in my Influx write routine and it failed for all the zones that were attached to that S30, even the ones still operating.

Just something as simple as:
hvac["target_temp"] = int(zone.getTargetTemperatureF()) if zone.getTargetTemperatureF() else 0
fixed the error so all the other parameters could be written.

Support for using Celsius

The Lennox protocol has both Celsius and Fahrenheit data in it. This API does not full expose Celsius data for reading and support sending Celsius for setpoints.

Support for using Local Lan protocol

The current IOS App is able to communicate with the thermostat using the DDS protocol. It would be good to extend the API to support local LAN communication.

Local Lan - Detect changes

With a local connection, the S30 send zone status and outdoor temp frequently regardless of whether it changes or not. With the cloud connection only changes were sent. So to avoid lots of entity updates in HA, the integration / api will check for changes and only trigger updates when state has changed.

Help in Understand Diagnostic Mode

I need a bit of help in understanding the nuances of diagnostic mode. I had run some tests (100% Cooling) on my heat pumps and when I display the voltage and current in the message pump I am seeing the last values before I turned the test off?

2023-08-14 12:44:46,558 [MainThread ] [INFO ] [Core Residence] Temp [76] Humidity [45] SystemMode [cool] FanMode [auto] HumidityMode [dehumidify] Cool Setpoint [76] Heat Setpoint [68] tempOperation [off] Fan [False] Outdoor - Temp [92] Demand [0] Voltage [241.0] Current [12.801] relayServerConnected [True] internetStatus [True] SSR [False] Aux [False] Temp Status [good]

I went into HASS and turned diagnostic on for one unit and was able to see the values of current after the restart including a graph.

But oddly to me when I used the API to display what I expected to see the pump show current and voltage I got [None] for each.

2023-08-14 11:58:49,841 [MainThread ] [INFO ] [None] Temp [76] Humidity [46] SystemMode [cool] FanMode [auto] HumidityMode [off] Cool Setpoint [76] Heat Setpoint [68] tempOperation [cooling] Fan [False] Outdoor - Temp [93] Demand [97] Voltage [None] Current [None] relayServerConnected [None] internetStatus [None] SSR [False] Aux [False] Temp Status [good]

The other thing was that the zone.name was empty and when looking over the log I see that where normally it would display:

2023-08-14 12:34:02,454 [MainThread ] [INFO ] Creating lennox_zone id [0]
2023-08-14 12:34:02,457 [MainThread ] [INFO ] Creating lennox_zone id [1]
2023-08-14 12:34:02,458 [MainThread ] [INFO ] Creating lennox_zone id [2]
2023-08-14 12:34:02,459 [MainThread ] [INFO ] Creating lennox_zone id [3]
2023-08-14 12:34:06,024 [MainThread ] [INFO ] Creating lennox_zone id [0]
2023-08-14 12:34:06,027 [MainThread ] [INFO ] Creating lennox_zone id [1]
2023-08-14 12:34:06,034 [MainThread ] [INFO ] Creating lennox_zone id [2]
2023-08-14 12:34:06,035 [MainThread ] [INFO ] Creating lennox_zone id [3]

There was only this one:
2023-08-14 11:58:43,770 [MainThread ] [INFO ] Creating lennox_zone id [1]

So is there a conflict between running HASS and using the API at the same time and if I manually enabled the diagnostic it would have worked ok? Or am I missing something else?

A Small Nit Question for Elapsed Time

I have 5 variables (the amount of time the system is cooling, heating, aux heat, fan and off). These are supposed to be 1 minute long each but they can vary a bit, and when the system has to be restarted a minute or more can go by without data so the numbers can often not add up to the value of $timeFilter.

I would like to replace the Off value with a calculated value where the other 4 variables are subtracted from the $timeFilter duration and it becomes the new Off value.

Where and how would I do this? Right now in my query I get each variable from a Select and at bit of math:

sum(cooling)/60 AS "Cooling" FROM "HD21E10576_1_T" WHERE $timeFilter;

Likewise for Heating, Fan and Aux

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.