mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
Honeywell hvac mode (#2757)
* Add set hvac mode to honeywell us thermostat * Add hvac service to the HoneywellRound entity * Fix pydoc * Add typing * Typing to unit test
This commit is contained in:
parent
5445aafee7
commit
7e37634b54
@ -136,11 +136,20 @@ class RoundThermostat(ThermostatDevice):
|
|||||||
"""Set new target temperature."""
|
"""Set new target temperature."""
|
||||||
self.device.set_temperature(self._name, temperature)
|
self.device.set_temperature(self._name, temperature)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def operation(self: ThermostatDevice) -> str:
|
||||||
|
"""Get the current operation of the system."""
|
||||||
|
return self.device.system_mode
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_away_mode_on(self):
|
def is_away_mode_on(self):
|
||||||
"""Return true if away mode is on."""
|
"""Return true if away mode is on."""
|
||||||
return self._away
|
return self._away
|
||||||
|
|
||||||
|
def set_hvac_mode(self: ThermostatDevice, hvac_mode: str) -> None:
|
||||||
|
"""Set the HVAC mode for the thermostat."""
|
||||||
|
self.device.system_mode = hvac_mode
|
||||||
|
|
||||||
def turn_away_mode_on(self):
|
def turn_away_mode_on(self):
|
||||||
"""Turn away on.
|
"""Turn away on.
|
||||||
|
|
||||||
@ -219,6 +228,11 @@ class HoneywellUSThermostat(ThermostatDevice):
|
|||||||
else:
|
else:
|
||||||
return self._device.setpoint_heat
|
return self._device.setpoint_heat
|
||||||
|
|
||||||
|
@property
|
||||||
|
def operation(self: ThermostatDevice) -> str:
|
||||||
|
"""Return current operation ie. heat, cool, idle."""
|
||||||
|
return self._device.system_mode
|
||||||
|
|
||||||
def set_temperature(self, temperature):
|
def set_temperature(self, temperature):
|
||||||
"""Set target temperature."""
|
"""Set target temperature."""
|
||||||
import somecomfort
|
import somecomfort
|
||||||
@ -244,3 +258,7 @@ class HoneywellUSThermostat(ThermostatDevice):
|
|||||||
def turn_away_mode_off(self):
|
def turn_away_mode_off(self):
|
||||||
"""Turn away off."""
|
"""Turn away off."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def set_hvac_mode(self: ThermostatDevice, hvac_mode: str) -> None:
|
||||||
|
"""Set the system mode (Cool, Heat, etc)."""
|
||||||
|
self._device.system_mode = hvac_mode
|
||||||
|
@ -277,6 +277,16 @@ class TestHoneywellRound(unittest.TestCase):
|
|||||||
self.round1.set_temperature(25)
|
self.round1.set_temperature(25)
|
||||||
self.device.set_temperature.assert_called_once_with('House', 25)
|
self.device.set_temperature.assert_called_once_with('House', 25)
|
||||||
|
|
||||||
|
def test_set_hvac_mode(self: unittest.TestCase) -> None:
|
||||||
|
"""Test setting the system operation."""
|
||||||
|
self.round1.set_hvac_mode('cool')
|
||||||
|
self.assertEqual('cool', self.round1.operation)
|
||||||
|
self.assertEqual('cool', self.device.system_mode)
|
||||||
|
|
||||||
|
self.round1.set_hvac_mode('heat')
|
||||||
|
self.assertEqual('heat', self.round1.operation)
|
||||||
|
self.assertEqual('heat', self.device.system_mode)
|
||||||
|
|
||||||
|
|
||||||
class TestHoneywellUS(unittest.TestCase):
|
class TestHoneywellUS(unittest.TestCase):
|
||||||
"""A test class for Honeywell US thermostats."""
|
"""A test class for Honeywell US thermostats."""
|
||||||
@ -327,6 +337,16 @@ class TestHoneywellUS(unittest.TestCase):
|
|||||||
self.assertEqual(74, self.device.setpoint_cool)
|
self.assertEqual(74, self.device.setpoint_cool)
|
||||||
self.assertEqual(74, self.honeywell.target_temperature)
|
self.assertEqual(74, self.honeywell.target_temperature)
|
||||||
|
|
||||||
|
def test_set_hvac_mode(self: unittest.TestCase) -> None:
|
||||||
|
"""Test setting the HVAC mode."""
|
||||||
|
self.honeywell.set_hvac_mode('cool')
|
||||||
|
self.assertEqual('cool', self.honeywell.operation)
|
||||||
|
self.assertEqual('cool', self.device.system_mode)
|
||||||
|
|
||||||
|
self.honeywell.set_hvac_mode('heat')
|
||||||
|
self.assertEqual('heat', self.honeywell.operation)
|
||||||
|
self.assertEqual('heat', self.device.system_mode)
|
||||||
|
|
||||||
def test_set_temp_fail(self):
|
def test_set_temp_fail(self):
|
||||||
"""Test if setting the temperature fails."""
|
"""Test if setting the temperature fails."""
|
||||||
self.device.setpoint_heat = mock.MagicMock(
|
self.device.setpoint_heat = mock.MagicMock(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user