Skip to content

Commit

Permalink
Merge pull request #88 from mauriziosacca/mauriziosacca-patch-1
Browse files Browse the repository at this point in the history
Mauriziosacca patch 1
  • Loading branch information
atxbyea authored and github-actions[bot] committed Jan 14, 2024
2 parents 033d297 + 8998fcb commit 20e0854
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
13 changes: 8 additions & 5 deletions custom_components/climate_ip/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
ATTR_TARGET_TEMP_HIGH,
ATTR_TARGET_TEMP_LOW,
DOMAIN,
HVACMode.OFF,
ClimateEntity,
HVACMode,
)
from homeassistant.components.climate.const import (
ATTR_MAX_TEMP,
Expand All @@ -50,8 +50,7 @@
STATE_ON,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
UnitOfTemperature.CELSIUS,
UnitOfTemperature.FAHRENHEIT,
UnitOfTemperature,
)
from homeassistant.exceptions import PlatformNotReady
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA
Expand Down Expand Up @@ -230,14 +229,18 @@ def min_temp(self):
t = self.rac.get_property(ATTR_MIN_TEMP)
if t is None:
t = DEFAULT_CLIMATE_IP_TEMP_MIN
return TemperatureConverter.convert(t, UnitOfTemperature.CELSIUS, self.temperature_unit)
return TemperatureConverter.convert(
t, UnitOfTemperature.CELSIUS, self.temperature_unit
)

@property
def max_temp(self):
t = self.rac.get_property(ATTR_MAX_TEMP)
if t is None:
t = DEFAULT_CLIMATE_IP_TEMP_MAX
return TemperatureConverter.convert(t, UnitOfTemperature.CELSIUS, self.temperature_unit)
return TemperatureConverter.convert(
t, UnitOfTemperature.CELSIUS, self.temperature_unit
)

@property
def should_poll(self):
Expand Down
2 changes: 1 addition & 1 deletion custom_components/climate_ip/controller_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
CONF_TEMPERATURE_UNIT,
CONF_TOKEN,
STATE_ON,
UnitOfTemperature.CELSIUS,
UnitOfTemperature,
)
from homeassistant.helpers.config_validation import PLATFORM_SCHEMA

Expand Down
16 changes: 7 additions & 9 deletions custom_components/climate_ip/properties.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
import json

import homeassistant.helpers.config_validation as cv
from homeassistant.const import (
STATE_OFF,
STATE_ON,
STATE_UNKNOWN,
UnitOfTemperature.CELSIUS,
UnitOfTemperature.FAHRENHEIT,
)
from homeassistant.const import STATE_OFF, STATE_ON, STATE_UNKNOWN, UnitOfTemperature

# from homeassistant.util.temperature import convert as convert_temperature
from homeassistant.util.unit_conversion import TemperatureConverter
Expand Down Expand Up @@ -502,7 +496,9 @@ def update_state(self, device_state, debug):

def convert_dev_to_hass(self, dev_value):
"""Convert device state value to HASS."""
return TemperatureConverter.convert(float(dev_value), self._unit, UnitOfTemperature.CELSIUS)
return TemperatureConverter.convert(
float(dev_value), self._unit, UnitOfTemperature.CELSIUS
)

def convert_hass_to_dev(self, hass_value):
v = hass_value
Expand All @@ -512,4 +508,6 @@ def convert_hass_to_dev(self, hass_value):
if self._max is not None and hass_value > self._max:
v = self._max

return TemperatureConverter.convert(float(v), UnitOfTemperature.CELSIUS, self._unit)
return TemperatureConverter.convert(
float(v), UnitOfTemperature.CELSIUS, self._unit
)

0 comments on commit 20e0854

Please sign in to comment.