Skip to content

Commit

Permalink
X
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewturner committed Feb 16, 2024
1 parent edabba6 commit b4a9d63
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 7 deletions.
7 changes: 0 additions & 7 deletions .vscode/settings.json

This file was deleted.

2 changes: 2 additions & 0 deletions salusfy/simulator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .temperature_client import TemperatureClient
from .web_client import WebClient
9 changes: 9 additions & 0 deletions salusfy/simulator/temperature_client.py
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
52 changes: 52 additions & 0 deletions salusfy/simulator/web_client.py
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

0 comments on commit b4a9d63

Please sign in to comment.