Skip to content

Commit

Permalink
Reorder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
frwickst committed Jan 29, 2022
1 parent 7dd96ab commit 79f3623
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions huum/huum.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,6 @@ async def _check_door(self) -> None:
if not status.door_closed:
raise SafetyException("Can not start sauna when door is open")

async def status(self) -> HuumStatusResponse:
"""
Get the status of the Sauna
Returns:
A `HuumStatusResponse` from the Huum API
"""
url = urljoin(API_BASE, "status")

response = await self.session.get(url, auth=self.auth)
json_data = await self.handle_response(response)

return HuumStatusResponse(**json_data)

async def turn_on(
self, temperature: int, safety_override: bool = False
) -> HuumStatusResponse:
Expand Down Expand Up @@ -115,6 +101,21 @@ async def turn_on(

return HuumStatusResponse(**json_data)

async def turn_off(self) -> HuumStatusResponse:
"""
Turns off the sauna
Returns:
A `HuumStatusResponse` from the Huum API
"""
url = urljoin(API_BASE, "stop")

response = await self.session.post(url, auth=self.auth)
json_data = await self.handle_response(response)

return HuumStatusResponse(**json_data)

async def set_temperature(
self, temperature: int, safety_override: bool = False
) -> HuumStatusResponse:
Expand All @@ -134,17 +135,16 @@ async def set_temperature(
"""
return await self.turn_on(temperature, safety_override)

async def turn_off(self) -> HuumStatusResponse:
async def status(self) -> HuumStatusResponse:
"""
Turns off the sauna
Get the status of the Sauna
Returns:
A `HuumStatusResponse` from the Huum API
"""
url = urljoin(API_BASE, "stop")
url = urljoin(API_BASE, "status")

response = await self.session.post(url, auth=self.auth)
response = await self.session.get(url, auth=self.auth)
json_data = await self.handle_response(response)

return HuumStatusResponse(**json_data)
Expand Down

0 comments on commit 79f3623

Please sign in to comment.