Skip to content

Commit 87fc57c

Browse files
committed
Initial Commit
0 parents  commit 87fc57c

16 files changed

+1313
-0
lines changed

.bumpversion.cfg

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[bumpversion]
2+
current_version = 0.1.0a
3+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?P<alpha>a)?
4+
serialize =
5+
{major}.{minor}.{patch}{alpha}
6+
{major}.{minor}.{patch}
7+
commit = False
8+
tag = False
9+
10+
[bumpversion:part:alpha]
11+
optional_value = r
12+
values =
13+
a
14+
r
15+
16+
[bumpversion:file:README.md]
17+
18+
[bumpversion:file:VERSION.txt]

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "pip"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.idea
2+
.venv
3+
dist
4+
**/*.egg-info

.gitmodules

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[submodule "git-submod-lib"]
2+
path = git-submod-lib
3+
url = [email protected]:ejsuncy/git-submod-lib.git
4+
branch = 0.2.x
5+
ignore = all

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [2023] [Dan Bunker]
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.

README.md

+294
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
# py_ecowater
2+
![Current Version](https://img.shields.io/badge/Version-0.1.0a-brightgreen)
3+
4+
A python library for getting device data from Ecowater API for devices such as the Rheem RHW42 water softener, which
5+
provides WI-FI connectivity via the iQua app.
6+
7+
## Installation
8+
9+
```bash
10+
pip install py_ecowater
11+
```
12+
13+
## Usage
14+
The primary class is `EcowaterClient`. It takes two parameters, `username` and `password`.
15+
These are the same credentials you use to log in to the app. The primary methods are `get_devices`, `get_user_profile`,
16+
`get_systems`, and `get_system_state`.
17+
18+
The `get_system_state` method takes a single parameter, `serial_number`, which is the serial number of the system you
19+
want to get the state of and can be found from the system information returned by `get_systems`.
20+
21+
The methods return python objects that can be accessed as attributes.
22+
23+
```python
24+
import os
25+
from py_ecowater import EcowaterClient
26+
27+
username = os.environ.get('ECOWATER_USERNAME')
28+
password = os.environ.get('ECOWATER_PASSWORD')
29+
30+
client = EcowaterClient(username, password)
31+
32+
devices = client.get_devices()
33+
'''
34+
{
35+
"devices": [
36+
{
37+
"id": 12345,
38+
"email": "[email protected]",
39+
"type": "AC",
40+
"status": "READY",
41+
"role": "user",
42+
"user_uuid": null,
43+
"dealer_id": null,
44+
"members": null,
45+
"alerts_ack": null,
46+
"mydata": null,
47+
"date": 1650692107704,
48+
"created_by": "user"
49+
}
50+
]
51+
}
52+
'''
53+
54+
profile = client.get_user_profile()
55+
'''
56+
{
57+
"id": "<unique id>",
58+
"name": "Bob,Ross",
59+
"email": "[email protected]",
60+
"company": {
61+
"phone_country_code": "",
62+
"phone": "1234567890",
63+
"primary_phone_code": "",
64+
"primary_phone": "1234567890",
65+
"members_count": 2,
66+
"support_phone": "",
67+
"support_phone_code": ""
68+
},
69+
"phone": "1234567890",
70+
"time_zone": null,
71+
"address_line_1": "123 My Addr Rd",
72+
"address_line_2": "",
73+
"city": "My City",
74+
"state": null,
75+
"zip_code": "98765",
76+
"country": "US",
77+
"contact_language": "en",
78+
"roles": [
79+
"user"
80+
],
81+
"change_password": false,
82+
"manufacturer_id": "",
83+
"first_name": "Bob",
84+
"last_name": "Ross",
85+
"meta": {
86+
"phone_country_code": "",
87+
"phone": "1234567890",
88+
"primary_phone_code": "+1",
89+
"primary_phone": "1234567890",
90+
"members_count": 2,
91+
"support_phone": "",
92+
"support_phone_code": ""
93+
}
94+
}
95+
'''
96+
97+
systems = client.get_systems()
98+
'''
99+
{
100+
"systems": [
101+
{
102+
"id": "<system id>",
103+
"serial_number": "SL0<serial number>",
104+
"nickname": "Water Softener",
105+
"description": {
106+
"unit_owner": "customer",
107+
"rental_access": 1
108+
},
109+
"ac_role_name": "User",
110+
"role": "user",
111+
"model_id": "<model id>",
112+
"model_name": "108201",
113+
"model_description": "Rheem RHW42",
114+
"system_type": "demand softener",
115+
"dealer_access": false,
116+
"alarms_alerts": false,
117+
"is_rental": false,
118+
"is_restricted": false,
119+
"alerts_active": null,
120+
"is_super_hero": false,
121+
"is_filter_system": false,
122+
"product_image": "Rheem",
123+
"water_shut_off_valve_control": true
124+
}
125+
]
126+
}
127+
128+
'''
129+
130+
system_state = client.get_system_state(systems.systems[0].serial_number)
131+
'''
132+
{
133+
"iron_level_tenths_ppm": {
134+
"value": 0
135+
},
136+
"hardness_unit_enum": {
137+
"value": 0
138+
},
139+
"hardness_grains": {
140+
"value": 11
141+
},
142+
"salt_level_tenths": {
143+
"value": 20,
144+
"percent": 25
145+
},
146+
"salt_monitor_enum": {
147+
"value": 1
148+
},
149+
"volume_unit_enum": {
150+
"value": 0
151+
},
152+
"regen_enable_enum": {
153+
"value": 1
154+
},
155+
"regen_time_secs": {
156+
"value": 7200
157+
},
158+
"time_format_enum": {
159+
"value": 0
160+
},
161+
"time_zone_enum": {
162+
"value": "America/Denver"
163+
},
164+
"date_format_enum": {
165+
"value": 0
166+
},
167+
"water_shutoff_valve_req": {
168+
"value": 0
169+
},
170+
"total_water_available_gallons": {
171+
"value": 2224
172+
},
173+
"current_water_flow": {
174+
"value": 0.0
175+
},
176+
"gallons_used_today": {
177+
"value": 38
178+
},
179+
"average_daily_use_gallons": {
180+
"value": 90
181+
},
182+
"regen_status_enum": {
183+
"value": 0
184+
},
185+
"out_of_salt_estimated_days": {
186+
"value": 130
187+
},
188+
"days_since_last_regen": {
189+
"value": 14
190+
},
191+
"model_id": {
192+
"value": <model id>
193+
},
194+
"model_description": {
195+
"value": "Rheem RHW42"
196+
},
197+
"system_type": {
198+
"value": "demand softener",
199+
"type": "softener"
200+
},
201+
"water_shutoff_valve": {
202+
"value": 0
203+
},
204+
"water_shutoff_valve_installed": {
205+
"value": 1
206+
},
207+
"water_shutoff_valve_override": {
208+
"value": 0
209+
},
210+
"water_shutoff_valve_device_action": {
211+
"value": 0
212+
},
213+
"water_shutoff_valve_error_code": {
214+
"value": 0
215+
},
216+
"base_software_version": {
217+
"value": "r4.4 MPC01082"
218+
},
219+
"power": "Online",
220+
"device_date": "2023-07-29T09:44:38.149000",
221+
"refresh_policy": {
222+
"delay": "low",
223+
"time": 300000
224+
}
225+
}
226+
'''
227+
```
228+
229+
## Contributing and Development
230+
231+
### Update git-submod-lib submodule for current Makefile Targets
232+
```shell
233+
git submodule update --init --remote
234+
```
235+
236+
### Make Python venv and install requirements
237+
```shell
238+
make -f git-submod-lib/makefile/Makefile venv
239+
```
240+
241+
Make and commit changes, and then build locally as follows.
242+
243+
### Build Locally
244+
```shell
245+
make -f git-submod-lib/makefile/Makefile build-python
246+
```
247+
248+
### Make a pull request to `main` with your changes
249+
```shell
250+
make -f git-submod-lib/makefile/Makefile pull-request-main
251+
```
252+
253+
## Releasing
254+
255+
### Minor releases
256+
```shell
257+
make -f git-submod-lib/makefile/Makefile promotion-alpha
258+
```
259+
260+
Once the PR is approved and merged:
261+
```shell
262+
make -f git-submod-lib/makefile/Makefile github-release
263+
```
264+
265+
Once the Release is published:
266+
```shell
267+
make -f git-submod-lib/makefile/Makefile twine-upload
268+
```
269+
270+
Now cut a version release branch:
271+
```shell
272+
make -f git-submod-lib/makefile/Makefile github-branch
273+
```
274+
275+
Now move `main` to the next `alpha` version to capture future development
276+
```shell
277+
make -f git-submod-lib/makefile/Makefile version-alpha
278+
```
279+
280+
### Patch releases
281+
Start with the version branch to be patched (ie `0.0.x`)
282+
```shell
283+
make -f git-submod-lib/makefile/Makefile promotion-patch
284+
```
285+
286+
Once the PR is approved and merged:
287+
```shell
288+
make -f git-submod-lib/makefile/Makefile github-release-patch
289+
```
290+
291+
Once the Patch Release is published:
292+
```shell
293+
make -f git-submod-lib/makefile/Makefile twine-upload
294+
```

VERSION.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.1.0a

git-submod-lib

Submodule git-submod-lib added at 2441517

pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=42"]
3+
build-backend = "setuptools.build_meta"

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests==2.31.0

setup.cfg

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[metadata]
2+
name = py_ecowater
3+
version = file: VERSION.txt
4+
author = Dan Bunker
5+
author_email = [email protected]
6+
description = A python package for interacting with the Ecowater API
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
url = https://github.com/ejsuncy/py_ecowater
10+
project_urls =
11+
Bug Tracker = https://github.com/ejsuncy/py_ecowater/issues
12+
classifiers =
13+
Programming Language :: Python :: 3
14+
License :: OSI Approved :: MIT License
15+
Operating System :: OS Independent
16+
17+
[options]
18+
package_dir =
19+
= src
20+
packages = find:
21+
python_requires = >=3.8
22+
23+
[options.packages.find]
24+
where = src

src/py_ecowater/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)