forked from kobaj/ha_taco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconst.py
More file actions
272 lines (264 loc) · 10.8 KB
/
Copy pathconst.py
File metadata and controls
272 lines (264 loc) · 10.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
"""Constants for the Home Assistant Taco integration."""
from logging import Logger, getLogger
from .src.gatt import Gatt, Service, Characteristic, Property, ReadAction
from .src.ble_service_info_decrypter import BleServiceInfoDecrypter
from .src.taco_gatt_read_transform import (
read_network_device_index_transform,
read_network_thermostat_input_status_transform,
read_network_zone_count_transform,
read_network_zone_status_transform,
read_product_id_transform,
read_network_diagnostic_data_transform,
read_log_transform,
read_network_aux1_transform,
read_network_aux2_transform,
)
from .src.taco_gatt_write_transform import (
write_password_transform,
write_network_diagnostic_mode_transform,
write_network_device_index_transform,
)
LOGGER: Logger = getLogger(__package__)
# Must be the same as the directory name
DOMAIN = "ha_taco"
_TACO_SERVICES = [
Service(
uuid="38f63141-02b6-403c-810c-7e1253f474eb",
name="Diagnostics",
characteristics=[
Characteristic(
uuid="38f6314b-02b6-403c-810c-7e1253f474eb",
name="platformId",
properties=[Property.READ],
),
Characteristic(
uuid="38f63144-02b6-403c-810c-7e1253f474eb",
name="firmwareVersion",
properties=[Property.READ],
),
Characteristic(
uuid="38f63142-02b6-403c-810c-7e1253f474eb",
name="productId",
properties=[Property.READ],
),
Characteristic(
uuid="38f63143-02b6-403c-810c-7e1253f474eb",
name="serialNumber",
properties=[Property.READ],
),
Characteristic(
uuid="38f63145-02b6-403c-810c-7e1253f474eb",
name="status",
properties=[Property.READ, Property.NOTIFY],
),
Characteristic(
uuid="38f63146-02b6-403c-810c-7e1253f474eb",
name="deviceName",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="38f63147-02b6-403c-810c-7e1253f474eb",
name="location",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="38f63148-02b6-403c-810c-7e1253f474eb",
name="notes",
properties=[Property.READ, Property.WRITE, Property.EXTENDED_PROPS],
),
# Must be set before any diagnostic and config writes can take place.
Characteristic(
uuid="38f63149-02b6-403c-810c-7e1253f474eb",
name="password",
properties=[Property.WRITE],
write_transform=write_password_transform,
),
Characteristic(
uuid="38f6314a-02b6-403c-810c-7e1253f474eb",
name="interfaceRevision",
properties=[Property.READ],
),
Characteristic(
uuid="38f6314c-02b6-403c-810c-7e1253f474eb",
name="diagnosticMode",
properties=[Property.READ, Property.WRITE],
),
],
),
Service(
uuid="1b423141-e0eb-4d9e-a86b-dcabcc3565b9",
name="ZoneControl",
characteristics=[
# This is the mac address, it seems like the official app
# uses this as a kind of ping by reading the value, and then
# writing back the exact same value it just read.
Characteristic(
uuid="1b423159-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkDeviceIndex",
properties=[Property.READ, Property.WRITE],
read_action=ReadAction.INDEX,
read_transform=read_network_device_index_transform,
write_transform=write_network_device_index_transform,
),
Characteristic(
uuid="1b42315c-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkDeviceName",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b423161-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkProductId",
properties=[Property.READ],
read_action=ReadAction.INDEX,
read_transform=read_product_id_transform,
),
# How to read diagnostic data (eg, zone overrides).
Characteristic(
uuid="1b42315e-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkDiagnosticData",
properties=[Property.READ, Property.INDICATE],
read_transform=read_network_diagnostic_data_transform,
),
Characteristic(
uuid="1b423162-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkFirmwareVersion",
properties=[Property.READ],
),
Characteristic(
uuid="1b423144-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkDIPInputStatus",
properties=[Property.READ, Property.NOTIFY],
),
Characteristic(
uuid="1b423145-e0eb-4d9e-a86b-dcabcc3565b9",
name="pumpExerciseOffTime",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b423146-e0eb-4d9e-a86b-dcabcc3565b9",
name="pumpExerciseOnTime",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b42315a-e0eb-4d9e-a86b-dcabcc3565b9",
name="postPurgeTime",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b423148-e0eb-4d9e-a86b-dcabcc3565b9",
name="zvcInterfaceRevision",
properties=[Property.READ],
),
Characteristic(
uuid="1b423149-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkZoneNames",
properties=[Property.READ, Property.WRITE, Property.EXTENDED_PROPS],
),
Characteristic(
uuid="1b42314b-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkId",
properties=[Property.READ],
),
Characteristic(
uuid="1b423160-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkDeviceLocation",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b42314e-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkAddressMapping",
properties=[Property.READ, Property.NOTIFY],
),
Characteristic(
uuid="1b42314f-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkAddressStatus",
properties=[Property.READ, Property.NOTIFY],
),
# Very important, tells us how many buttons we have!
Characteristic(
uuid="1b423150-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkZoneCount",
properties=[Property.READ],
read_action=ReadAction.INDEX,
read_transform=read_network_zone_count_transform,
),
# This is the thermostat status.
Characteristic(
uuid="1b423151-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkThermostatInputStatus",
properties=[Property.READ, Property.NOTIFY],
read_action=ReadAction.SUBSCRIBE,
read_transform=read_network_thermostat_input_status_transform,
),
# This is the pump and zone status.
Characteristic(
uuid="1b423152-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkZoneStatus",
properties=[Property.READ, Property.NOTIFY],
read_action=ReadAction.SUBSCRIBE,
read_transform=read_network_zone_status_transform,
),
Characteristic(
uuid="1b423153-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkMainBoilerEndSwitch",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b423154-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkPriorityBoilerEndSwitch",
properties=[Property.READ, Property.WRITE],
),
# For whatever reason these aux are not reporting
# their state via bluetooth, so don't include them.
Characteristic(
uuid="1b423155-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkAux1",
properties=[Property.READ, Property.WRITE],
# read_action=ReadAction.AFTER_NOTIFICATION,
# read_transform=read_network_aux1_transform,
),
Characteristic(
uuid="1b423156-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkAux2",
properties=[Property.READ, Property.WRITE],
# read_action=ReadAction.AFTER_NOTIFICATION,
# read_transform=read_network_aux2_transform,
),
# That's weird, the Taco documentation doesn't mention
# that any of their units have a third aux...
Characteristic(
uuid="1b423157-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkAux3",
properties=[Property.READ, Property.WRITE],
),
Characteristic(
uuid="1b42315b-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkOutputNames",
properties=[Property.READ, Property.WRITE, Property.EXTENDED_PROPS],
),
Characteristic(
uuid="1b423158-e0eb-4d9e-a86b-dcabcc3565b9",
name="operatingMode",
properties=[Property.READ, Property.WRITE],
),
# This is how to trigger a pump or zone manually.
Characteristic(
uuid="1b42315d-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkDiagnosticMode",
properties=[Property.READ, Property.WRITE],
write_transform=write_network_diagnostic_mode_transform,
),
Characteristic(
uuid="1b42315f-e0eb-4d9e-a86b-dcabcc3565b9",
name="networkRecircMode",
properties=[Property.READ, Property.WRITE],
),
],
),
]
taco_gatt = Gatt(services=_TACO_SERVICES)
# 3155 is 0x0C53, Taco Inc
taco_service_info_decrypter = BleServiceInfoDecrypter(
manufacturer_id=3155,
service_ids=[service.uuid for service in taco_gatt.services],
)