forked from floringhimie/salusfy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edabba6
commit b4a9d63
Showing
4 changed files
with
63 additions
and
7 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .temperature_client import TemperatureClient | ||
from .web_client import WebClient |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
""" | ||
Adds support for simulating the Salus Thermostats. | ||
""" | ||
class TemperatureClient: | ||
def __init__(self): | ||
pass | ||
|
||
def current_temperature(self): | ||
return 15.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
Adds support for simulating the Salus Thermostats. | ||
""" | ||
import logging | ||
|
||
from homeassistant.components.climate.const import ( | ||
HVACMode, | ||
) | ||
|
||
from .. import ( | ||
State, | ||
STATE_ON, | ||
STATE_OFF | ||
) | ||
|
||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class WebClient: | ||
"""Mocks requests to Salus web application""" | ||
|
||
def __init__(self): | ||
"""Initialize the client.""" | ||
self._state = State() | ||
self._state.target_temperature = 20.1 | ||
self._state.current_temperature = 15.1 | ||
self._state.frost = 10.1 | ||
|
||
|
||
def set_temperature(self, temperature): | ||
"""Set new target temperature.""" | ||
|
||
_LOGGER.info("Setting temperature to %.1f...", temperature) | ||
|
||
self._state.target_temperature = temperature | ||
|
||
|
||
def set_hvac_mode(self, hvac_mode): | ||
"""Set HVAC mode, via URL commands.""" | ||
|
||
_LOGGER.info("Setting the HVAC mode to %s...", hvac_mode) | ||
|
||
if hvac_mode == HVACMode.OFF: | ||
self._state.current_operation_mode = STATE_OFF | ||
elif hvac_mode == HVACMode.HEAT: | ||
self._state.current_operation_mode = STATE_ON | ||
|
||
|
||
def get_state(self): | ||
"""Retrieves the mock status""" | ||
return self._state |