Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 4a77161
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 14:52:07 2021 -0700

    Adds basic support for AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint (#362)

commit 93a02ff
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 14:30:49 2021 -0700

    Add support for AtlanticElectricalTowelDryer (#423)

    * Add scaffold for feature/AtlanticElectricalTowelDryer

    * Update presets and other features

    * First clean up

    * remove comments

commit a4709cd
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 14:18:00 2021 -0700

    Adjust Atlantic Electrical Heater to new standards and fix issues (#454)

    * Adjust Atlantic Electrical Heater to new standards and fix issues

    * Add comfort mode

    * Add missing extra comfort presets

commit 65de131
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 13:41:35 2021 -0700

    Add more information regarding Model and Manufacturer (#474)

commit 76d566c
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 11:56:06 2021 -0700

    Improve reauth, Config Flow and error handling (#452)

commit 847ee29
Author: Thibaut <thibaut@etienne.pw>
Date:   Wed Jul 14 19:09:43 2021 +0200

    Fix is_opening/closing for RTS devices (#464)

    Co-authored-by: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>

commit 560db42
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 10:01:12 2021 -0700

    Update pyhoma and require latest Home Assistant version (#473)

commit 242e21d
Author: Mick Vleeshouwer <Mick.Vleeshouwer@microsoft.com>
Date:   Wed Jul 14 08:01:55 2021 -0700

    Currently stale issues are closed too soon (#470)

commit c467aa4
Author: Thibaut <thibaut@etienne.pw>
Date:   Tue Jun 29 17:13:52 2021 +0200

    Fix is_opening/is_closing for RTS covers (#463)

commit 60f0766
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon Jun 21 09:17:18 2021 +0200

    Support is_opening/closing when moving position (#460)

commit 39f485e
Author: Thibaut <thibaut@etienne.pw>
Date:   Mon May 31 17:27:48 2021 +0200

    Remove setPosition (#455)
  • Loading branch information
iMicknl committed Jul 14, 2021
1 parent 4bbb921 commit 93fd6df
Show file tree
Hide file tree
Showing 22 changed files with 680 additions and 153 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:
This issue now has been marked as stale and will be closed if no further
activity occurs. Thank you for your contributions.'
days-before-stale: 30
days-before-close: 5
days-before-close: 30
stale-issue-label: 'no-issue-activity'
exempt-issue-labels: 'work-in-progress,blocked,help wanted,under investigation'
16 changes: 6 additions & 10 deletions custom_components/tahoma/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_EXCLUDE, CONF_PASSWORD, CONF_SOURCE, CONF_USERNAME
from homeassistant.core import HomeAssistant, ServiceCall
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
from homeassistant.helpers import (
config_validation as cv,
device_registry as dr,
Expand Down Expand Up @@ -117,18 +117,14 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
client.get_places(),
]
devices, scenarios, gateways, places = await asyncio.gather(*tasks)
except BadCredentialsException:
_LOGGER.error("Invalid authentication.")
return False
except BadCredentialsException as exception:
raise ConfigEntryAuthFailed from exception
except TooManyRequestsException as exception:
_LOGGER.error("Too many requests, try again later.")
raise ConfigEntryNotReady from exception
raise ConfigEntryNotReady("Too many requests, try again later") from exception
except (TimeoutError, ClientError, ServerDisconnectedError) as exception:
_LOGGER.error("Failed to connect.")
raise ConfigEntryNotReady from exception
raise ConfigEntryNotReady("Failed to connect") from exception
except MaintenanceException as exception:
_LOGGER.error("Server is down for maintenance.")
raise ConfigEntryNotReady from exception
raise ConfigEntryNotReady("Server is down for maintenance") from exception
except Exception as exception: # pylint: disable=broad-except
_LOGGER.exception(exception)
return False
Expand Down
17 changes: 12 additions & 5 deletions custom_components/tahoma/climate.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
"""Support for TaHoma climate devices."""

from homeassistant.components.climate import DOMAIN as CLIMATE

from .climate_devices.atlantic_electrical_heater import AtlanticElectricalHeater
from .climate_devices.atlantic_electrical_heater_with_adjustable_temperature_setpoint import (
AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint,
)
from .climate_devices.atlantic_electrical_towel_dryer import (
AtlanticElectricalTowelDryer,
)
from .climate_devices.atlantic_pass_apc_heating_and_cooling_zone import (
AtlanticPassAPCHeatingAndCoolingZone,
)
Expand All @@ -20,15 +25,17 @@

TYPE = {
"AtlanticElectricalHeater": AtlanticElectricalHeater,
"AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint": AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint,
"AtlanticElectricalTowelDryer": AtlanticElectricalTowelDryer,
"AtlanticPassAPCDHW": AtlanticPassAPCDHW,
"AtlanticPassAPCHeatingAndCoolingZone": AtlanticPassAPCHeatingAndCoolingZone,
"AtlanticPassAPCZoneControl": AtlanticPassAPCZoneControl,
"HitachiAirToWaterHeatingZone": HitachiAirToWaterHeatingZone,
"SomfyThermostat": SomfyThermostat,
"DimmerExteriorHeating": DimmerExteriorHeating,
"StatelessExteriorHeating": StatelessExteriorHeating,
"AtlanticPassAPCDHW": AtlanticPassAPCDHW,
"EvoHomeController": EvoHomeController,
"HeatingSetPoint": HeatingSetPoint,
"HitachiAirToWaterHeatingZone": HitachiAirToWaterHeatingZone,
"SomfyThermostat": SomfyThermostat,
"StatelessExteriorHeating": StatelessExteriorHeating,
}

SERVICE_CLIMATE_MY_POSITION = "set_climate_my_position"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Support for Atlantic Electrical Heater IO controller."""
"""Support for Atlantic Electrical Heater."""
from typing import List, Optional

from homeassistant.components.climate import (
Expand All @@ -18,26 +18,34 @@

COMMAND_SET_HEATING_LEVEL = "setHeatingLevel"

CORE_ON_OFF_STATE = "core:OnOffState"
IO_TARGET_HEATING_LEVEL_STATE = "io:TargetHeatingLevelState"

PRESET_FREEZE = "Freeze"
PRESET_FROST_PROTECTION = "frostprotection"
PRESET_OFF = "off"

MAP_PRESET_MODES = {
PRESET_OFF: PRESET_NONE,
PRESET_FROST_PROTECTION: PRESET_FREEZE,
PRESET_ECO: PRESET_ECO,
PRESET_COMFORT: PRESET_COMFORT,
PRESET_COMFORT1 = "comfort-1"
PRESET_COMFORT2 = "comfort-2"
PRESET_FROST_PROTECTION = "frost_protection"

TAHOMA_TO_PRESET_MODES = {
"off": PRESET_NONE,
"frostprotection": PRESET_FROST_PROTECTION,
"eco": PRESET_ECO,
"comfort": PRESET_COMFORT,
"comfort-1": PRESET_COMFORT1,
"comfort-2": PRESET_COMFORT2,
}

MAP_REVERSE_PRESET_MODES = {v: k for k, v in MAP_PRESET_MODES.items()}
PRESET_MODES_TO_TAHOMA = {v: k for k, v in TAHOMA_TO_PRESET_MODES.items()}

MAP_HVAC_MODES = {HVAC_MODE_HEAT: PRESET_COMFORT, HVAC_MODE_OFF: PRESET_OFF}
TAHOMA_TO_HVAC_MODES = {
"on": HVAC_MODE_HEAT,
"comfort": HVAC_MODE_HEAT,
"off": HVAC_MODE_OFF,
}
HVAC_MODES_TO_TAHOMA = {v: k for k, v in TAHOMA_TO_HVAC_MODES.items()}


class AtlanticElectricalHeater(TahomaEntity, ClimateEntity):
"""Representation of TaHoma IO Atlantic Electrical Heater."""
"""Representation of Atlantic Electrical Heater."""

@property
def temperature_unit(self) -> str:
Expand All @@ -52,35 +60,31 @@ def supported_features(self) -> int:
@property
def hvac_mode(self) -> str:
"""Return hvac operation ie. heat, cool mode."""
return HVAC_MODE_OFF if self.preset_mode == PRESET_NONE else HVAC_MODE_HEAT
return TAHOMA_TO_HVAC_MODES[self.select_state(*CORE_ON_OFF_STATE)]

@property
def hvac_modes(self) -> List[str]:
"""Return the list of available hvac operation modes."""
return [*MAP_HVAC_MODES]
return [*HVAC_MODES_TO_TAHOMA]

async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""
await self.async_execute_command(
COMMAND_SET_HEATING_LEVEL, HVAC_MODES_TO_TAHOMA[hvac_mode]
)

@property
def preset_mode(self) -> Optional[str]:
"""Return the current preset mode, e.g., home, away, temp."""
return MAP_PRESET_MODES[self.select_state(IO_TARGET_HEATING_LEVEL_STATE)]
return TAHOMA_TO_PRESET_MODES[self.select_state(IO_TARGET_HEATING_LEVEL_STATE)]

@property
def preset_modes(self) -> Optional[List[str]]:
"""Return a list of available preset modes."""
return [PRESET_NONE, PRESET_FREEZE, PRESET_ECO, PRESET_COMFORT]

async def async_set_hvac_mode(self, hvac_mode: str) -> None:
"""Set new target hvac mode."""
await self.async_execute_command(
COMMAND_SET_HEATING_LEVEL, MAP_HVAC_MODES[hvac_mode]
)
return [*PRESET_MODES_TO_TAHOMA]

async def async_set_preset_mode(self, preset_mode: str) -> None:
"""Set new preset mode."""
await self.async_execute_command(
COMMAND_SET_HEATING_LEVEL, MAP_REVERSE_PRESET_MODES[preset_mode]
COMMAND_SET_HEATING_LEVEL, PRESET_MODES_TO_TAHOMA[preset_mode]
)

async def async_turn_off(self) -> None:
"""Turn off the device."""
await self.async_execute_command(COMMAND_SET_HEATING_LEVEL, PRESET_OFF)
Loading

0 comments on commit 93fd6df

Please sign in to comment.