@@ -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 )
0 commit comments