diff --git a/CODEOWNERS b/CODEOWNERS index cbff4badc9f..d0e4fc993ad 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -780,6 +780,8 @@ build.json @home-assistant/supervisor /tests/components/nsw_fuel_station/ @nickw444 /homeassistant/components/nsw_rural_fire_service_feed/ @exxamalte /tests/components/nsw_rural_fire_service_feed/ @exxamalte +/homeassistant/components/nuheat/ @tstabrawa +/tests/components/nuheat/ @tstabrawa /homeassistant/components/nuki/ @pschmitt @pvizeli @pree /tests/components/nuki/ @pschmitt @pvizeli @pree /homeassistant/components/numato/ @clssn diff --git a/homeassistant/components/nuheat/climate.py b/homeassistant/components/nuheat/climate.py index c731e3472d6..0c053a8c67f 100644 --- a/homeassistant/components/nuheat/climate.py +++ b/homeassistant/components/nuheat/climate.py @@ -1,7 +1,5 @@ """Support for NuHeat thermostats.""" -from datetime import datetime import logging -import time from typing import Any from nuheat.config import SCHEDULE_HOLD, SCHEDULE_RUN, SCHEDULE_TEMPORARY_HOLD @@ -27,16 +25,7 @@ from homeassistant.helpers.entity import DeviceInfo from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.update_coordinator import CoordinatorEntity -from .const import ( - DOMAIN, - MANUFACTURER, - NUHEAT_API_STATE_SHIFT_DELAY, - NUHEAT_DATETIME_FORMAT, - NUHEAT_KEY_HOLD_SET_POINT_DATE_TIME, - NUHEAT_KEY_SCHEDULE_MODE, - NUHEAT_KEY_SET_POINT_TEMP, - TEMP_HOLD_TIME_SEC, -) +from .const import DOMAIN, MANUFACTURER, NUHEAT_API_STATE_SHIFT_DELAY _LOGGER = logging.getLogger(__name__) @@ -225,22 +214,9 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity): target_schedule_mode, ) - target_temperature = max( - min(self._thermostat.max_temperature, target_temperature), - self._thermostat.min_temperature, + self._thermostat.set_target_temperature( + target_temperature, target_schedule_mode ) - - request = { - NUHEAT_KEY_SET_POINT_TEMP: target_temperature, - NUHEAT_KEY_SCHEDULE_MODE: target_schedule_mode, - } - - if target_schedule_mode == SCHEDULE_TEMPORARY_HOLD: - request[NUHEAT_KEY_HOLD_SET_POINT_DATE_TIME] = datetime.fromtimestamp( - time.time() + TEMP_HOLD_TIME_SEC - ).strftime(NUHEAT_DATETIME_FORMAT) - - self._thermostat.set_data(request) self._schedule_mode = target_schedule_mode self._target_temperature = target_temperature self._schedule_update() diff --git a/homeassistant/components/nuheat/const.py b/homeassistant/components/nuheat/const.py index 619d4a11e2a..ea43c33d9b0 100644 --- a/homeassistant/components/nuheat/const.py +++ b/homeassistant/components/nuheat/const.py @@ -10,10 +10,3 @@ CONF_SERIAL_NUMBER = "serial_number" MANUFACTURER = "NuHeat" NUHEAT_API_STATE_SHIFT_DELAY = 2 - -TEMP_HOLD_TIME_SEC = 43200 - -NUHEAT_KEY_SET_POINT_TEMP = "SetPointTemp" -NUHEAT_KEY_SCHEDULE_MODE = "ScheduleMode" -NUHEAT_KEY_HOLD_SET_POINT_DATE_TIME = "HoldSetPointDateTime" -NUHEAT_DATETIME_FORMAT = "%a, %d %b %Y %H:%M:%S GMT" diff --git a/homeassistant/components/nuheat/manifest.json b/homeassistant/components/nuheat/manifest.json index aea63a692a5..90d18b87af2 100644 --- a/homeassistant/components/nuheat/manifest.json +++ b/homeassistant/components/nuheat/manifest.json @@ -2,8 +2,8 @@ "domain": "nuheat", "name": "NuHeat", "documentation": "https://www.home-assistant.io/integrations/nuheat", - "requirements": ["nuheat==0.3.0"], - "codeowners": [], + "requirements": ["nuheat==1.0.0"], + "codeowners": ["@tstabrawa"], "config_flow": true, "dhcp": [ { diff --git a/requirements_all.txt b/requirements_all.txt index bdebb6f8652..ef90ca110e9 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1180,7 +1180,7 @@ nsapi==3.0.5 nsw-fuel-api-client==1.1.0 # homeassistant.components.nuheat -nuheat==0.3.0 +nuheat==1.0.0 # homeassistant.components.numato numato-gpio==0.10.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c05a57e8508..010ff5a6b7d 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -855,7 +855,7 @@ notify-events==1.0.4 nsw-fuel-api-client==1.1.0 # homeassistant.components.nuheat -nuheat==0.3.0 +nuheat==1.0.0 # homeassistant.components.numato numato-gpio==0.10.0 diff --git a/tests/components/nuheat/test_climate.py b/tests/components/nuheat/test_climate.py index 133c3a15ccb..4a6e9551b0b 100644 --- a/tests/components/nuheat/test_climate.py +++ b/tests/components/nuheat/test_climate.py @@ -159,7 +159,7 @@ async def test_climate_thermostat_schedule_temporary_hold(hass): # opportunistic set state = hass.states.get("climate.temp_bathroom") assert state.attributes["preset_mode"] == "Temporary Hold" - assert state.attributes["temperature"] == 50.0 + assert state.attributes["temperature"] == 90.0 # and the api poll returns it to the mock async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=3))