pypetkitapi 0.5.3__py3-none-any.whl → 0.5.4__py3-none-any.whl
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.
- pypetkitapi/client.py +2 -2
- pypetkitapi/command.py +17 -86
- {pypetkitapi-0.5.3.dist-info → pypetkitapi-0.5.4.dist-info}/METADATA +1 -1
- {pypetkitapi-0.5.3.dist-info → pypetkitapi-0.5.4.dist-info}/RECORD +6 -6
- {pypetkitapi-0.5.3.dist-info → pypetkitapi-0.5.4.dist-info}/LICENSE +0 -0
- {pypetkitapi-0.5.3.dist-info → pypetkitapi-0.5.4.dist-info}/WHEEL +0 -0
pypetkitapi/client.py
CHANGED
@@ -280,7 +280,7 @@ class PetKitClient:
|
|
280
280
|
self,
|
281
281
|
device_id: int,
|
282
282
|
action: StrEnum,
|
283
|
-
setting: dict |
|
283
|
+
setting: dict | None = None,
|
284
284
|
) -> None:
|
285
285
|
"""Control the device using the PetKit API."""
|
286
286
|
device = self.device_list.get(device_id)
|
@@ -333,7 +333,7 @@ class PetKitClient:
|
|
333
333
|
headers=headers,
|
334
334
|
)
|
335
335
|
if res in (SUCCESS_KEY, RES_KEY):
|
336
|
-
# TODO : Manage to get the response from
|
336
|
+
# TODO : Manage to get the response from manual feeding
|
337
337
|
_LOGGER.info("Command executed successfully")
|
338
338
|
else:
|
339
339
|
_LOGGER.error("Command execution failed")
|
pypetkitapi/command.py
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
from collections.abc import Callable
|
4
4
|
from dataclasses import dataclass, field
|
5
5
|
import datetime
|
6
|
-
from enum import StrEnum
|
6
|
+
from enum import IntEnum, StrEnum
|
7
7
|
import json
|
8
8
|
|
9
9
|
from pypetkitapi.const import (
|
@@ -62,27 +62,22 @@ class FountainCommand(StrEnum):
|
|
62
62
|
CONTROL_DEVICE = "control_device"
|
63
63
|
|
64
64
|
|
65
|
-
class
|
65
|
+
class LBCommand(IntEnum):
|
66
66
|
"""LitterBoxCommand"""
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
RESUME_LITTER_DUMP = "resume_litter_dump"
|
82
|
-
RESET_MAX_DEODOR = "reset_max_deodorizer"
|
83
|
-
|
84
|
-
|
85
|
-
class LitterBoxCommandKey(StrEnum):
|
68
|
+
CLEANING = 0
|
69
|
+
DUMPING = 1
|
70
|
+
ODOR_REMOVAL = 2
|
71
|
+
RESETTING = 3
|
72
|
+
LEVELING = 4
|
73
|
+
CALIBRATING = 5
|
74
|
+
RESET_DEODOR = 6
|
75
|
+
LIGHT = 7
|
76
|
+
RESET_MAX_DEODOR = 8
|
77
|
+
MAINTENANCE = 9
|
78
|
+
|
79
|
+
|
80
|
+
class LBAction(StrEnum):
|
86
81
|
"""LitterBoxCommandKey"""
|
87
82
|
|
88
83
|
CONTINUE = "continue_action"
|
@@ -92,70 +87,6 @@ class LitterBoxCommandKey(StrEnum):
|
|
92
87
|
STOP = "stop_action"
|
93
88
|
|
94
89
|
|
95
|
-
class LitterBoxCommandType(StrEnum):
|
96
|
-
"""LitterBoxCommandType"""
|
97
|
-
|
98
|
-
CONTINUE = "continue"
|
99
|
-
END = "end"
|
100
|
-
POWER = "power"
|
101
|
-
START = "start"
|
102
|
-
STOP = "stop"
|
103
|
-
|
104
|
-
|
105
|
-
LB_CMD_TO_KEY = {
|
106
|
-
LitterBoxCommand.LIGHT_ON: LitterBoxCommandKey.START,
|
107
|
-
LitterBoxCommand.POWER: LitterBoxCommandKey.POWER,
|
108
|
-
LitterBoxCommand.START_CLEAN: LitterBoxCommandKey.START,
|
109
|
-
LitterBoxCommand.PAUSE_CLEAN: LitterBoxCommandKey.STOP,
|
110
|
-
LitterBoxCommand.RESUME_CLEAN: LitterBoxCommandKey.CONTINUE,
|
111
|
-
LitterBoxCommand.ODOR_REMOVAL: LitterBoxCommandKey.START,
|
112
|
-
LitterBoxCommand.RESET_DEODOR: LitterBoxCommandKey.START,
|
113
|
-
LitterBoxCommand.START_MAINTENANCE: LitterBoxCommandKey.START,
|
114
|
-
LitterBoxCommand.EXIT_MAINTENANCE: LitterBoxCommandKey.END,
|
115
|
-
LitterBoxCommand.PAUSE_MAINTENANCE_EXIT: LitterBoxCommandKey.STOP,
|
116
|
-
LitterBoxCommand.RESUME_MAINTENANCE_EXIT: LitterBoxCommandKey.CONTINUE,
|
117
|
-
LitterBoxCommand.DUMP_LITTER: LitterBoxCommandKey.START,
|
118
|
-
LitterBoxCommand.PAUSE_LITTER_DUMP: LitterBoxCommandKey.STOP,
|
119
|
-
LitterBoxCommand.RESUME_LITTER_DUMP: LitterBoxCommandKey.CONTINUE,
|
120
|
-
LitterBoxCommand.RESET_MAX_DEODOR: LitterBoxCommandKey.START,
|
121
|
-
}
|
122
|
-
|
123
|
-
LB_CMD_TO_TYPE = {
|
124
|
-
LitterBoxCommand.LIGHT_ON: LitterBoxCommandType.START,
|
125
|
-
LitterBoxCommand.POWER: LitterBoxCommandType.POWER,
|
126
|
-
LitterBoxCommand.START_CLEAN: LitterBoxCommandType.START,
|
127
|
-
LitterBoxCommand.PAUSE_CLEAN: LitterBoxCommandType.STOP,
|
128
|
-
LitterBoxCommand.RESUME_CLEAN: LitterBoxCommandType.CONTINUE,
|
129
|
-
LitterBoxCommand.ODOR_REMOVAL: LitterBoxCommandType.START,
|
130
|
-
LitterBoxCommand.RESET_DEODOR: LitterBoxCommandType.START,
|
131
|
-
LitterBoxCommand.START_MAINTENANCE: LitterBoxCommandType.START,
|
132
|
-
LitterBoxCommand.EXIT_MAINTENANCE: LitterBoxCommandType.END,
|
133
|
-
LitterBoxCommand.PAUSE_MAINTENANCE_EXIT: LitterBoxCommandType.STOP,
|
134
|
-
LitterBoxCommand.RESUME_MAINTENANCE_EXIT: LitterBoxCommandType.CONTINUE,
|
135
|
-
LitterBoxCommand.DUMP_LITTER: LitterBoxCommandType.START,
|
136
|
-
LitterBoxCommand.PAUSE_LITTER_DUMP: LitterBoxCommandType.STOP,
|
137
|
-
LitterBoxCommand.RESUME_LITTER_DUMP: LitterBoxCommandType.CONTINUE,
|
138
|
-
LitterBoxCommand.RESET_MAX_DEODOR: LitterBoxCommandType.START,
|
139
|
-
}
|
140
|
-
|
141
|
-
LB_CMD_TO_VALUE = {
|
142
|
-
LitterBoxCommand.LIGHT_ON: 7,
|
143
|
-
LitterBoxCommand.START_CLEAN: 0,
|
144
|
-
LitterBoxCommand.PAUSE_CLEAN: 0,
|
145
|
-
LitterBoxCommand.RESUME_CLEAN: 0,
|
146
|
-
LitterBoxCommand.ODOR_REMOVAL: 2,
|
147
|
-
LitterBoxCommand.RESET_DEODOR: 6,
|
148
|
-
LitterBoxCommand.START_MAINTENANCE: 9,
|
149
|
-
LitterBoxCommand.EXIT_MAINTENANCE: 9,
|
150
|
-
LitterBoxCommand.PAUSE_MAINTENANCE_EXIT: 9,
|
151
|
-
LitterBoxCommand.RESUME_MAINTENANCE_EXIT: 9,
|
152
|
-
LitterBoxCommand.DUMP_LITTER: 1,
|
153
|
-
LitterBoxCommand.PAUSE_LITTER_DUMP: 1,
|
154
|
-
LitterBoxCommand.RESUME_LITTER_DUMP: 1,
|
155
|
-
LitterBoxCommand.RESET_MAX_DEODOR: 8,
|
156
|
-
}
|
157
|
-
|
158
|
-
|
159
90
|
class FountainAction(StrEnum):
|
160
91
|
"""Fountain Action"""
|
161
92
|
|
@@ -317,8 +248,8 @@ ACTIONS_MAP = {
|
|
317
248
|
endpoint=PetkitEndpoint.CONTROL_DEVICE,
|
318
249
|
params=lambda device, command: {
|
319
250
|
"id": device.id,
|
320
|
-
"kv": json.dumps(
|
321
|
-
"type":
|
251
|
+
"kv": json.dumps(command),
|
252
|
+
"type": list(command.keys())[0].split("_")[0],
|
322
253
|
},
|
323
254
|
supported_device=[T3, T4, T5, T6],
|
324
255
|
),
|
@@ -1,6 +1,6 @@
|
|
1
1
|
pypetkitapi/__init__.py,sha256=eVpyGMD3tkYtiHUkdKEeNSZhQlZ4woI2Y5oVoV7CwXM,61
|
2
|
-
pypetkitapi/client.py,sha256=
|
3
|
-
pypetkitapi/command.py,sha256=
|
2
|
+
pypetkitapi/client.py,sha256=yj-jf6H2lWsKhRpqo2s3mbfTfXUj9oCCqzcwMhVjAx4,14936
|
3
|
+
pypetkitapi/command.py,sha256=dlLOPQsDcO2X0tO4fJlJgQ7QVcNRvsBswc1WwMjxYxE,7424
|
4
4
|
pypetkitapi/const.py,sha256=B4uf3RGEkKmpVOo69DRP9g8hF_bodCA7vohnPjnrPFs,3183
|
5
5
|
pypetkitapi/containers.py,sha256=4O79O9HZn4kksQysXGXcqVwvkdxbvhs1pr-0WRNCANc,3425
|
6
6
|
pypetkitapi/exceptions.py,sha256=NWmpsI2ewC4HaIeu_uFwCeuPIHIJxZBzjoCP7aNwvhs,1139
|
@@ -8,7 +8,7 @@ pypetkitapi/feeder_container.py,sha256=6a1Y_mTSGuD8qK1YqmiCfxPbZl84bcoIIP_d5g-Uc
|
|
8
8
|
pypetkitapi/litter_container.py,sha256=baeIihndFfU5F3kxtyO8Dm1qx1mPuMAUIYRH60CV3GM,9447
|
9
9
|
pypetkitapi/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
10
10
|
pypetkitapi/water_fountain_container.py,sha256=LcCTDjk7eSbnF7e38xev3D5mCv5wwJ6go8WGGBv-CaU,5278
|
11
|
-
pypetkitapi-0.5.
|
12
|
-
pypetkitapi-0.5.
|
13
|
-
pypetkitapi-0.5.
|
14
|
-
pypetkitapi-0.5.
|
11
|
+
pypetkitapi-0.5.4.dist-info/LICENSE,sha256=4FWnKolNLc1e3w6cVlT61YxfPh0DQNeQLN1CepKKSBg,1067
|
12
|
+
pypetkitapi-0.5.4.dist-info/METADATA,sha256=0rULLocj_iIqYQhyXrZoudOQihTXgxqYKwdvgbvxM4w,3611
|
13
|
+
pypetkitapi-0.5.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
14
|
+
pypetkitapi-0.5.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|