mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Fix nuheat temporary hold time (#81635)
Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
parent
9c3bd22e77
commit
499839c596
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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"
|
||||
|
@ -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": [
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user