Home Assistant Unofficial Reference 2024.12.1
util.py
Go to the documentation of this file.
1 """Utils for radiotherm."""
2 
3 from __future__ import annotations
4 
5 from radiotherm.thermostat import CommonThermostat
6 
7 from homeassistant.core import HomeAssistant
8 from homeassistant.util import dt as dt_util
9 
10 
11 async def async_set_time(hass: HomeAssistant, device: CommonThermostat) -> None:
12  """Sync time to the thermostat."""
13  await hass.async_add_executor_job(_set_time, device)
14 
15 
16 def _set_time(device: CommonThermostat) -> None:
17  """Set device time."""
18  # Calling this clears any local temperature override and
19  # reverts to the scheduled temperature.
20  now = dt_util.now()
21  device.time = {
22  "day": now.weekday(),
23  "hour": now.hour,
24  "minute": now.minute,
25  }
None _set_time(CommonThermostat device)
Definition: util.py:16
None async_set_time(HomeAssistant hass, CommonThermostat device)
Definition: util.py:11