Skip to content

Commit

Permalink
Fix linting errors (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturner authored Mar 1, 2024
1 parent 86df172 commit fcdb1bc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion salusfy/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=

def create_client_from(config) -> Client:
"""Creates a client object based on the specified configuration"""

username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)
device_id = config.get(CONF_ID)
Expand Down
2 changes: 2 additions & 0 deletions salusfy/ha_temperature_client.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
"""Reduces reliance on the Salus API"""
import aiohttp


class HaTemperatureClient:
"""
Retrieves the current temperature from
another entity from the Home Assistant API
"""

def __init__(self, host, entity_id, access_token):
self._entity_id = entity_id
self._host = host
Expand Down
1 change: 1 addition & 0 deletions salusfy/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import dataclasses


@dataclasses.dataclass
class State:
"""The state of the thermostat."""
Expand Down
8 changes: 8 additions & 0 deletions tests/test_web_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from salusfy import WebClient


@pytest.fixture
def payload() -> dict:
"""Returns the default data for the tests"""
Expand All @@ -19,21 +20,25 @@ def payload() -> dict:
'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"
Expand All @@ -42,6 +47,7 @@ def test_hvac_action_is_heating(payload):

assert actual.action == HVACAction.HEATING


def test_hvac_action_is_off(payload):
payload['CH1heatOnOffStatus'] = "0"
payload['CH1heatOnOff'] = "1"
Expand All @@ -50,6 +56,7 @@ def test_hvac_action_is_off(payload):

assert actual.action == HVACAction.IDLE


def test_hvac_mode_is_off(payload):
payload['CH1heatOnOffStatus'] = "1"
payload['CH1heatOnOff'] = "1"
Expand All @@ -58,6 +65,7 @@ def test_hvac_mode_is_off(payload):

assert actual.mode == HVACMode.OFF


def test_hvac_mode_is_heat(payload):
payload['CH1heatOnOffStatus'] = "1"
payload['CH1heatOnOff'] = "0"
Expand Down

0 comments on commit fcdb1bc

Please sign in to comment.