lennoxs30api 0.0.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lennoxS30api-0.0.3/LICENSE +21 -0
- lennoxS30api-0.0.3/PKG-INFO +77 -0
- lennoxS30api-0.0.3/README.md +60 -0
- lennoxS30api-0.0.3/lennoxS30api.egg-info/PKG-INFO +77 -0
- lennoxS30api-0.0.3/lennoxS30api.egg-info/SOURCES.txt +15 -0
- lennoxS30api-0.0.3/lennoxS30api.egg-info/dependency_links.txt +1 -0
- lennoxS30api-0.0.3/lennoxS30api.egg-info/requires.txt +1 -0
- lennoxS30api-0.0.3/lennoxS30api.egg-info/top_level.txt +1 -0
- lennoxS30api-0.0.3/lennoxs30api/__init__.py +6 -0
- lennoxS30api-0.0.3/lennoxs30api/lennox_home.py +20 -0
- lennoxS30api-0.0.3/lennoxs30api/lennox_period.py +46 -0
- lennoxS30api-0.0.3/lennoxs30api/lennox_schedule.py +36 -0
- lennoxS30api-0.0.3/lennoxs30api/metrics.py +88 -0
- lennoxS30api-0.0.3/lennoxs30api/s30api_async.py +1104 -0
- lennoxS30api-0.0.3/lennoxs30api/s30exception.py +24 -0
- lennoxS30api-0.0.3/setup.cfg +4 -0
- lennoxS30api-0.0.3/setup.py +24 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2018 Jacob Southard
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: lennoxS30api
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: API Wrapper for Lennox 30 Cloud
|
|
5
|
+
Home-page: https://github.com/thevoltagesource/myicomfort
|
|
6
|
+
Author: Pete Sage
|
|
7
|
+
Author-email: pete.saged@icloud.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
|
|
16
|
+
# PyPI - lennoxs30api
|
|
17
|
+
### API Wrapper for www.lennoxicomfort.com
|
|
18
|
+
|
|
19
|
+
By Pete Sage ()
|
|
20
|
+
|
|
21
|
+
Note: I'm working on a major refactor of this module and a push to PyPI.
|
|
22
|
+
|
|
23
|
+
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
|
|
24
|
+
supported by this project: https://github.com/thevoltagesource/myicomfort
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
This module is currently in test and prototype mode; as such it is not recommended at this time to build an application on-top of the API, as the API may change.
|
|
28
|
+
|
|
29
|
+
This module provides a command line test program; that can be used to exercise the main functions and create diagnostic output files to futher enhance and fix issues with the API
|
|
30
|
+
|
|
31
|
+
Current state - Tested with a single Zone S30 Air Conditioning System
|
|
32
|
+
|
|
33
|
+
Known Issues - Passwords with & will not work.
|
|
34
|
+
|
|
35
|
+
Prerequistes:
|
|
36
|
+
|
|
37
|
+
1. Python version 3.8.6 or later
|
|
38
|
+
|
|
39
|
+
2. A Lennox sign-on (email address and password)
|
|
40
|
+
|
|
41
|
+
3. You may need to install aiohttp https://docs.aiohttp.org/en/stable/
|
|
42
|
+
|
|
43
|
+
Install Instructions:
|
|
44
|
+
|
|
45
|
+
1. Grab the repo
|
|
46
|
+
|
|
47
|
+
2. Edit the test_async.py program to supply the following
|
|
48
|
+
|
|
49
|
+
LOG_PATH = '/home/pete/lennoxs30api' # Directoy to stash the log file in
|
|
50
|
+
|
|
51
|
+
EMAIL_ADDRESS = 'myemail@myemail.com'
|
|
52
|
+
|
|
53
|
+
PASSWORD = 'mypassword'
|
|
54
|
+
|
|
55
|
+
Command Line Program Instructions:
|
|
56
|
+
|
|
57
|
+
The command line program uses asyncio and runs 3 different tasks
|
|
58
|
+
|
|
59
|
+
- Task 1 (runner) - this task connects to the cloud API and periodically polls it at a 10 second interval
|
|
60
|
+
|
|
61
|
+
- Task 2 (poller) - this task runs on a 15 second interval and prints out information from all active Zones
|
|
62
|
+
|
|
63
|
+
- Task 3 (prompt) - this task reads from the command line and executes commands on behalf of the user to enabling API testing. Cmd List
|
|
64
|
+
|
|
65
|
+
cool, heat, off - sets the HVAC mode to cool, heat or off. usage - just type the word followed by enter eg cool
|
|
66
|
+
|
|
67
|
+
auto, on, circulate - sets the Fan mocde to auto, on, or ciruclate
|
|
68
|
+
|
|
69
|
+
csp <TempF> - sets the cool setpoint in F. example csp 76
|
|
70
|
+
|
|
71
|
+
hsp <TempF> - sets the heat setpoint in F. example hsp 65
|
|
72
|
+
|
|
73
|
+
To exit the program hit crtl-c
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# PyPI - lennoxs30api
|
|
2
|
+
### API Wrapper for www.lennoxicomfort.com
|
|
3
|
+
|
|
4
|
+
By Pete Sage ()
|
|
5
|
+
|
|
6
|
+
Note: I'm working on a major refactor of this module and a push to PyPI.
|
|
7
|
+
|
|
8
|
+
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
|
|
9
|
+
supported by this project: https://github.com/thevoltagesource/myicomfort
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
This module is currently in test and prototype mode; as such it is not recommended at this time to build an application on-top of the API, as the API may change.
|
|
13
|
+
|
|
14
|
+
This module provides a command line test program; that can be used to exercise the main functions and create diagnostic output files to futher enhance and fix issues with the API
|
|
15
|
+
|
|
16
|
+
Current state - Tested with a single Zone S30 Air Conditioning System
|
|
17
|
+
|
|
18
|
+
Known Issues - Passwords with & will not work.
|
|
19
|
+
|
|
20
|
+
Prerequistes:
|
|
21
|
+
|
|
22
|
+
1. Python version 3.8.6 or later
|
|
23
|
+
|
|
24
|
+
2. A Lennox sign-on (email address and password)
|
|
25
|
+
|
|
26
|
+
3. You may need to install aiohttp https://docs.aiohttp.org/en/stable/
|
|
27
|
+
|
|
28
|
+
Install Instructions:
|
|
29
|
+
|
|
30
|
+
1. Grab the repo
|
|
31
|
+
|
|
32
|
+
2. Edit the test_async.py program to supply the following
|
|
33
|
+
|
|
34
|
+
LOG_PATH = '/home/pete/lennoxs30api' # Directoy to stash the log file in
|
|
35
|
+
|
|
36
|
+
EMAIL_ADDRESS = 'myemail@myemail.com'
|
|
37
|
+
|
|
38
|
+
PASSWORD = 'mypassword'
|
|
39
|
+
|
|
40
|
+
Command Line Program Instructions:
|
|
41
|
+
|
|
42
|
+
The command line program uses asyncio and runs 3 different tasks
|
|
43
|
+
|
|
44
|
+
- Task 1 (runner) - this task connects to the cloud API and periodically polls it at a 10 second interval
|
|
45
|
+
|
|
46
|
+
- Task 2 (poller) - this task runs on a 15 second interval and prints out information from all active Zones
|
|
47
|
+
|
|
48
|
+
- Task 3 (prompt) - this task reads from the command line and executes commands on behalf of the user to enabling API testing. Cmd List
|
|
49
|
+
|
|
50
|
+
cool, heat, off - sets the HVAC mode to cool, heat or off. usage - just type the word followed by enter eg cool
|
|
51
|
+
|
|
52
|
+
auto, on, circulate - sets the Fan mocde to auto, on, or ciruclate
|
|
53
|
+
|
|
54
|
+
csp <TempF> - sets the cool setpoint in F. example csp 76
|
|
55
|
+
|
|
56
|
+
hsp <TempF> - sets the heat setpoint in F. example hsp 65
|
|
57
|
+
|
|
58
|
+
To exit the program hit crtl-c
|
|
59
|
+
|
|
60
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: lennoxS30api
|
|
3
|
+
Version: 0.0.3
|
|
4
|
+
Summary: API Wrapper for Lennox 30 Cloud
|
|
5
|
+
Home-page: https://github.com/thevoltagesource/myicomfort
|
|
6
|
+
Author: Pete Sage
|
|
7
|
+
Author-email: pete.saged@icloud.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
|
|
16
|
+
# PyPI - lennoxs30api
|
|
17
|
+
### API Wrapper for www.lennoxicomfort.com
|
|
18
|
+
|
|
19
|
+
By Pete Sage ()
|
|
20
|
+
|
|
21
|
+
Note: I'm working on a major refactor of this module and a push to PyPI.
|
|
22
|
+
|
|
23
|
+
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
|
|
24
|
+
supported by this project: https://github.com/thevoltagesource/myicomfort
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
This module is currently in test and prototype mode; as such it is not recommended at this time to build an application on-top of the API, as the API may change.
|
|
28
|
+
|
|
29
|
+
This module provides a command line test program; that can be used to exercise the main functions and create diagnostic output files to futher enhance and fix issues with the API
|
|
30
|
+
|
|
31
|
+
Current state - Tested with a single Zone S30 Air Conditioning System
|
|
32
|
+
|
|
33
|
+
Known Issues - Passwords with & will not work.
|
|
34
|
+
|
|
35
|
+
Prerequistes:
|
|
36
|
+
|
|
37
|
+
1. Python version 3.8.6 or later
|
|
38
|
+
|
|
39
|
+
2. A Lennox sign-on (email address and password)
|
|
40
|
+
|
|
41
|
+
3. You may need to install aiohttp https://docs.aiohttp.org/en/stable/
|
|
42
|
+
|
|
43
|
+
Install Instructions:
|
|
44
|
+
|
|
45
|
+
1. Grab the repo
|
|
46
|
+
|
|
47
|
+
2. Edit the test_async.py program to supply the following
|
|
48
|
+
|
|
49
|
+
LOG_PATH = '/home/pete/lennoxs30api' # Directoy to stash the log file in
|
|
50
|
+
|
|
51
|
+
EMAIL_ADDRESS = 'myemail@myemail.com'
|
|
52
|
+
|
|
53
|
+
PASSWORD = 'mypassword'
|
|
54
|
+
|
|
55
|
+
Command Line Program Instructions:
|
|
56
|
+
|
|
57
|
+
The command line program uses asyncio and runs 3 different tasks
|
|
58
|
+
|
|
59
|
+
- Task 1 (runner) - this task connects to the cloud API and periodically polls it at a 10 second interval
|
|
60
|
+
|
|
61
|
+
- Task 2 (poller) - this task runs on a 15 second interval and prints out information from all active Zones
|
|
62
|
+
|
|
63
|
+
- Task 3 (prompt) - this task reads from the command line and executes commands on behalf of the user to enabling API testing. Cmd List
|
|
64
|
+
|
|
65
|
+
cool, heat, off - sets the HVAC mode to cool, heat or off. usage - just type the word followed by enter eg cool
|
|
66
|
+
|
|
67
|
+
auto, on, circulate - sets the Fan mocde to auto, on, or ciruclate
|
|
68
|
+
|
|
69
|
+
csp <TempF> - sets the cool setpoint in F. example csp 76
|
|
70
|
+
|
|
71
|
+
hsp <TempF> - sets the heat setpoint in F. example hsp 65
|
|
72
|
+
|
|
73
|
+
To exit the program hit crtl-c
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
lennoxS30api.egg-info/PKG-INFO
|
|
5
|
+
lennoxS30api.egg-info/SOURCES.txt
|
|
6
|
+
lennoxS30api.egg-info/dependency_links.txt
|
|
7
|
+
lennoxS30api.egg-info/requires.txt
|
|
8
|
+
lennoxS30api.egg-info/top_level.txt
|
|
9
|
+
lennoxs30api/__init__.py
|
|
10
|
+
lennoxs30api/lennox_home.py
|
|
11
|
+
lennoxs30api/lennox_period.py
|
|
12
|
+
lennoxs30api/lennox_schedule.py
|
|
13
|
+
lennoxs30api/metrics.py
|
|
14
|
+
lennoxs30api/s30api_async.py
|
|
15
|
+
lennoxs30api/s30exception.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aiohttp
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
lennoxs30api
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
_LOGGER = logging.getLogger(__name__)
|
|
5
|
+
|
|
6
|
+
class lennox_home(object):
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def __init__(self, homeId:int):
|
|
10
|
+
self.id:int = homeId
|
|
11
|
+
self.idx: int = None
|
|
12
|
+
self.name: str = None
|
|
13
|
+
self.json: json = None
|
|
14
|
+
_LOGGER.info(f"Creating lennox_home homeId [{self.id}]")
|
|
15
|
+
|
|
16
|
+
def update(self, homeIdx:int, homeName:str, json:json) -> None:
|
|
17
|
+
self.idx = homeIdx
|
|
18
|
+
self.name = homeName
|
|
19
|
+
self.json = json
|
|
20
|
+
_LOGGER.info(f"Updating lennox_home homeIdx [{str(self.idx)} homeId [{self.id}] homeName [{self.name}] json [{str(json)}]")
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
class lennox_period(object):
|
|
2
|
+
def __init__(self, id):
|
|
3
|
+
self.id = id
|
|
4
|
+
self.enabled = False
|
|
5
|
+
self.startTime = None
|
|
6
|
+
self.systemMode = None
|
|
7
|
+
self.hsp = None
|
|
8
|
+
self.hspC = None
|
|
9
|
+
self.csp = None
|
|
10
|
+
self.cspC = None
|
|
11
|
+
self.sp = None
|
|
12
|
+
self.spC = None
|
|
13
|
+
self.humidityMode = None
|
|
14
|
+
self.husp = None
|
|
15
|
+
self.desp = None
|
|
16
|
+
self.fanMode = None
|
|
17
|
+
|
|
18
|
+
def update(self, periods):
|
|
19
|
+
if 'enabled' in periods:
|
|
20
|
+
self.enabled = periods['enabled']
|
|
21
|
+
if 'period' in periods:
|
|
22
|
+
period = periods['period']
|
|
23
|
+
if 'startTime' in period:
|
|
24
|
+
self.startTime = period['startTime']
|
|
25
|
+
if 'systemMode' in period:
|
|
26
|
+
self.systemMode = period['systemMode']
|
|
27
|
+
if 'hsp' in period:
|
|
28
|
+
self.hsp = period['hsp']
|
|
29
|
+
if 'hspC' in period:
|
|
30
|
+
self.hspC = period['hspC']
|
|
31
|
+
if 'csp' in period:
|
|
32
|
+
self.csp = period['csp']
|
|
33
|
+
if 'cspC' in period:
|
|
34
|
+
self.cspC = period['cspC']
|
|
35
|
+
if 'sp' in period:
|
|
36
|
+
self.sp = period['sp']
|
|
37
|
+
if 'spC' in period:
|
|
38
|
+
self.spC = period['spC']
|
|
39
|
+
if 'humidityMode' in period:
|
|
40
|
+
self.humidityMode = period['humidityMode']
|
|
41
|
+
if 'husp' in period:
|
|
42
|
+
self.husp = period['husp']
|
|
43
|
+
if 'desp' in period:
|
|
44
|
+
self.desp = period['desp']
|
|
45
|
+
if 'fanMode' in period:
|
|
46
|
+
self.fanMode = period['fanMode']
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from .lennox_period import lennox_period
|
|
2
|
+
|
|
3
|
+
class lennox_schedule(object):
|
|
4
|
+
def __init__(self, id):
|
|
5
|
+
self.id = id
|
|
6
|
+
self.name = '<Unknown>'
|
|
7
|
+
self.periodCount = -1
|
|
8
|
+
self._periods = []
|
|
9
|
+
|
|
10
|
+
def getOrCreatePeriod(self, id):
|
|
11
|
+
item = self.getPeriod(id)
|
|
12
|
+
if item != None:
|
|
13
|
+
return item
|
|
14
|
+
item = lennox_period(id)
|
|
15
|
+
self._periods.append(item)
|
|
16
|
+
return item
|
|
17
|
+
|
|
18
|
+
def getPeriod(self, id):
|
|
19
|
+
for item in self._periods:
|
|
20
|
+
if item.id == id:
|
|
21
|
+
return item
|
|
22
|
+
return None
|
|
23
|
+
|
|
24
|
+
def update(self, tschedule):
|
|
25
|
+
if 'schedule' not in tschedule:
|
|
26
|
+
return
|
|
27
|
+
schedule = tschedule['schedule']
|
|
28
|
+
if 'name' in schedule:
|
|
29
|
+
self.name = schedule['name']
|
|
30
|
+
if 'periodCount' in schedule:
|
|
31
|
+
self.periodCount = schedule['periodCount']
|
|
32
|
+
if 'periods' in schedule:
|
|
33
|
+
for periods in schedule['periods']:
|
|
34
|
+
periodId = periods['id']
|
|
35
|
+
lperiod = self.getOrCreatePeriod(periodId)
|
|
36
|
+
lperiod.update(periods)
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
class Metrics:
|
|
4
|
+
def __init__(self):
|
|
5
|
+
self.error_count: int = 0
|
|
6
|
+
|
|
7
|
+
self.message_count: int = 0
|
|
8
|
+
self.receive_count: int = 0
|
|
9
|
+
self.send_count: int = 0
|
|
10
|
+
|
|
11
|
+
self.http_2xx_cnt: int = 0
|
|
12
|
+
self.http_4xx_cnt: int = 0
|
|
13
|
+
self.http_5xx_cnt: int = 0
|
|
14
|
+
|
|
15
|
+
self.last_receive_time: datetime = None
|
|
16
|
+
self.last_send_time: datetime = None
|
|
17
|
+
self.last_error_time: datetime = None
|
|
18
|
+
self.last_reconnect_time: datetime = None
|
|
19
|
+
self.last_message_time: datetime = None
|
|
20
|
+
self.last_metric_time: datetime = None
|
|
21
|
+
|
|
22
|
+
self.bytes_in: int = 0
|
|
23
|
+
self.bytes_out: int = 0
|
|
24
|
+
|
|
25
|
+
def getMetricList(self):
|
|
26
|
+
return(
|
|
27
|
+
{
|
|
28
|
+
"message_count" : self.message_count,
|
|
29
|
+
"send_count" : self.send_count,
|
|
30
|
+
"receive_count" : self.receive_count,
|
|
31
|
+
"bytes_in" : self.bytes_in,
|
|
32
|
+
"bytes_out" : self.bytes_out,
|
|
33
|
+
"error_count" : self.error_count,
|
|
34
|
+
"http_2xx_cnt" : self.http_2xx_cnt,
|
|
35
|
+
"http_4xx_cnt" : self.http_4xx_cnt,
|
|
36
|
+
"http_5xx_cnt" : self.http_5xx_cnt,
|
|
37
|
+
"last_receive_time" : self.last_receive_time,
|
|
38
|
+
"last_error_time" : self.last_error_time,
|
|
39
|
+
"last_reconnect_time" : self.last_reconnect_time,
|
|
40
|
+
"last_message_time" : self.last_message_time,
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def inc_message_count(self) -> None:
|
|
45
|
+
self.message_count += 1
|
|
46
|
+
self.last_message_time = datetime.now()
|
|
47
|
+
self.last_metric_time = datetime.now()
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def inc_send_count(self, bytes: int) -> None:
|
|
51
|
+
self.send_count += 1
|
|
52
|
+
self.last_send_time = datetime.now()
|
|
53
|
+
self.last_metric_time = datetime.now()
|
|
54
|
+
self.bytes_out += bytes
|
|
55
|
+
|
|
56
|
+
def inc_receive_count(self) -> None:
|
|
57
|
+
self.receive_count += 1
|
|
58
|
+
self.last_receive_time = datetime.now()
|
|
59
|
+
self.last_metric_time = datetime.now()
|
|
60
|
+
|
|
61
|
+
def inc_receive_bytes(self, bytes: int) -> None:
|
|
62
|
+
if bytes != None:
|
|
63
|
+
self.bytes_in += bytes
|
|
64
|
+
|
|
65
|
+
def inc_receive_message_error(self) -> None:
|
|
66
|
+
self.receive_message_error += 1
|
|
67
|
+
self.last_error_time = datetime.now()
|
|
68
|
+
self.last_metric_time = datetime.now()
|
|
69
|
+
self.error_count += 1
|
|
70
|
+
|
|
71
|
+
def process_http_code(self, http_code:int) -> None:
|
|
72
|
+
self.last_metric_time = datetime.now()
|
|
73
|
+
if http_code >= 200 and http_code <= 299:
|
|
74
|
+
self.http_2xx_cnt += 1
|
|
75
|
+
return
|
|
76
|
+
|
|
77
|
+
self.error_count += 1
|
|
78
|
+
if http_code >= 400 and http_code <= 499:
|
|
79
|
+
self.http_4xx_cnt += 1
|
|
80
|
+
self.error_count += 1
|
|
81
|
+
elif http_code >= 500 and http_code <= 599:
|
|
82
|
+
self.http_5xx_cnt += 1
|
|
83
|
+
self.error_count += 1
|
|
84
|
+
|
|
85
|
+
self.last_error_time = datetime.now()
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|