pyintellicenter 0.0.1__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.
@@ -0,0 +1,99 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ *.egg-info/
24
+ .installed.cfg
25
+ *.egg
26
+
27
+ # PyInstaller
28
+ *.manifest
29
+ *.spec
30
+
31
+ # Installer logs
32
+ pip-log.txt
33
+ pip-delete-this-directory.txt
34
+
35
+ # Unit test / coverage reports
36
+ htmlcov/
37
+ .tox/
38
+ .nox/
39
+ .coverage
40
+ .coverage.*
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+ *.cover
45
+ *.py,cover
46
+ .hypothesis/
47
+ .pytest_cache/
48
+ pytest_cache/
49
+
50
+ # Translations
51
+ *.mo
52
+ *.pot
53
+
54
+ # Environments
55
+ .env
56
+ .venv
57
+ env/
58
+ venv/
59
+ ENV/
60
+ env.bak/
61
+ venv.bak/
62
+
63
+ # Spyder project settings
64
+ .spyderproject
65
+ .spyproject
66
+
67
+ # Rope project settings
68
+ .ropeproject
69
+
70
+ # mkdocs documentation
71
+ /site
72
+
73
+ # mypy
74
+ .mypy_cache/
75
+ .dmypy.json
76
+ dmypy.json
77
+
78
+ # Pyre type checker
79
+ .pyre/
80
+
81
+ # pytype static type analyzer
82
+ .pytype/
83
+
84
+ # Cython debug symbols
85
+ cython_debug/
86
+
87
+ # IDE
88
+ .idea/
89
+ .vscode/
90
+ *.swp
91
+ *.swo
92
+ *~
93
+
94
+ # OS
95
+ .DS_Store
96
+ Thumbs.db
97
+
98
+ # Project specific
99
+ *.log
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 joyfulhouse
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,260 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyintellicenter
3
+ Version: 0.0.1
4
+ Summary: Python library for Pentair IntelliCenter pool control systems
5
+ Project-URL: Homepage, https://github.com/joyfulhouse/pyintellicenter
6
+ Project-URL: Documentation, https://github.com/joyfulhouse/pyintellicenter#readme
7
+ Project-URL: Repository, https://github.com/joyfulhouse/pyintellicenter.git
8
+ Project-URL: Issues, https://github.com/joyfulhouse/pyintellicenter/issues
9
+ Author-email: joyfulhouse <joyfulhouse@users.noreply.github.com>
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: asyncio,automation,home-assistant,intellicenter,pentair,pool
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Framework :: AsyncIO
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Home Automation
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.11
26
+ Requires-Dist: orjson>=3.11.4
27
+ Provides-Extra: dev
28
+ Requires-Dist: mypy>=1.18.2; extra == 'dev'
29
+ Requires-Dist: pytest-asyncio>=1.3.0; extra == 'dev'
30
+ Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
31
+ Requires-Dist: pytest>=9.0.1; extra == 'dev'
32
+ Requires-Dist: ruff>=0.14.6; extra == 'dev'
33
+ Description-Content-Type: text/markdown
34
+
35
+ # pyintellicenter
36
+
37
+ [![PyPI version](https://badge.fury.io/py/pyintellicenter.svg)](https://badge.fury.io/py/pyintellicenter)
38
+ [![Python Versions](https://img.shields.io/pypi/pyversions/pyintellicenter.svg)](https://pypi.org/project/pyintellicenter/)
39
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
40
+
41
+ Python library for communicating with Pentair IntelliCenter pool control systems over local network.
42
+
43
+ ## Features
44
+
45
+ - **Local Communication**: Direct TCP connection to IntelliCenter (no cloud required)
46
+ - **Real-time Updates**: Push-based notifications via NotifyList protocol
47
+ - **Async/Await**: Built on Python asyncio for efficient I/O
48
+ - **Type Annotations**: Full type hints for IDE support and static analysis
49
+ - **Robust Connection Handling**: Automatic reconnection with exponential backoff
50
+ - **Production Ready**: Circuit breaker pattern, connection metrics, comprehensive error handling
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install pyintellicenter
56
+ ```
57
+
58
+ Or install from GitHub:
59
+
60
+ ```bash
61
+ pip install git+https://github.com/joyfulhouse/pyintellicenter.git
62
+ ```
63
+
64
+ ## Requirements
65
+
66
+ - Python 3.11+
67
+ - Pentair IntelliCenter controller (i5P, i7P, i9P, or i10P)
68
+ - Local network access to IntelliCenter (TCP port 6681)
69
+
70
+ ## Quick Start
71
+
72
+ ```python
73
+ import asyncio
74
+ from pyintellicenter import ModelController, PoolModel, ConnectionHandler
75
+
76
+ async def main():
77
+ # Create a model to hold equipment state
78
+ model = PoolModel()
79
+
80
+ # Create controller connected to your IntelliCenter
81
+ controller = ModelController("192.168.1.100", model)
82
+
83
+ # Use ConnectionHandler for automatic reconnection
84
+ handler = ConnectionHandler(controller)
85
+ await handler.start()
86
+
87
+ # Access system information
88
+ print(f"Connected to: {controller.systemInfo.propName}")
89
+ print(f"Software version: {controller.systemInfo.swVersion}")
90
+
91
+ # List all equipment
92
+ for obj in model:
93
+ print(f"{obj.sname} ({obj.objtype}): {obj.status}")
94
+
95
+ # Control equipment
96
+ pool = model.getByType("BODY", "POOL")[0]
97
+ controller.requestChanges(pool.objnam, {"STATUS": "ON"})
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ ## Architecture
103
+
104
+ The library is organized in layers:
105
+
106
+ ### Protocol Layer (`protocol.py`)
107
+ - `ICProtocol`: Low-level asyncio protocol handling TCP communication
108
+ - JSON message framing (messages terminated with `\r\n`)
109
+ - Flow control (one request at a time)
110
+ - Keepalive queries for connection health
111
+
112
+ ### Controller Layer (`controller.py`)
113
+ - `BaseController`: Basic connection and command handling
114
+ - `ModelController`: State management with PoolModel
115
+ - `ConnectionHandler`: Automatic reconnection with exponential backoff
116
+ - `SystemInfo`: System metadata (version, units, unique ID)
117
+ - `ConnectionMetrics`: Request/response statistics
118
+
119
+ ### Model Layer (`model.py`)
120
+ - `PoolModel`: Collection of pool equipment objects
121
+ - `PoolObject`: Individual equipment item (pump, light, heater, etc.)
122
+
123
+ ### Attributes (`attributes.py`)
124
+ - Type and attribute constants for all equipment types
125
+ - `BODY_TYPE`, `PUMP_TYPE`, `CIRCUIT_TYPE`, etc.
126
+ - `STATUS_ATTR`, `SNAME_ATTR`, `OBJTYP_ATTR`, etc.
127
+
128
+ ## API Reference
129
+
130
+ ### ModelController
131
+
132
+ ```python
133
+ controller = ModelController(
134
+ host="192.168.1.100", # IntelliCenter IP address
135
+ model=PoolModel(), # Model to populate
136
+ port=6681, # TCP port (default: 6681)
137
+ keepalive_interval=90, # Keepalive query interval in seconds
138
+ )
139
+
140
+ # Start connection and populate model
141
+ await controller.start()
142
+
143
+ # Send changes to equipment
144
+ controller.requestChanges(objnam, {"STATUS": "ON"})
145
+
146
+ # Access system info
147
+ info = controller.systemInfo
148
+ print(info.propName, info.swVersion, info.usesMetric)
149
+ ```
150
+
151
+ ### ConnectionHandler
152
+
153
+ ```python
154
+ handler = ConnectionHandler(
155
+ controller,
156
+ timeBetweenReconnects=30, # Initial reconnect delay (seconds)
157
+ disconnectDebounceTime=15, # Grace period before marking disconnected
158
+ )
159
+
160
+ # Start with automatic reconnection
161
+ await handler.start()
162
+
163
+ # Stop and cleanup
164
+ handler.stop()
165
+ ```
166
+
167
+ ### PoolModel
168
+
169
+ ```python
170
+ model = PoolModel()
171
+
172
+ # Iterate all objects
173
+ for obj in model:
174
+ print(obj.sname)
175
+
176
+ # Get by type
177
+ bodies = model.getByType("BODY")
178
+ pool = model.getByType("BODY", "POOL")[0]
179
+ pumps = model.getByType("PUMP")
180
+
181
+ # Get by object name
182
+ obj = model["POOL1"]
183
+
184
+ # Get children of an object
185
+ children = model.getChildren(panel)
186
+ ```
187
+
188
+ ### PoolObject
189
+
190
+ ```python
191
+ obj = model["PUMP1"]
192
+
193
+ # Properties
194
+ obj.objnam # Object name (e.g., "PUMP1")
195
+ obj.sname # Friendly name (e.g., "Pool Pump")
196
+ obj.objtype # Object type (e.g., "PUMP")
197
+ obj.subtype # Subtype (e.g., "VSF")
198
+ obj.status # Current status
199
+
200
+ # Check type
201
+ obj.isALight # Is this a light?
202
+ obj.isALightShow # Is this a light show?
203
+ obj.isFeatured # Is this featured?
204
+ obj.supportColorEffects # Supports color effects?
205
+
206
+ # Access attributes
207
+ rpm = obj["RPM"]
208
+ power = obj["PWR"]
209
+ ```
210
+
211
+ ## Equipment Types
212
+
213
+ | Type | Description | Common Subtypes |
214
+ |------|-------------|-----------------|
215
+ | `BODY` | Body of water | `POOL`, `SPA` |
216
+ | `PUMP` | Pump | `SPEED`, `FLOW`, `VSF` |
217
+ | `CIRCUIT` | Circuit/Feature | `LIGHT`, `INTELLI`, `GLOW`, `DIMMER` |
218
+ | `HEATER` | Heater | `GENERIC`, `SOLAR`, `ULTRA` |
219
+ | `CHEM` | Chemistry | `ICHLOR`, `ICHEM` |
220
+ | `SENSE` | Sensor | `POOL`, `AIR`, `SOLAR` |
221
+ | `SCHED` | Schedule | - |
222
+
223
+ ## Connection Behavior
224
+
225
+ The library implements robust connection handling:
226
+
227
+ 1. **Initial Connection**: Connects and fetches system info + all equipment
228
+ 2. **Keepalive**: Sends lightweight queries every 90 seconds (configurable)
229
+ 3. **Push Updates**: Receives real-time NotifyList updates from IntelliCenter
230
+ 4. **Reconnection**: Exponential backoff starting at 30 seconds (configurable)
231
+ 5. **Circuit Breaker**: Pauses after 5 consecutive failures
232
+
233
+ ## Development
234
+
235
+ ```bash
236
+ # Clone repository
237
+ git clone https://github.com/joyfulhouse/pyintellicenter.git
238
+ cd pyintellicenter
239
+
240
+ # Install with dev dependencies
241
+ pip install -e ".[dev]"
242
+
243
+ # Run tests
244
+ pytest
245
+
246
+ # Run linting
247
+ ruff check src tests
248
+ ruff format src tests
249
+
250
+ # Run type checking
251
+ mypy src
252
+ ```
253
+
254
+ ## License
255
+
256
+ MIT License - see [LICENSE](LICENSE) for details.
257
+
258
+ ## Related Projects
259
+
260
+ - [intellicenter](https://github.com/joyfulhouse/intellicenter) - Home Assistant integration using this library
@@ -0,0 +1,226 @@
1
+ # pyintellicenter
2
+
3
+ [![PyPI version](https://badge.fury.io/py/pyintellicenter.svg)](https://badge.fury.io/py/pyintellicenter)
4
+ [![Python Versions](https://img.shields.io/pypi/pyversions/pyintellicenter.svg)](https://pypi.org/project/pyintellicenter/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Python library for communicating with Pentair IntelliCenter pool control systems over local network.
8
+
9
+ ## Features
10
+
11
+ - **Local Communication**: Direct TCP connection to IntelliCenter (no cloud required)
12
+ - **Real-time Updates**: Push-based notifications via NotifyList protocol
13
+ - **Async/Await**: Built on Python asyncio for efficient I/O
14
+ - **Type Annotations**: Full type hints for IDE support and static analysis
15
+ - **Robust Connection Handling**: Automatic reconnection with exponential backoff
16
+ - **Production Ready**: Circuit breaker pattern, connection metrics, comprehensive error handling
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install pyintellicenter
22
+ ```
23
+
24
+ Or install from GitHub:
25
+
26
+ ```bash
27
+ pip install git+https://github.com/joyfulhouse/pyintellicenter.git
28
+ ```
29
+
30
+ ## Requirements
31
+
32
+ - Python 3.11+
33
+ - Pentair IntelliCenter controller (i5P, i7P, i9P, or i10P)
34
+ - Local network access to IntelliCenter (TCP port 6681)
35
+
36
+ ## Quick Start
37
+
38
+ ```python
39
+ import asyncio
40
+ from pyintellicenter import ModelController, PoolModel, ConnectionHandler
41
+
42
+ async def main():
43
+ # Create a model to hold equipment state
44
+ model = PoolModel()
45
+
46
+ # Create controller connected to your IntelliCenter
47
+ controller = ModelController("192.168.1.100", model)
48
+
49
+ # Use ConnectionHandler for automatic reconnection
50
+ handler = ConnectionHandler(controller)
51
+ await handler.start()
52
+
53
+ # Access system information
54
+ print(f"Connected to: {controller.systemInfo.propName}")
55
+ print(f"Software version: {controller.systemInfo.swVersion}")
56
+
57
+ # List all equipment
58
+ for obj in model:
59
+ print(f"{obj.sname} ({obj.objtype}): {obj.status}")
60
+
61
+ # Control equipment
62
+ pool = model.getByType("BODY", "POOL")[0]
63
+ controller.requestChanges(pool.objnam, {"STATUS": "ON"})
64
+
65
+ asyncio.run(main())
66
+ ```
67
+
68
+ ## Architecture
69
+
70
+ The library is organized in layers:
71
+
72
+ ### Protocol Layer (`protocol.py`)
73
+ - `ICProtocol`: Low-level asyncio protocol handling TCP communication
74
+ - JSON message framing (messages terminated with `\r\n`)
75
+ - Flow control (one request at a time)
76
+ - Keepalive queries for connection health
77
+
78
+ ### Controller Layer (`controller.py`)
79
+ - `BaseController`: Basic connection and command handling
80
+ - `ModelController`: State management with PoolModel
81
+ - `ConnectionHandler`: Automatic reconnection with exponential backoff
82
+ - `SystemInfo`: System metadata (version, units, unique ID)
83
+ - `ConnectionMetrics`: Request/response statistics
84
+
85
+ ### Model Layer (`model.py`)
86
+ - `PoolModel`: Collection of pool equipment objects
87
+ - `PoolObject`: Individual equipment item (pump, light, heater, etc.)
88
+
89
+ ### Attributes (`attributes.py`)
90
+ - Type and attribute constants for all equipment types
91
+ - `BODY_TYPE`, `PUMP_TYPE`, `CIRCUIT_TYPE`, etc.
92
+ - `STATUS_ATTR`, `SNAME_ATTR`, `OBJTYP_ATTR`, etc.
93
+
94
+ ## API Reference
95
+
96
+ ### ModelController
97
+
98
+ ```python
99
+ controller = ModelController(
100
+ host="192.168.1.100", # IntelliCenter IP address
101
+ model=PoolModel(), # Model to populate
102
+ port=6681, # TCP port (default: 6681)
103
+ keepalive_interval=90, # Keepalive query interval in seconds
104
+ )
105
+
106
+ # Start connection and populate model
107
+ await controller.start()
108
+
109
+ # Send changes to equipment
110
+ controller.requestChanges(objnam, {"STATUS": "ON"})
111
+
112
+ # Access system info
113
+ info = controller.systemInfo
114
+ print(info.propName, info.swVersion, info.usesMetric)
115
+ ```
116
+
117
+ ### ConnectionHandler
118
+
119
+ ```python
120
+ handler = ConnectionHandler(
121
+ controller,
122
+ timeBetweenReconnects=30, # Initial reconnect delay (seconds)
123
+ disconnectDebounceTime=15, # Grace period before marking disconnected
124
+ )
125
+
126
+ # Start with automatic reconnection
127
+ await handler.start()
128
+
129
+ # Stop and cleanup
130
+ handler.stop()
131
+ ```
132
+
133
+ ### PoolModel
134
+
135
+ ```python
136
+ model = PoolModel()
137
+
138
+ # Iterate all objects
139
+ for obj in model:
140
+ print(obj.sname)
141
+
142
+ # Get by type
143
+ bodies = model.getByType("BODY")
144
+ pool = model.getByType("BODY", "POOL")[0]
145
+ pumps = model.getByType("PUMP")
146
+
147
+ # Get by object name
148
+ obj = model["POOL1"]
149
+
150
+ # Get children of an object
151
+ children = model.getChildren(panel)
152
+ ```
153
+
154
+ ### PoolObject
155
+
156
+ ```python
157
+ obj = model["PUMP1"]
158
+
159
+ # Properties
160
+ obj.objnam # Object name (e.g., "PUMP1")
161
+ obj.sname # Friendly name (e.g., "Pool Pump")
162
+ obj.objtype # Object type (e.g., "PUMP")
163
+ obj.subtype # Subtype (e.g., "VSF")
164
+ obj.status # Current status
165
+
166
+ # Check type
167
+ obj.isALight # Is this a light?
168
+ obj.isALightShow # Is this a light show?
169
+ obj.isFeatured # Is this featured?
170
+ obj.supportColorEffects # Supports color effects?
171
+
172
+ # Access attributes
173
+ rpm = obj["RPM"]
174
+ power = obj["PWR"]
175
+ ```
176
+
177
+ ## Equipment Types
178
+
179
+ | Type | Description | Common Subtypes |
180
+ |------|-------------|-----------------|
181
+ | `BODY` | Body of water | `POOL`, `SPA` |
182
+ | `PUMP` | Pump | `SPEED`, `FLOW`, `VSF` |
183
+ | `CIRCUIT` | Circuit/Feature | `LIGHT`, `INTELLI`, `GLOW`, `DIMMER` |
184
+ | `HEATER` | Heater | `GENERIC`, `SOLAR`, `ULTRA` |
185
+ | `CHEM` | Chemistry | `ICHLOR`, `ICHEM` |
186
+ | `SENSE` | Sensor | `POOL`, `AIR`, `SOLAR` |
187
+ | `SCHED` | Schedule | - |
188
+
189
+ ## Connection Behavior
190
+
191
+ The library implements robust connection handling:
192
+
193
+ 1. **Initial Connection**: Connects and fetches system info + all equipment
194
+ 2. **Keepalive**: Sends lightweight queries every 90 seconds (configurable)
195
+ 3. **Push Updates**: Receives real-time NotifyList updates from IntelliCenter
196
+ 4. **Reconnection**: Exponential backoff starting at 30 seconds (configurable)
197
+ 5. **Circuit Breaker**: Pauses after 5 consecutive failures
198
+
199
+ ## Development
200
+
201
+ ```bash
202
+ # Clone repository
203
+ git clone https://github.com/joyfulhouse/pyintellicenter.git
204
+ cd pyintellicenter
205
+
206
+ # Install with dev dependencies
207
+ pip install -e ".[dev]"
208
+
209
+ # Run tests
210
+ pytest
211
+
212
+ # Run linting
213
+ ruff check src tests
214
+ ruff format src tests
215
+
216
+ # Run type checking
217
+ mypy src
218
+ ```
219
+
220
+ ## License
221
+
222
+ MIT License - see [LICENSE](LICENSE) for details.
223
+
224
+ ## Related Projects
225
+
226
+ - [intellicenter](https://github.com/joyfulhouse/intellicenter) - Home Assistant integration using this library