mirror of
https://github.com/home-assistant/core.git
synced 2025-07-10 14:57:09 +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
|
/tests/components/nsw_fuel_station/ @nickw444
|
||||||
/homeassistant/components/nsw_rural_fire_service_feed/ @exxamalte
|
/homeassistant/components/nsw_rural_fire_service_feed/ @exxamalte
|
||||||
/tests/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
|
/homeassistant/components/nuki/ @pschmitt @pvizeli @pree
|
||||||
/tests/components/nuki/ @pschmitt @pvizeli @pree
|
/tests/components/nuki/ @pschmitt @pvizeli @pree
|
||||||
/homeassistant/components/numato/ @clssn
|
/homeassistant/components/numato/ @clssn
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
"""Support for NuHeat thermostats."""
|
"""Support for NuHeat thermostats."""
|
||||||
from datetime import datetime
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from nuheat.config import SCHEDULE_HOLD, SCHEDULE_RUN, SCHEDULE_TEMPORARY_HOLD
|
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.entity_platform import AddEntitiesCallback
|
||||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||||
|
|
||||||
from .const import (
|
from .const import DOMAIN, MANUFACTURER, NUHEAT_API_STATE_SHIFT_DELAY
|
||||||
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -225,22 +214,9 @@ class NuHeatThermostat(CoordinatorEntity, ClimateEntity):
|
|||||||
target_schedule_mode,
|
target_schedule_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
target_temperature = max(
|
self._thermostat.set_target_temperature(
|
||||||
min(self._thermostat.max_temperature, target_temperature),
|
target_temperature, target_schedule_mode
|
||||||
self._thermostat.min_temperature,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
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._schedule_mode = target_schedule_mode
|
||||||
self._target_temperature = target_temperature
|
self._target_temperature = target_temperature
|
||||||
self._schedule_update()
|
self._schedule_update()
|
||||||
|
@ -10,10 +10,3 @@ CONF_SERIAL_NUMBER = "serial_number"
|
|||||||
MANUFACTURER = "NuHeat"
|
MANUFACTURER = "NuHeat"
|
||||||
|
|
||||||
NUHEAT_API_STATE_SHIFT_DELAY = 2
|
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",
|
"domain": "nuheat",
|
||||||
"name": "NuHeat",
|
"name": "NuHeat",
|
||||||
"documentation": "https://www.home-assistant.io/integrations/nuheat",
|
"documentation": "https://www.home-assistant.io/integrations/nuheat",
|
||||||
"requirements": ["nuheat==0.3.0"],
|
"requirements": ["nuheat==1.0.0"],
|
||||||
"codeowners": [],
|
"codeowners": ["@tstabrawa"],
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"dhcp": [
|
"dhcp": [
|
||||||
{
|
{
|
||||||
|
@ -1180,7 +1180,7 @@ nsapi==3.0.5
|
|||||||
nsw-fuel-api-client==1.1.0
|
nsw-fuel-api-client==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.nuheat
|
# homeassistant.components.nuheat
|
||||||
nuheat==0.3.0
|
nuheat==1.0.0
|
||||||
|
|
||||||
# homeassistant.components.numato
|
# homeassistant.components.numato
|
||||||
numato-gpio==0.10.0
|
numato-gpio==0.10.0
|
||||||
|
@ -855,7 +855,7 @@ notify-events==1.0.4
|
|||||||
nsw-fuel-api-client==1.1.0
|
nsw-fuel-api-client==1.1.0
|
||||||
|
|
||||||
# homeassistant.components.nuheat
|
# homeassistant.components.nuheat
|
||||||
nuheat==0.3.0
|
nuheat==1.0.0
|
||||||
|
|
||||||
# homeassistant.components.numato
|
# homeassistant.components.numato
|
||||||
numato-gpio==0.10.0
|
numato-gpio==0.10.0
|
||||||
|
@ -159,7 +159,7 @@ async def test_climate_thermostat_schedule_temporary_hold(hass):
|
|||||||
# opportunistic set
|
# opportunistic set
|
||||||
state = hass.states.get("climate.temp_bathroom")
|
state = hass.states.get("climate.temp_bathroom")
|
||||||
assert state.attributes["preset_mode"] == "Temporary Hold"
|
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
|
# and the api poll returns it to the mock
|
||||||
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=3))
|
async_fire_time_changed(hass, dt_util.utcnow() + timedelta(seconds=3))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user