Skip to content
This repository was archived by the owner on Jun 28, 2024. It is now read-only.

Commit 983db6f

Browse files
Remove thermostats.set_mode + test (#105)
1 parent bbad5c7 commit 983db6f

File tree

2 files changed

+0
-78
lines changed

2 files changed

+0
-78
lines changed

seamapi/thermostats.py

-67
Original file line numberDiff line numberDiff line change
@@ -184,70 +184,3 @@ def update(
184184
)
185185

186186
return True
187-
188-
@report_error
189-
def set_mode(
190-
self,
191-
device: Union[DeviceId, Device],
192-
automatic_heating_enabled: Optional[bool] = None,
193-
automatic_cooling_enabled: Optional[bool] = None,
194-
hvac_mode_setting: Optional[str] = None,
195-
wait_for_action_attempt: Optional[bool] = True,
196-
) -> ActionAttempt:
197-
"""Sets a thermostat to a given mode.
198-
199-
Parameters
200-
----------
201-
device : DeviceId or Device
202-
Device id or Device to update
203-
automatic_heating_enabled : bool, optional
204-
Enable automatic heating
205-
automatic_cooling_enabled : bool, optional
206-
Enable cooling heating
207-
hvac_mode_setting : str, optional
208-
HVAC mode eg. "heat", "cool", "heatcool" or "off"
209-
wait_for_action_attempt: bool, optional
210-
Should wait for action attempt to resolve
211-
212-
Raises
213-
------
214-
Exception
215-
If the API request wasn't successful.
216-
217-
Returns
218-
------
219-
ActionAttempt
220-
"""
221-
222-
if not device:
223-
raise Exception("Device is required")
224-
225-
params = {
226-
"device_id": to_device_id(device),
227-
}
228-
229-
arguments = {
230-
"automatic_heating_enabled": automatic_heating_enabled,
231-
"automatic_cooling_enabled": automatic_cooling_enabled,
232-
"hvac_mode_setting": hvac_mode_setting,
233-
}
234-
235-
for name in arguments:
236-
if arguments[name]:
237-
params.update({name: arguments[name]})
238-
239-
res = self.seam.make_request(
240-
"POST",
241-
"/thermostats/set_mode",
242-
json=params,
243-
)
244-
action_attempt = res["action_attempt"]
245-
246-
if not wait_for_action_attempt:
247-
return ActionAttempt.from_dict(action_attempt)
248-
249-
updated_action_attempt = self.seam.action_attempts.poll_until_ready(
250-
action_attempt["action_attempt_id"]
251-
)
252-
253-
return ActionAttempt.from_dict(updated_action_attempt)

tests/thermostats/test_thermostats.py

-11
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,3 @@ def test_thermostats(seam: Seam):
2929
)
3030

3131
assert result == True
32-
33-
assert (
34-
thermostat.properties.current_climate_setting.hvac_mode_setting
35-
== "heatcool"
36-
)
37-
seam.thermostats.set_mode(device=thermostat, hvac_mode_setting="heat")
38-
updated_thermostat = seam.thermostats.get(thermostat.device_id)
39-
assert (
40-
updated_thermostat.properties.current_climate_setting.hvac_mode_setting
41-
== "heat"
42-
)

0 commit comments

Comments
 (0)