Skip to content

Commit

Permalink
tetienne review
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarec committed Mar 3, 2022
1 parent 1a45060 commit da6fb8d
Showing 1 changed file with 16 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import logging
from typing import List, Optional

from pyoverkiz.enums import OverkizState

from homeassistant.components.climate import (
SUPPORT_PRESET_MODE,
SUPPORT_TARGET_TEMPERATURE,
Expand Down Expand Up @@ -92,15 +94,15 @@ class AtlanticPassAPCHeatingZone(OverkizEntity, ClimateEntity):
"""Representation of Atlantic Pass APC Heating and Cooling Zone."""

_attr_hvac_modes = [HVAC_MODE_OFF, HVAC_MODE_HEAT, HVAC_MODE_AUTO]
_attr_max_temp = 30
_attr_min_temp = 5
_attr_supported_features = SUPPORT_PRESET_MODE | SUPPORT_TARGET_TEMPERATURE
_attr_temperature_unit = TEMP_CELSIUS

def __init__(self, device_url: str, coordinator: OverkizDataUpdateCoordinator):
"""Init method."""
super().__init__(device_url, coordinator)

self._temp_sensor_entity_id = None
self._current_temperature = None
self.temperature_device = self.executor.linked_device(8)

@property
def preset_modes(self) -> Optional[List[str]]:
Expand All @@ -118,14 +120,14 @@ def preset_modes(self) -> Optional[List[str]]:
CUSTOM_PRESET_STOP,
PRESET_AWAY,
]
else:
return [
PRESET_COMFORT,
PRESET_ECO,
CUSTOM_PRESET_AUTO,
CUSTOM_PRESET_STOP,
PRESET_AWAY,
]

return [
PRESET_COMFORT,
PRESET_ECO,
CUSTOM_PRESET_AUTO,
CUSTOM_PRESET_STOP,
PRESET_AWAY,
]

@property
def preset_mode(self) -> Optional[str]:
Expand Down Expand Up @@ -228,20 +230,12 @@ def update_temp(self, state):
except ValueError as ex:
_LOGGER.error("Unable to update from sensor: %s", ex)

@property
def min_temp(self) -> float:
"""Return the minimum temperature."""
return 5

@property
def max_temp(self) -> float:
"""Return the maximum temperature."""
return 30

@property
def current_temperature(self) -> Optional[float]:
"""Return the current temperature."""
return self._current_temperature
return float(
self.temperature_device.states.get(OverkizState.CORE_TEMPERATURE).value
)

@property
def hvac_mode(self) -> str:
Expand Down

0 comments on commit da6fb8d

Please sign in to comment.