-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for StatelessExteriorHeating device. (#244)
* Add support for StatelessExteriorHeating device. * Add support for StatelessExteriorHeating device. * Changed unknown property to None. Added SUPPORT_PRESET_MODE. * Added services to services.yaml, removed up and down services. #211 * Fix temperature unit. #211 * Fix types. #211 * limit service my to supported devices. #211 * Added some debug logs. * Merge master into branch. * fixed wrong import #211 * Add last ha action as preset and hvac mode state. #211 * Renamed service. #211 * Revert "Add last ha action as preset and hvac mode state." This reverts commit bdfb6f3 #211 * improved debug logging. #211 * improved debug logging. #211 * fix possible circular import. #211 * Removed service * Changed preset to my only * Removed commented lines. * Cleaned up code. * Cleaned up code. * Removed unwanted logging message. #211 * Switch mode and preset back to None. #211 * cleanup code. #211
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 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
71 changes: 71 additions & 0 deletions
71
custom_components/tahoma/climate_devices/stateless_exterior_heating.py
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,71 @@ | ||
"""Support for Stateless Exterior Heating device.""" | ||
import logging | ||
from typing import List, Optional | ||
|
||
from homeassistant.components.climate import ClimateEntity | ||
from homeassistant.components.climate.const import ( | ||
HVAC_MODE_HEAT, | ||
HVAC_MODE_OFF, | ||
SUPPORT_PRESET_MODE, | ||
) | ||
from homeassistant.const import TEMP_CELSIUS | ||
|
||
from ..tahoma_device import TahomaDevice | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
COMMAND_MY = "my" | ||
COMMAND_OFF = "off" | ||
COMMAND_ON = "on" | ||
|
||
PRESET_MY = "My" | ||
|
||
|
||
class StatelessExteriorHeating(TahomaDevice, ClimateEntity): | ||
"""Representation of TaHoma Stateless Exterior Heating device.""" | ||
|
||
@property | ||
def temperature_unit(self) -> Optional[str]: | ||
"""Return the unit of measurement used by the platform.""" | ||
return TEMP_CELSIUS # Not used but climate devices need a recognized temperature unit... | ||
|
||
@property | ||
def supported_features(self) -> int: | ||
"""Return the list of supported features.""" | ||
return SUPPORT_PRESET_MODE | ||
|
||
@property | ||
def preset_mode(self) -> Optional[str]: | ||
"""Return the current preset mode, e.g., home, away, temp.""" | ||
return None | ||
|
||
@property | ||
def preset_modes(self) -> Optional[List[str]]: | ||
"""Return a list of available preset modes.""" | ||
return [PRESET_MY] | ||
|
||
async def async_set_preset_mode(self, preset_mode: str) -> None: | ||
"""Set new preset mode.""" | ||
if preset_mode in PRESET_MY: | ||
await self.async_execute_command(COMMAND_MY) | ||
else: | ||
_LOGGER.error( | ||
"Invalid preset mode %s for device %s", preset_mode, self.name | ||
) | ||
|
||
@property | ||
def hvac_mode(self) -> Optional[str]: | ||
"""Return hvac operation ie. heat, cool mode.""" | ||
return None | ||
|
||
@property | ||
def hvac_modes(self) -> List[str]: | ||
"""Return the list of available hvac operation modes.""" | ||
return [HVAC_MODE_OFF, HVAC_MODE_HEAT] | ||
|
||
async def async_set_hvac_mode(self, hvac_mode: str) -> None: | ||
"""Set new target hvac mode.""" | ||
if hvac_mode == HVAC_MODE_HEAT: | ||
await self.async_execute_command(COMMAND_ON) | ||
else: | ||
await self.async_execute_command(COMMAND_OFF) |
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