carrier-api 3.9.0__tar.gz → 3.9.2__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.
- {carrier_api-3.9.0/src/carrier_api.egg-info → carrier_api-3.9.2}/PKG-INFO +10 -2
- {carrier_api-3.9.0 → carrier_api-3.9.2}/README.md +9 -1
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/api_connection_graphql.py +186 -88
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/api_websocket.py +126 -32
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/api_websocket_data_updater.py +54 -7
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/const.py +14 -1
- {carrier_api-3.9.0 → carrier_api-3.9.2/src/carrier_api.egg-info}/PKG-INFO +10 -2
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_api_connection_graphql.py +317 -20
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_api_websocket.py +350 -3
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_fixture_contracts.py +3 -1
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_websocket_data_updater.py +82 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_workflows.py +2 -1
- {carrier_api-3.9.0 → carrier_api-3.9.2}/LICENSE +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/pyproject.toml +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/setup.cfg +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/__init__.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/config.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/energy.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/entry_level.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/errors.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/live_smoke_test.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/profile.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/py.typed +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/status.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/system.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api/util.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api.egg-info/SOURCES.txt +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api.egg-info/dependency_links.txt +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api.egg-info/requires.txt +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/src/carrier_api.egg-info/top_level.txt +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_config.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_entry_level.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_live_smoke_test.py +0 -0
- {carrier_api-3.9.0 → carrier_api-3.9.2}/tests/test_models.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: carrier_api
|
|
3
|
-
Version: 3.9.
|
|
3
|
+
Version: 3.9.2
|
|
4
4
|
Summary: Carrier Api Wrapper
|
|
5
5
|
Author-email: Bren Dahl <dahl.brendan@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -140,7 +140,7 @@ api = ApiConnectionGraphql(
|
|
|
140
140
|
)
|
|
141
141
|
```
|
|
142
142
|
|
|
143
|
-
The websocket connects through that session, and GraphQL requests share its connection pool: gql builds each request's session on the shared connector without taking ownership of it. `cleanup()`
|
|
143
|
+
The websocket connects through that session, and GraphQL requests share its connection pool: gql builds each request's session on the shared connector without taking ownership of it. `cleanup()` stops the websocket tasks but leaves a session you passed in open, so the owner of that session closes it. A session the connection created itself is closed by `cleanup()`.
|
|
144
144
|
|
|
145
145
|
## Updating Thermostat Settings
|
|
146
146
|
|
|
@@ -232,6 +232,14 @@ asyncio.run(main())
|
|
|
232
232
|
|
|
233
233
|
Callbacks receive the raw websocket message text. Register `WebsocketDataUpdater.message_handler` first when later callbacks need to read the updated in-memory system state.
|
|
234
234
|
|
|
235
|
+
If a callback raises `ValueError`, `KeyError`, `TypeError`, `IndexError` or `AttributeError` for a message, the error is logged and the message is dropped; the connection stays open and later callbacks still run. `WebsocketDataUpdater` skips messages for devices and zones that `load_data()` did not return.
|
|
236
|
+
|
|
237
|
+
When the connection drops, the listener reconnects with exponential backoff and jitter, starting at 1 second and capped at 5 minutes. A connection that stays up for a minute resets the delay. Call `api.api_websocket.stop()`, or `api.cleanup()`, to cancel the listener and heartbeat tasks and close the websocket.
|
|
238
|
+
|
|
239
|
+
## Authentication
|
|
240
|
+
|
|
241
|
+
The access token is refreshed 60 seconds before it expires. If Carrier rejects a request with HTTP 401 or 403, the token is refreshed and the request is retried once before `CarrierApiAuthError` is raised. If the refresh token itself is rejected, the connection logs in again with the stored password.
|
|
242
|
+
|
|
235
243
|
## Development
|
|
236
244
|
|
|
237
245
|
Clone this repository and install the development environment:
|
|
@@ -116,7 +116,7 @@ api = ApiConnectionGraphql(
|
|
|
116
116
|
)
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
The websocket connects through that session, and GraphQL requests share its connection pool: gql builds each request's session on the shared connector without taking ownership of it. `cleanup()`
|
|
119
|
+
The websocket connects through that session, and GraphQL requests share its connection pool: gql builds each request's session on the shared connector without taking ownership of it. `cleanup()` stops the websocket tasks but leaves a session you passed in open, so the owner of that session closes it. A session the connection created itself is closed by `cleanup()`.
|
|
120
120
|
|
|
121
121
|
## Updating Thermostat Settings
|
|
122
122
|
|
|
@@ -208,6 +208,14 @@ asyncio.run(main())
|
|
|
208
208
|
|
|
209
209
|
Callbacks receive the raw websocket message text. Register `WebsocketDataUpdater.message_handler` first when later callbacks need to read the updated in-memory system state.
|
|
210
210
|
|
|
211
|
+
If a callback raises `ValueError`, `KeyError`, `TypeError`, `IndexError` or `AttributeError` for a message, the error is logged and the message is dropped; the connection stays open and later callbacks still run. `WebsocketDataUpdater` skips messages for devices and zones that `load_data()` did not return.
|
|
212
|
+
|
|
213
|
+
When the connection drops, the listener reconnects with exponential backoff and jitter, starting at 1 second and capped at 5 minutes. A connection that stays up for a minute resets the delay. Call `api.api_websocket.stop()`, or `api.cleanup()`, to cancel the listener and heartbeat tasks and close the websocket.
|
|
214
|
+
|
|
215
|
+
## Authentication
|
|
216
|
+
|
|
217
|
+
The access token is refreshed 60 seconds before it expires. If Carrier rejects a request with HTTP 401 or 403, the token is refreshed and the request is retried once before `CarrierApiAuthError` is raised. If the refresh token itself is rejected, the connection logs in again with the stored password.
|
|
218
|
+
|
|
211
219
|
## Development
|
|
212
220
|
|
|
213
221
|
Clone this repository and install the development environment:
|
|
@@ -17,7 +17,13 @@ from graphql import GraphQLError
|
|
|
17
17
|
|
|
18
18
|
from .api_websocket import ApiWebsocket
|
|
19
19
|
from .config import Config
|
|
20
|
-
from .const import
|
|
20
|
+
from .const import (
|
|
21
|
+
TOKEN_REFRESH_MARGIN_SECONDS,
|
|
22
|
+
ActivityTypes,
|
|
23
|
+
FanModes,
|
|
24
|
+
HeatSourceTypes,
|
|
25
|
+
SystemModes,
|
|
26
|
+
)
|
|
21
27
|
from .energy import Energy
|
|
22
28
|
from .entry_level import EntryLevelSystem
|
|
23
29
|
from .errors import (
|
|
@@ -54,6 +60,51 @@ FETCH_ACCESS_TOKEN_MUTATION = gql(
|
|
|
54
60
|
"""
|
|
55
61
|
)
|
|
56
62
|
|
|
63
|
+
UPDATE_INFINITY_CONFIG_MUTATION = gql(
|
|
64
|
+
"""
|
|
65
|
+
mutation updateInfinityConfig($input: InfinityConfigInput!) {
|
|
66
|
+
updateInfinityConfig(input: $input) {
|
|
67
|
+
etag
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
"""
|
|
71
|
+
)
|
|
72
|
+
UPDATE_INFINITY_ZONE_ACTIVITY_MUTATION = gql(
|
|
73
|
+
"""
|
|
74
|
+
mutation updateInfinityZoneActivity($input: InfinityZoneActivityInput!) {
|
|
75
|
+
updateInfinityZoneActivity(input: $input) {
|
|
76
|
+
etag
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
"""
|
|
80
|
+
)
|
|
81
|
+
UPDATE_INFINITY_ZONE_CONFIG_MUTATION = gql(
|
|
82
|
+
"""
|
|
83
|
+
mutation updateInfinityZoneConfig($input: InfinityZoneConfigInput!) {
|
|
84
|
+
updateInfinityZoneConfig(input: $input) {
|
|
85
|
+
etag
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
"""
|
|
89
|
+
)
|
|
90
|
+
UPDATE_INFINITY_PROGRAM_DAY_MUTATION = gql(
|
|
91
|
+
"""
|
|
92
|
+
mutation updateInfinityProgramDay($input: InfinityProgramDayInput!) {
|
|
93
|
+
updateInfinityProgramDay(input: $input) {
|
|
94
|
+
id
|
|
95
|
+
etag
|
|
96
|
+
zoneId
|
|
97
|
+
period {
|
|
98
|
+
id
|
|
99
|
+
activity
|
|
100
|
+
time
|
|
101
|
+
enabled
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
"""
|
|
106
|
+
)
|
|
107
|
+
|
|
57
108
|
|
|
58
109
|
def _is_auth_transport_error(error: BaseException) -> bool:
|
|
59
110
|
"""Return whether a transport error represents Carrier auth rejection.
|
|
@@ -68,14 +119,32 @@ def _is_auth_transport_error(error: BaseException) -> bool:
|
|
|
68
119
|
return isinstance(error, TransportServerError) and error.code in _AUTH_HTTP_STATUSES
|
|
69
120
|
|
|
70
121
|
|
|
122
|
+
class _SharedPoolAIOHTTPTransport(AIOHTTPTransport):
|
|
123
|
+
"""``AIOHTTPTransport`` that also closes its session when it doesn't own the connector.
|
|
124
|
+
|
|
125
|
+
gql's ``AIOHTTPTransport.close()`` skips ``session.close()`` entirely when
|
|
126
|
+
``connector_owner`` is False. The request session is then garbage-collected
|
|
127
|
+
unclosed, and aiohttp reports "Unclosed client session" through the event
|
|
128
|
+
loop's exception handler on every request. Closing a session that doesn't
|
|
129
|
+
own its connector only detaches it, so the shared pool stays open.
|
|
130
|
+
"""
|
|
131
|
+
|
|
132
|
+
async def close(self) -> None:
|
|
133
|
+
"""Close the transport, then its request session if gql left it open."""
|
|
134
|
+
session = self.session
|
|
135
|
+
await super().close()
|
|
136
|
+
if session is not None and not session.closed:
|
|
137
|
+
await session.close()
|
|
138
|
+
|
|
139
|
+
|
|
71
140
|
class ApiConnectionGraphql:
|
|
72
141
|
"""Async Carrier GraphQL API connection with token and websocket support."""
|
|
73
142
|
|
|
74
|
-
expires_at: datetime
|
|
75
|
-
refresh_token: str | None
|
|
76
|
-
token_type: str | None
|
|
77
|
-
access_token: str | None
|
|
78
|
-
api_websocket: ApiWebsocket | None
|
|
143
|
+
expires_at: datetime
|
|
144
|
+
refresh_token: str | None
|
|
145
|
+
token_type: str | None
|
|
146
|
+
access_token: str | None
|
|
147
|
+
api_websocket: ApiWebsocket | None
|
|
79
148
|
|
|
80
149
|
def __init__(
|
|
81
150
|
self,
|
|
@@ -91,11 +160,18 @@ class ApiConnectionGraphql:
|
|
|
91
160
|
client_session: Optional aiohttp session to reuse. The websocket
|
|
92
161
|
connects through it, and GraphQL requests share its connection
|
|
93
162
|
pool (see ``_graphql_transport``). A new session is created
|
|
94
|
-
when omitted.
|
|
163
|
+
when omitted. ``cleanup`` only closes a session this
|
|
164
|
+
connection created, never one passed in here.
|
|
95
165
|
"""
|
|
96
166
|
self.username = username
|
|
97
167
|
self.password = password
|
|
168
|
+
self.expires_at = datetime.now(UTC)
|
|
169
|
+
self.refresh_token = None
|
|
170
|
+
self.token_type = None
|
|
171
|
+
self.access_token = None
|
|
172
|
+
self.api_websocket = None
|
|
98
173
|
self._auth_lock = Lock()
|
|
174
|
+
self._owns_session = client_session is None
|
|
99
175
|
if client_session is None:
|
|
100
176
|
self.api_session = ClientSession(raise_for_status=False)
|
|
101
177
|
else:
|
|
@@ -111,7 +187,9 @@ class ApiConnectionGraphql:
|
|
|
111
187
|
with ``connector_owner=False`` makes that per-request session a thin
|
|
112
188
|
wrapper over the shared pool (keep-alive connections, TLS setup and
|
|
113
189
|
connection limits), and keeps gql from closing the connector when the
|
|
114
|
-
request finishes.
|
|
190
|
+
request finishes. The transport still closes that request session (see
|
|
191
|
+
``_SharedPoolAIOHTTPTransport``). Without an open connector, gql falls back
|
|
192
|
+
to its own.
|
|
115
193
|
|
|
116
194
|
Args:
|
|
117
195
|
url: GraphQL endpoint URL.
|
|
@@ -124,7 +202,7 @@ class ApiConnectionGraphql:
|
|
|
124
202
|
client_session_args: dict[str, Any] | None = None
|
|
125
203
|
if connector is not None and not connector.closed:
|
|
126
204
|
client_session_args = {"connector": connector, "connector_owner": False}
|
|
127
|
-
return
|
|
205
|
+
return _SharedPoolAIOHTTPTransport(
|
|
128
206
|
url=url,
|
|
129
207
|
headers=headers,
|
|
130
208
|
ssl=True,
|
|
@@ -132,7 +210,19 @@ class ApiConnectionGraphql:
|
|
|
132
210
|
)
|
|
133
211
|
|
|
134
212
|
async def cleanup(self) -> None:
|
|
135
|
-
"""
|
|
213
|
+
"""Stop the websocket and close the aiohttp session if this connection owns it.
|
|
214
|
+
|
|
215
|
+
A session passed in as ``client_session`` belongs to the caller and is
|
|
216
|
+
left open.
|
|
217
|
+
|
|
218
|
+
Raises:
|
|
219
|
+
CarrierApiConnectionError: If closing the owned session fails.
|
|
220
|
+
"""
|
|
221
|
+
if self.api_websocket is not None:
|
|
222
|
+
await self.api_websocket.stop()
|
|
223
|
+
if not self._owns_session:
|
|
224
|
+
_LOGGER.debug("Leaving caller-provided aiohttp session open")
|
|
225
|
+
return
|
|
136
226
|
try:
|
|
137
227
|
await self.api_session.close()
|
|
138
228
|
except (ClientError, TimeoutError, OSError) as error:
|
|
@@ -208,8 +298,10 @@ class ApiConnectionGraphql:
|
|
|
208
298
|
async def check_auth_expiration(self) -> None:
|
|
209
299
|
"""Ensure the connection has a valid access token before API use.
|
|
210
300
|
|
|
211
|
-
|
|
212
|
-
|
|
301
|
+
The token is refreshed ``TOKEN_REFRESH_MARGIN_SECONDS`` before Carrier's
|
|
302
|
+
stated expiry, so a request in flight does not carry a token that
|
|
303
|
+
expires mid-request. Checks are serialized so concurrent callers never
|
|
304
|
+
send the same refresh token twice. When Carrier rejects the refresh token, the
|
|
213
305
|
connection falls back to one password login. Transient refresh
|
|
214
306
|
failures keep the stored token for the next attempt.
|
|
215
307
|
|
|
@@ -220,7 +312,8 @@ class ApiConnectionGraphql:
|
|
|
220
312
|
async with self._auth_lock:
|
|
221
313
|
if self.refresh_token is None:
|
|
222
314
|
await self.login()
|
|
223
|
-
|
|
315
|
+
refresh_after = self.expires_at - timedelta(seconds=TOKEN_REFRESH_MARGIN_SECONDS)
|
|
316
|
+
if refresh_after < datetime.now(UTC):
|
|
224
317
|
try:
|
|
225
318
|
await self.refresh_auth_token()
|
|
226
319
|
except CarrierApiAuthError:
|
|
@@ -296,6 +389,10 @@ class ApiConnectionGraphql:
|
|
|
296
389
|
) -> dict[str, Any]:
|
|
297
390
|
"""Execute an authenticated Carrier GraphQL operation.
|
|
298
391
|
|
|
392
|
+
If Carrier rejects the access token with HTTP 401 or 403, for example
|
|
393
|
+
because it was revoked before its stated expiry, the token is refreshed
|
|
394
|
+
once and the operation is retried.
|
|
395
|
+
|
|
299
396
|
Args:
|
|
300
397
|
operation_name: GraphQL operation name to execute.
|
|
301
398
|
query: Parsed GraphQL request.
|
|
@@ -303,8 +400,55 @@ class ApiConnectionGraphql:
|
|
|
303
400
|
|
|
304
401
|
Returns:
|
|
305
402
|
The decoded GraphQL response data.
|
|
403
|
+
|
|
404
|
+
Raises:
|
|
405
|
+
CarrierApiAuthError: If Carrier still rejects the request after the
|
|
406
|
+
token is refreshed, or the fallback login is rejected.
|
|
306
407
|
"""
|
|
307
408
|
await self.check_auth_expiration()
|
|
409
|
+
rejected_access_token = self.access_token
|
|
410
|
+
try:
|
|
411
|
+
return await self._execute_authed_query(operation_name, query, variable_values)
|
|
412
|
+
except CarrierApiAuthError:
|
|
413
|
+
_LOGGER.info(
|
|
414
|
+
"Carrier rejected the access token during %s; refreshing and retrying once",
|
|
415
|
+
operation_name,
|
|
416
|
+
)
|
|
417
|
+
await self._expire_access_token(rejected_access_token)
|
|
418
|
+
await self.check_auth_expiration()
|
|
419
|
+
return await self._execute_authed_query(operation_name, query, variable_values)
|
|
420
|
+
|
|
421
|
+
async def _expire_access_token(self, rejected_access_token: str | None) -> None:
|
|
422
|
+
"""Mark a rejected access token as expired so the next check refreshes it.
|
|
423
|
+
|
|
424
|
+
Only the token that was rejected is expired. If a concurrent caller has
|
|
425
|
+
already replaced it, the new token is kept.
|
|
426
|
+
|
|
427
|
+
Args:
|
|
428
|
+
rejected_access_token: Access token Carrier rejected.
|
|
429
|
+
"""
|
|
430
|
+
async with self._auth_lock:
|
|
431
|
+
if self.access_token == rejected_access_token:
|
|
432
|
+
self.expires_at = datetime.now(UTC) - timedelta(seconds=1)
|
|
433
|
+
|
|
434
|
+
async def _execute_authed_query(
|
|
435
|
+
self, operation_name: str, query: GraphQLRequest, variable_values: dict[str, Any]
|
|
436
|
+
) -> dict[str, Any]:
|
|
437
|
+
"""Send one authenticated GraphQL operation with the current access token.
|
|
438
|
+
|
|
439
|
+
Args:
|
|
440
|
+
operation_name: GraphQL operation name to execute.
|
|
441
|
+
query: Parsed GraphQL request.
|
|
442
|
+
variable_values: Variables to send with the operation.
|
|
443
|
+
|
|
444
|
+
Returns:
|
|
445
|
+
The decoded GraphQL response data.
|
|
446
|
+
|
|
447
|
+
Raises:
|
|
448
|
+
CarrierApiAuthError: If Carrier rejects the access token.
|
|
449
|
+
CarrierApiConnectionError: If the request fails in transport.
|
|
450
|
+
CarrierApiGraphqlError: If Carrier returns GraphQL errors.
|
|
451
|
+
"""
|
|
308
452
|
transport = self._graphql_transport(
|
|
309
453
|
"https://dataservice.infinity.iot.carrier.com/graphql",
|
|
310
454
|
headers={"Authorization": f"{self.token_type} {self.access_token}"},
|
|
@@ -805,27 +949,22 @@ class ApiConnectionGraphql:
|
|
|
805
949
|
"""
|
|
806
950
|
return await self.update_entry_level_zone(serial, index, schedule_enabled=True)
|
|
807
951
|
|
|
808
|
-
async def
|
|
809
|
-
|
|
952
|
+
async def _run_infinity_mutation(
|
|
953
|
+
self, operation_name: str, query: GraphQLRequest, variables: dict[str, Any]
|
|
954
|
+
) -> dict[str, Any]:
|
|
955
|
+
"""Run a Carrier Infinity mutation, then ask the websocket to reconcile.
|
|
810
956
|
|
|
811
957
|
Args:
|
|
812
|
-
|
|
958
|
+
operation_name: GraphQL mutation operation name.
|
|
959
|
+
query: Parsed GraphQL mutation.
|
|
960
|
+
variables: GraphQL variables for the mutation.
|
|
813
961
|
|
|
814
962
|
Returns:
|
|
815
963
|
The decoded mutation response.
|
|
816
964
|
"""
|
|
817
|
-
|
|
818
|
-
"""
|
|
819
|
-
mutation updateInfinityConfig($input: InfinityConfigInput!) {
|
|
820
|
-
updateInfinityConfig(input: $input) {
|
|
821
|
-
etag
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
"""
|
|
825
|
-
)
|
|
826
|
-
_LOGGER.debug("updateInfinityConfig: %s", variables)
|
|
965
|
+
_LOGGER.debug("%s: %s", operation_name, variables)
|
|
827
966
|
response = await self.authed_query(
|
|
828
|
-
operation_name=
|
|
967
|
+
operation_name=operation_name, query=query, variable_values=variables
|
|
829
968
|
)
|
|
830
969
|
if self.api_websocket is not None:
|
|
831
970
|
await self.api_websocket.send_reconcile()
|
|
@@ -833,34 +972,31 @@ class ApiConnectionGraphql:
|
|
|
833
972
|
_LOGGER.warning("No API websocket connection")
|
|
834
973
|
return response
|
|
835
974
|
|
|
975
|
+
async def _update_infinity_config(self, variables: dict[str, Any]) -> dict[str, Any]:
|
|
976
|
+
"""Run the Carrier system-level configuration mutation.
|
|
977
|
+
|
|
978
|
+
Args:
|
|
979
|
+
variables: GraphQL variables containing an ``InfinityConfigInput``.
|
|
980
|
+
|
|
981
|
+
Returns:
|
|
982
|
+
The decoded mutation response.
|
|
983
|
+
"""
|
|
984
|
+
return await self._run_infinity_mutation(
|
|
985
|
+
"updateInfinityConfig", UPDATE_INFINITY_CONFIG_MUTATION, variables
|
|
986
|
+
)
|
|
987
|
+
|
|
836
988
|
async def _update_infinity_zone_activity(self, variables: dict[str, Any]) -> dict[str, Any]:
|
|
837
989
|
"""Run the Carrier zone activity configuration mutation.
|
|
838
990
|
|
|
839
991
|
Args:
|
|
840
|
-
variables: GraphQL variables containing an
|
|
841
|
-
``InfinityZoneActivityInput``.
|
|
992
|
+
variables: GraphQL variables containing an ``InfinityZoneActivityInput``.
|
|
842
993
|
|
|
843
994
|
Returns:
|
|
844
995
|
The decoded mutation response.
|
|
845
996
|
"""
|
|
846
|
-
|
|
847
|
-
""
|
|
848
|
-
mutation updateInfinityZoneActivity($input: InfinityZoneActivityInput!) {
|
|
849
|
-
updateInfinityZoneActivity(input: $input) {
|
|
850
|
-
etag
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
"""
|
|
854
|
-
)
|
|
855
|
-
_LOGGER.debug("updateInfinityZoneActivity: %s", variables)
|
|
856
|
-
response = await self.authed_query(
|
|
857
|
-
operation_name="updateInfinityZoneActivity", query=query, variable_values=variables
|
|
997
|
+
return await self._run_infinity_mutation(
|
|
998
|
+
"updateInfinityZoneActivity", UPDATE_INFINITY_ZONE_ACTIVITY_MUTATION, variables
|
|
858
999
|
)
|
|
859
|
-
if self.api_websocket is not None:
|
|
860
|
-
await self.api_websocket.send_reconcile()
|
|
861
|
-
else:
|
|
862
|
-
_LOGGER.warning("No API websocket connection")
|
|
863
|
-
return response
|
|
864
1000
|
|
|
865
1001
|
async def _update_infinity_zone_config(self, variables: dict[str, Any]) -> dict[str, Any]:
|
|
866
1002
|
"""Run the Carrier zone configuration mutation.
|
|
@@ -871,24 +1007,9 @@ class ApiConnectionGraphql:
|
|
|
871
1007
|
Returns:
|
|
872
1008
|
The decoded mutation response.
|
|
873
1009
|
"""
|
|
874
|
-
|
|
875
|
-
""
|
|
876
|
-
mutation updateInfinityZoneConfig($input: InfinityZoneConfigInput!) {
|
|
877
|
-
updateInfinityZoneConfig(input: $input) {
|
|
878
|
-
etag
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
"""
|
|
1010
|
+
return await self._run_infinity_mutation(
|
|
1011
|
+
"updateInfinityZoneConfig", UPDATE_INFINITY_ZONE_CONFIG_MUTATION, variables
|
|
882
1012
|
)
|
|
883
|
-
_LOGGER.debug("updateInfinityZoneConfig: %s", variables)
|
|
884
|
-
response = await self.authed_query(
|
|
885
|
-
operation_name="updateInfinityZoneConfig", query=query, variable_values=variables
|
|
886
|
-
)
|
|
887
|
-
if self.api_websocket is not None:
|
|
888
|
-
await self.api_websocket.send_reconcile()
|
|
889
|
-
else:
|
|
890
|
-
_LOGGER.warning("No API websocket connection")
|
|
891
|
-
return response
|
|
892
1013
|
|
|
893
1014
|
async def _update_infinity_program_day(self, variables: dict[str, Any]) -> dict[str, Any]:
|
|
894
1015
|
"""Run the Carrier zone program day mutation.
|
|
@@ -899,32 +1020,9 @@ class ApiConnectionGraphql:
|
|
|
899
1020
|
Returns:
|
|
900
1021
|
The decoded mutation response.
|
|
901
1022
|
"""
|
|
902
|
-
|
|
903
|
-
""
|
|
904
|
-
mutation updateInfinityProgramDay($input: InfinityProgramDayInput!) {
|
|
905
|
-
updateInfinityProgramDay(input: $input) {
|
|
906
|
-
id
|
|
907
|
-
etag
|
|
908
|
-
zoneId
|
|
909
|
-
period {
|
|
910
|
-
id
|
|
911
|
-
activity
|
|
912
|
-
time
|
|
913
|
-
enabled
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
"""
|
|
1023
|
+
return await self._run_infinity_mutation(
|
|
1024
|
+
"updateInfinityProgramDay", UPDATE_INFINITY_PROGRAM_DAY_MUTATION, variables
|
|
918
1025
|
)
|
|
919
|
-
_LOGGER.debug("updateInfinityProgramDay: %s", variables)
|
|
920
|
-
response = await self.authed_query(
|
|
921
|
-
operation_name="updateInfinityProgramDay", query=query, variable_values=variables
|
|
922
|
-
)
|
|
923
|
-
if self.api_websocket is not None:
|
|
924
|
-
await self.api_websocket.send_reconcile()
|
|
925
|
-
else:
|
|
926
|
-
_LOGGER.warning("No API websocket connection")
|
|
927
|
-
return response
|
|
928
1026
|
|
|
929
1027
|
async def set_config_mode(self, system_serial: str, mode: SystemModes) -> dict[str, Any]:
|
|
930
1028
|
"""Update a Carrier system's operating mode.
|