kohler-anthem 0.1.0__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.
- kohler_anthem-0.1.0/.env.example +3 -0
- kohler_anthem-0.1.0/.github/workflows/ci.yml +34 -0
- kohler_anthem-0.1.0/.gitignore +73 -0
- kohler_anthem-0.1.0/API.md +357 -0
- kohler_anthem-0.1.0/Makefile +33 -0
- kohler_anthem-0.1.0/PKG-INFO +100 -0
- kohler_anthem-0.1.0/README.md +66 -0
- kohler_anthem-0.1.0/pyproject.toml +66 -0
- kohler_anthem-0.1.0/scripts/test_library.py +170 -0
- kohler_anthem-0.1.0/src/kohler_anthem/__init__.py +127 -0
- kohler_anthem-0.1.0/src/kohler_anthem/auth.py +178 -0
- kohler_anthem-0.1.0/src/kohler_anthem/client.py +539 -0
- kohler_anthem-0.1.0/src/kohler_anthem/config.py +53 -0
- kohler_anthem-0.1.0/src/kohler_anthem/const.py +41 -0
- kohler_anthem-0.1.0/src/kohler_anthem/converters.py +21 -0
- kohler_anthem-0.1.0/src/kohler_anthem/exceptions.py +68 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/__init__.py +59 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/base.py +35 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/command.py +27 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/customer.py +66 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/enums.py +79 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/preset.py +133 -0
- kohler_anthem-0.1.0/src/kohler_anthem/models/state.py +322 -0
- kohler_anthem-0.1.0/src/kohler_anthem/mqtt.py +213 -0
- kohler_anthem-0.1.0/src/kohler_anthem/py.typed +0 -0
- kohler_anthem-0.1.0/src/kohler_anthem/valve.py +191 -0
- kohler_anthem-0.1.0/tests/__init__.py +1 -0
- kohler_anthem-0.1.0/tests/test_auth.py +208 -0
- kohler_anthem-0.1.0/tests/test_client.py +368 -0
- kohler_anthem-0.1.0/tests/test_config.py +97 -0
- kohler_anthem-0.1.0/tests/test_const.py +142 -0
- kohler_anthem-0.1.0/tests/test_converters.py +60 -0
- kohler_anthem-0.1.0/tests/test_models.py +259 -0
- kohler_anthem-0.1.0/tests/test_mqtt.py +169 -0
- kohler_anthem-0.1.0/tests/test_valve.py +310 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
check:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.9", "3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: make deps
|
|
26
|
+
|
|
27
|
+
- name: Lint
|
|
28
|
+
run: make lint
|
|
29
|
+
|
|
30
|
+
- name: Type check
|
|
31
|
+
run: make typecheck
|
|
32
|
+
|
|
33
|
+
- name: Test
|
|
34
|
+
run: make test
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
.Python
|
|
8
|
+
build/
|
|
9
|
+
develop-eggs/
|
|
10
|
+
dist/
|
|
11
|
+
downloads/
|
|
12
|
+
eggs/
|
|
13
|
+
.eggs/
|
|
14
|
+
lib/
|
|
15
|
+
lib64/
|
|
16
|
+
parts/
|
|
17
|
+
sdist/
|
|
18
|
+
var/
|
|
19
|
+
wheels/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
.installed.cfg
|
|
22
|
+
*.egg
|
|
23
|
+
|
|
24
|
+
# PyInstaller
|
|
25
|
+
*.manifest
|
|
26
|
+
*.spec
|
|
27
|
+
|
|
28
|
+
# Installer logs
|
|
29
|
+
pip-log.txt
|
|
30
|
+
pip-delete-this-directory.txt
|
|
31
|
+
|
|
32
|
+
# Unit test / coverage reports
|
|
33
|
+
htmlcov/
|
|
34
|
+
.tox/
|
|
35
|
+
.nox/
|
|
36
|
+
.coverage
|
|
37
|
+
.coverage.*
|
|
38
|
+
.cache
|
|
39
|
+
nosetests.xml
|
|
40
|
+
coverage.xml
|
|
41
|
+
*.cover
|
|
42
|
+
*.py,cover
|
|
43
|
+
.hypothesis/
|
|
44
|
+
.pytest_cache/
|
|
45
|
+
|
|
46
|
+
# Translations
|
|
47
|
+
*.mo
|
|
48
|
+
*.pot
|
|
49
|
+
|
|
50
|
+
# Environments
|
|
51
|
+
.env
|
|
52
|
+
.venv
|
|
53
|
+
env/
|
|
54
|
+
venv/
|
|
55
|
+
ENV/
|
|
56
|
+
env.bak/
|
|
57
|
+
venv.bak/
|
|
58
|
+
|
|
59
|
+
# IDE
|
|
60
|
+
.claude/
|
|
61
|
+
.idea/
|
|
62
|
+
.vscode/
|
|
63
|
+
*.swp
|
|
64
|
+
*.swo
|
|
65
|
+
*~
|
|
66
|
+
|
|
67
|
+
# mypy
|
|
68
|
+
.mypy_cache/
|
|
69
|
+
.dmypy.json
|
|
70
|
+
dmypy.json
|
|
71
|
+
|
|
72
|
+
# ruff
|
|
73
|
+
.ruff_cache/
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# Kohler Anthem API Documentation
|
|
2
|
+
|
|
3
|
+
This document describes the Kohler Anthem cloud API discovered through traffic analysis of the mobile app.
|
|
4
|
+
|
|
5
|
+
## Authentication
|
|
6
|
+
|
|
7
|
+
Kohler uses Azure AD B2C with Resource Owner Password Credential (ROPC) flow.
|
|
8
|
+
|
|
9
|
+
### Token Endpoint
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
POST https://{tenant}.b2clogin.com/tfp/{tenant}.onmicrosoft.com/{policy}/oauth2/v2.0/token
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Default values:
|
|
16
|
+
- Tenant: `konnectkohler`
|
|
17
|
+
- Policy: `B2C_1_ROPC_Auth`
|
|
18
|
+
|
|
19
|
+
### Request Body
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
grant_type=password
|
|
23
|
+
client_id={client_id}
|
|
24
|
+
username={email}
|
|
25
|
+
password={password}
|
|
26
|
+
scope=openid offline_access https://{tenant}.onmicrosoft.com/{api_resource}/apiaccess
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Response
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"access_token": "eyJ...",
|
|
34
|
+
"refresh_token": "eyJ...",
|
|
35
|
+
"id_token": "eyJ...",
|
|
36
|
+
"expires_in": 3600
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `access_token` is a JWT containing the `oid` (object ID) claim used as `customer_id`.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## HTTP API
|
|
45
|
+
|
|
46
|
+
Base URL: `https://api-kohler-us.kohler.io`
|
|
47
|
+
|
|
48
|
+
All requests require:
|
|
49
|
+
- `Authorization: Bearer {access_token}`
|
|
50
|
+
- `Ocp-Apim-Subscription-Key: {apim_subscription_key}`
|
|
51
|
+
- `Content-Type: application/json`
|
|
52
|
+
|
|
53
|
+
### Device Discovery
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
GET /devices/api/v1/device-management/customer-device/{customer_id}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Returns customer info with nested homes and devices.
|
|
60
|
+
|
|
61
|
+
**Response:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"customerId": "uuid",
|
|
65
|
+
"homes": [
|
|
66
|
+
{
|
|
67
|
+
"homeId": "uuid",
|
|
68
|
+
"homeName": "Home",
|
|
69
|
+
"devices": [
|
|
70
|
+
{
|
|
71
|
+
"deviceId": "uuid",
|
|
72
|
+
"logicalName": "Master Bath",
|
|
73
|
+
"sku": "GCS",
|
|
74
|
+
"capabilities": ["shower", "preset"]
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Device State
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
GET /devices/api/v1/device-management/gcs-state/gcsadvancestate/{device_id}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**Response:**
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"id": "device_id",
|
|
92
|
+
"deviceId": "device_id",
|
|
93
|
+
"sku": "GCS",
|
|
94
|
+
"tenantId": "customer_id",
|
|
95
|
+
"connectionState": "Connected",
|
|
96
|
+
"lastConnected": 1699999999,
|
|
97
|
+
"state": {
|
|
98
|
+
"currentSystemState": "normalOperation",
|
|
99
|
+
"warmUpState": {
|
|
100
|
+
"warmUp": "warmUpDisabled",
|
|
101
|
+
"state": "warmUpNotInProgress"
|
|
102
|
+
},
|
|
103
|
+
"presetOrExperienceId": "0",
|
|
104
|
+
"totalVolume": "0",
|
|
105
|
+
"totalFlow": "0.0",
|
|
106
|
+
"ready": "false",
|
|
107
|
+
"valveState": [
|
|
108
|
+
{
|
|
109
|
+
"valveIndex": "1",
|
|
110
|
+
"atFlow": "0",
|
|
111
|
+
"atTemp": "0",
|
|
112
|
+
"flowSetpoint": "0",
|
|
113
|
+
"temperatureSetpoint": "0",
|
|
114
|
+
"errorFlag": "0",
|
|
115
|
+
"errorCode": "0",
|
|
116
|
+
"pauseFlag": "0",
|
|
117
|
+
"out1": "0",
|
|
118
|
+
"out2": "0",
|
|
119
|
+
"out3": "0",
|
|
120
|
+
"outlets": []
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"ioTActive": "Inactive"
|
|
124
|
+
},
|
|
125
|
+
"setting": {
|
|
126
|
+
"valveSettings": [
|
|
127
|
+
{
|
|
128
|
+
"valve": "Valve1",
|
|
129
|
+
"noOfOutlets": "3",
|
|
130
|
+
"outletConfigurations": [
|
|
131
|
+
{
|
|
132
|
+
"outLetType": "11",
|
|
133
|
+
"outLetId": "1",
|
|
134
|
+
"maximumOutletTemperature": "48.8",
|
|
135
|
+
"minimumOutletTemperature": "15.0",
|
|
136
|
+
"defaultOutletTemperature": "37.7",
|
|
137
|
+
"maximumFlowrate": "100",
|
|
138
|
+
"minimumFlowrate": "0",
|
|
139
|
+
"defaultFlowrate": "50"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"flowControl": "Disabled"
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**State Values:**
|
|
150
|
+
| Field | Values |
|
|
151
|
+
|-------|--------|
|
|
152
|
+
| `connectionState` | `Connected`, `Disconnected` |
|
|
153
|
+
| `currentSystemState` | `normalOperation`, `showerInProgress` |
|
|
154
|
+
| `warmUpState.state` | `warmUpNotInProgress`, `warmUpInProgress` |
|
|
155
|
+
| `out1`, `out2`, `out3` | `"0"` (off), `"1"` (on) |
|
|
156
|
+
|
|
157
|
+
### Presets
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
GET /devices/api/v1/device-management/gcs-preset/{device_id}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Response:**
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"presets": [
|
|
167
|
+
{
|
|
168
|
+
"id": 1,
|
|
169
|
+
"title": "Morning",
|
|
170
|
+
"duration": 600,
|
|
171
|
+
"state": "active",
|
|
172
|
+
"isExperience": false,
|
|
173
|
+
"valves": [
|
|
174
|
+
{
|
|
175
|
+
"valveIndex": 1,
|
|
176
|
+
"out1": true,
|
|
177
|
+
"out2": false,
|
|
178
|
+
"out3": false,
|
|
179
|
+
"temperatureSetpoint": 38.0,
|
|
180
|
+
"flowSetpoint": 100
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Start/Stop Preset
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
POST /platform/api/v1/commands/gcs/controlpresetorexperience
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Request:**
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"deviceId": "device_id",
|
|
198
|
+
"sku": "GCS",
|
|
199
|
+
"presetId": "1",
|
|
200
|
+
"command": "start"
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Command values: `start`, `stop`
|
|
205
|
+
|
|
206
|
+
### Warmup Control
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
POST /platform/api/v1/commands/gcs/warmup
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Request:**
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"deviceId": "device_id",
|
|
216
|
+
"sku": "GCS",
|
|
217
|
+
"presetId": "1",
|
|
218
|
+
"command": "start"
|
|
219
|
+
}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Valve Control
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
POST /platform/api/v1/commands/gcs/solowritesystem
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Request:**
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"deviceId": "device_id",
|
|
232
|
+
"sku": "GCS",
|
|
233
|
+
"tenantId": "customer_id",
|
|
234
|
+
"gcsValveControlModel": {
|
|
235
|
+
"primaryValve1": "0179C801",
|
|
236
|
+
"secondaryValve1": "00000000",
|
|
237
|
+
"secondaryValve2": "00000000",
|
|
238
|
+
"secondaryValve3": "00000000",
|
|
239
|
+
"secondaryValve4": "00000000",
|
|
240
|
+
"secondaryValve5": "00000000",
|
|
241
|
+
"secondaryValve6": "00000000",
|
|
242
|
+
"secondaryValve7": "00000000"
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
#### Valve Hex Command Format
|
|
248
|
+
|
|
249
|
+
Each valve command is an 8-character hex string (4 bytes):
|
|
250
|
+
|
|
251
|
+
```
|
|
252
|
+
[prefix][temperature][flow][mode]
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
| Byte | Description | Values |
|
|
256
|
+
|------|-------------|--------|
|
|
257
|
+
| Prefix | Valve ID | `01` = primary, `11`-`71` = secondary 1-7 |
|
|
258
|
+
| Temperature | Encoded temp | `(celsius - 25.6) * 10` |
|
|
259
|
+
| Flow | Flow rate | `0`-`200` (0-100% scaled by 2) |
|
|
260
|
+
| Mode | Outlet/state | See below |
|
|
261
|
+
|
|
262
|
+
**Mode Values:**
|
|
263
|
+
| Hex | Mode |
|
|
264
|
+
|-----|------|
|
|
265
|
+
| `00` | Off |
|
|
266
|
+
| `01` | Showerhead |
|
|
267
|
+
| `02` | Tub Filler |
|
|
268
|
+
| `03` | Tub + Handheld |
|
|
269
|
+
| `40` | Stop (pause) |
|
|
270
|
+
|
|
271
|
+
**Examples:**
|
|
272
|
+
| Command | Meaning |
|
|
273
|
+
|---------|---------|
|
|
274
|
+
| `0179C801` | Primary valve, 37.7°C, 100% flow, showerhead on |
|
|
275
|
+
| `01796402` | Primary valve, 37.7°C, 50% flow, tub filler on |
|
|
276
|
+
| `00000000` | Off |
|
|
277
|
+
|
|
278
|
+
**Temperature Encoding:**
|
|
279
|
+
```
|
|
280
|
+
temp_byte = (celsius - 25.6) * 10
|
|
281
|
+
celsius = temp_byte / 10 + 25.6
|
|
282
|
+
|
|
283
|
+
Example: 37.7°C -> (37.7 - 25.6) * 10 = 121 = 0x79
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Mobile Settings (IoT Hub Credentials)
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
POST /platform/api/v1/mobile/settings
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Request:**
|
|
293
|
+
```json
|
|
294
|
+
{
|
|
295
|
+
"tenantId": "customer_id",
|
|
296
|
+
"mobileDeviceId": "unique_id",
|
|
297
|
+
"username": "AppName",
|
|
298
|
+
"os": "Android",
|
|
299
|
+
"devicePlatform": "FirebaseCloudMessagingV1",
|
|
300
|
+
"deviceHandle": "fcm_token",
|
|
301
|
+
"tags": ["FirmwareUpdate"]
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
**Response:**
|
|
306
|
+
```json
|
|
307
|
+
{
|
|
308
|
+
"ioTHubSettings": {
|
|
309
|
+
"ioTHub": "prd-hub.azure-devices.net",
|
|
310
|
+
"deviceId": "mqtt_client_id",
|
|
311
|
+
"username": "prd-hub.azure-devices.net/mqtt_client_id/?api-version=2021-04-12",
|
|
312
|
+
"password": "SharedAccessSignature sr=prd-hub.azure-devices.net&sig=...&se=...",
|
|
313
|
+
"connectionString": "HostName=prd-hub.azure-devices.net;DeviceId=...;SharedAccessSignature=..."
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
## MQTT API (Azure IoT Hub)
|
|
321
|
+
|
|
322
|
+
Real-time state updates are delivered via Azure IoT Hub over MQTT.
|
|
323
|
+
|
|
324
|
+
### Connection
|
|
325
|
+
|
|
326
|
+
| Parameter | Value |
|
|
327
|
+
|-----------|-------|
|
|
328
|
+
| Host | `ioTHubSettings.ioTHub` (e.g., `prd-hub.azure-devices.net`) |
|
|
329
|
+
| Port | `8883` (TLS) |
|
|
330
|
+
| Client ID | `ioTHubSettings.deviceId` |
|
|
331
|
+
| Username | `ioTHubSettings.username` |
|
|
332
|
+
| Password | `ioTHubSettings.password` (SAS token) |
|
|
333
|
+
|
|
334
|
+
### Topics
|
|
335
|
+
|
|
336
|
+
**Subscribe to device messages:**
|
|
337
|
+
```
|
|
338
|
+
devices/{device_id}/messages/devicebound/#
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
**Subscribe to direct methods:**
|
|
342
|
+
```
|
|
343
|
+
$iothub/methods/POST/#
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Direct Method Responses
|
|
347
|
+
|
|
348
|
+
When receiving a direct method call on `$iothub/methods/POST/{method_name}/?$rid={request_id}`, respond with:
|
|
349
|
+
|
|
350
|
+
```
|
|
351
|
+
Topic: $iothub/methods/res/200/?$rid={request_id}
|
|
352
|
+
Payload: {"status": "received"}
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### State Update Messages
|
|
356
|
+
|
|
357
|
+
Messages on `devices/{device_id}/messages/devicebound/#` contain JSON state updates matching the device state structure from the HTTP API.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.PHONY: build check clean deps format help lint publish test typecheck
|
|
2
|
+
.DEFAULT_GOAL := help
|
|
3
|
+
|
|
4
|
+
build: ## Build the package
|
|
5
|
+
python3 -m build
|
|
6
|
+
|
|
7
|
+
check: lint typecheck test ## Run all checks
|
|
8
|
+
|
|
9
|
+
clean: ## Remove build artifacts and caches
|
|
10
|
+
rm -rf build dist *.egg-info .pytest_cache .mypy_cache .ruff_cache
|
|
11
|
+
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
|
|
12
|
+
|
|
13
|
+
deps: ## Install dev dependencies
|
|
14
|
+
python3 -m pip install -e ".[dev]"
|
|
15
|
+
|
|
16
|
+
format: ## Format code with ruff
|
|
17
|
+
python3 -m ruff format .
|
|
18
|
+
|
|
19
|
+
help: ## Show this help message
|
|
20
|
+
@echo "Available targets:"
|
|
21
|
+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " %-12s %s\n", $$1, $$2}'
|
|
22
|
+
|
|
23
|
+
lint: ## Run ruff linter
|
|
24
|
+
python3 -m ruff check .
|
|
25
|
+
|
|
26
|
+
publish: clean build ## Publish to PyPI
|
|
27
|
+
@export $$(grep -v '^#' .env | xargs) && python3 -m twine upload dist/*
|
|
28
|
+
|
|
29
|
+
test: ## Run tests
|
|
30
|
+
python3 -m pytest
|
|
31
|
+
|
|
32
|
+
typecheck: ## Run mypy type checking
|
|
33
|
+
python3 -m mypy src
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kohler-anthem
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python client library for Kohler Anthem Digital Shower API
|
|
5
|
+
Project-URL: Homepage, https://github.com/yon/kohler-anthem
|
|
6
|
+
Project-URL: Repository, https://github.com/yon/kohler-anthem
|
|
7
|
+
Author-email: Yon <yon@example.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
20
|
+
Requires-Dist: eval-type-backport>=0.2.0; python_version < '3.10'
|
|
21
|
+
Requires-Dist: paho-mqtt>=2.0
|
|
22
|
+
Requires-Dist: pydantic>=2.0.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: aioresponses>=0.7; extra == 'dev'
|
|
25
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: mypy>=1.8; extra == 'dev'
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.2; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
32
|
+
Requires-Dist: types-paho-mqtt>=1.6; extra == 'dev'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# kohler-anthem
|
|
36
|
+
|
|
37
|
+
Python library for controlling Kohler Anthem digital showers.
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install kohler-anthem
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
import asyncio
|
|
49
|
+
from kohler_anthem import KohlerAnthemClient, KohlerConfig, Outlet
|
|
50
|
+
|
|
51
|
+
async def main():
|
|
52
|
+
config = KohlerConfig(
|
|
53
|
+
username="user@example.com",
|
|
54
|
+
password="password",
|
|
55
|
+
client_id="...",
|
|
56
|
+
apim_subscription_key="...",
|
|
57
|
+
api_resource="...",
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
async with KohlerAnthemClient(config) as client:
|
|
61
|
+
# Discover devices
|
|
62
|
+
customer = await client.get_customer("customer-id")
|
|
63
|
+
device = customer.get_all_devices()[0]
|
|
64
|
+
|
|
65
|
+
# Get state
|
|
66
|
+
state = await client.get_device_state(device.device_id)
|
|
67
|
+
print(f"Running: {state.is_running}")
|
|
68
|
+
|
|
69
|
+
# Control
|
|
70
|
+
await client.turn_on_outlet(device.device_id, Outlet.SHOWERHEAD, temperature_celsius=38.0)
|
|
71
|
+
await client.turn_off(device.device_id)
|
|
72
|
+
|
|
73
|
+
asyncio.run(main())
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Configuration
|
|
77
|
+
|
|
78
|
+
| Parameter | Description |
|
|
79
|
+
|-----------|-------------|
|
|
80
|
+
| `username` | Kohler account email |
|
|
81
|
+
| `password` | Kohler account password |
|
|
82
|
+
| `client_id` | Azure AD B2C client ID |
|
|
83
|
+
| `apim_subscription_key` | Azure APIM subscription key |
|
|
84
|
+
| `api_resource` | Azure AD B2C API resource ID |
|
|
85
|
+
|
|
86
|
+
See [API.md](API.md) for full API documentation.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
make deps # Install dependencies
|
|
92
|
+
make check # Run lint, typecheck, tests
|
|
93
|
+
make help # Show all targets
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
See [Makefile](Makefile) for all available targets.
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
MIT
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# kohler-anthem
|
|
2
|
+
|
|
3
|
+
Python library for controlling Kohler Anthem digital showers.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install kohler-anthem
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import asyncio
|
|
15
|
+
from kohler_anthem import KohlerAnthemClient, KohlerConfig, Outlet
|
|
16
|
+
|
|
17
|
+
async def main():
|
|
18
|
+
config = KohlerConfig(
|
|
19
|
+
username="user@example.com",
|
|
20
|
+
password="password",
|
|
21
|
+
client_id="...",
|
|
22
|
+
apim_subscription_key="...",
|
|
23
|
+
api_resource="...",
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
async with KohlerAnthemClient(config) as client:
|
|
27
|
+
# Discover devices
|
|
28
|
+
customer = await client.get_customer("customer-id")
|
|
29
|
+
device = customer.get_all_devices()[0]
|
|
30
|
+
|
|
31
|
+
# Get state
|
|
32
|
+
state = await client.get_device_state(device.device_id)
|
|
33
|
+
print(f"Running: {state.is_running}")
|
|
34
|
+
|
|
35
|
+
# Control
|
|
36
|
+
await client.turn_on_outlet(device.device_id, Outlet.SHOWERHEAD, temperature_celsius=38.0)
|
|
37
|
+
await client.turn_off(device.device_id)
|
|
38
|
+
|
|
39
|
+
asyncio.run(main())
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Configuration
|
|
43
|
+
|
|
44
|
+
| Parameter | Description |
|
|
45
|
+
|-----------|-------------|
|
|
46
|
+
| `username` | Kohler account email |
|
|
47
|
+
| `password` | Kohler account password |
|
|
48
|
+
| `client_id` | Azure AD B2C client ID |
|
|
49
|
+
| `apim_subscription_key` | Azure APIM subscription key |
|
|
50
|
+
| `api_resource` | Azure AD B2C API resource ID |
|
|
51
|
+
|
|
52
|
+
See [API.md](API.md) for full API documentation.
|
|
53
|
+
|
|
54
|
+
## Development
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
make deps # Install dependencies
|
|
58
|
+
make check # Run lint, typecheck, tests
|
|
59
|
+
make help # Show all targets
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See [Makefile](Makefile) for all available targets.
|
|
63
|
+
|
|
64
|
+
## License
|
|
65
|
+
|
|
66
|
+
MIT
|