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
36337a5
commit 86df172
Showing
2 changed files
with
80 additions
and
4 deletions.
There are no files selected for viewing
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
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,67 @@ | ||
import pytest | ||
|
||
from homeassistant.components.climate.const import ( | ||
HVACMode, | ||
HVACAction | ||
) | ||
|
||
from salusfy import WebClient | ||
|
||
@pytest.fixture | ||
def payload() -> dict: | ||
"""Returns the default data for the tests""" | ||
return { | ||
'CH1currentSetPoint': 20.1, | ||
'CH1currentRoomTemp': 15.2, | ||
'frost': 8.5, | ||
'CH1heatOnOffStatus': "1", | ||
'CH1heatOnOff': "1", | ||
'CH1autoMode': "1" | ||
} | ||
|
||
def test_extract_target_temperature(payload): | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.target_temperature == 20.1 | ||
|
||
def test_extract_current_temperature(payload): | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.current_temperature == 15.2 | ||
|
||
def test_extract_frost(payload): | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.frost == 8.5 | ||
|
||
def test_hvac_action_is_heating(payload): | ||
payload['CH1heatOnOffStatus'] = "1" | ||
payload['CH1heatOnOff'] = "1" | ||
payload['CH1autoMode'] = "1" | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.action == HVACAction.HEATING | ||
|
||
def test_hvac_action_is_off(payload): | ||
payload['CH1heatOnOffStatus'] = "0" | ||
payload['CH1heatOnOff'] = "1" | ||
payload['CH1autoMode'] = "1" | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.action == HVACAction.IDLE | ||
|
||
def test_hvac_mode_is_off(payload): | ||
payload['CH1heatOnOffStatus'] = "1" | ||
payload['CH1heatOnOff'] = "1" | ||
payload['CH1autoMode'] = "1" | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.mode == HVACMode.OFF | ||
|
||
def test_hvac_mode_is_heat(payload): | ||
payload['CH1heatOnOffStatus'] = "1" | ||
payload['CH1heatOnOff'] = "0" | ||
payload['CH1autoMode'] = "1" | ||
actual = WebClient.convert_to_state(payload) | ||
|
||
assert actual.mode == HVACMode.HEAT |