1 """Climate device for CCM15 coordinator."""
6 from ccm15
import CCM15Device, CCM15DeviceState, CCM15SlaveDevice
20 _LOGGER = logging.getLogger(__name__)
24 """Class to coordinate multiple CCM15Climate devices."""
26 def __init__(self, hass: HomeAssistant, host: str, port: int) ->
None:
27 """Initialize the coordinator."""
32 update_interval=datetime.timedelta(seconds=DEFAULT_INTERVAL),
34 self.
_ccm15_ccm15 = CCM15Device(host, port, DEFAULT_TIMEOUT)
39 return self.
_host_host
42 """Fetch data from Rain Bird device."""
45 except httpx.RequestError
as err:
46 raise UpdateFailed(
"Error communicating with Device")
from err
49 """Get the current status of all AC devices."""
50 return await self.
_ccm15_ccm15.get_status_async()
53 """Set new target states."""
57 def get_ac_data(self, ac_index: int) -> CCM15SlaveDevice |
None:
58 """Get ac data from the ac_index."""
59 if ac_index < 0
or ac_index >= len(self.
datadata.devices):
62 return self.
datadata.devices[ac_index]
65 """Set the hvac mode."""
66 _LOGGER.debug(
"Set Hvac[%s]='%s'", ac_index,
str(hvac_mode))
67 await self.
async_set_stateasync_set_state(ac_index,
"mode", CONST_STATE_CMD_MAP[hvac_mode])
70 """Set the fan mode."""
71 _LOGGER.debug(
"Set Fan[%s]='%s'", ac_index, fan_mode)
72 await self.
async_set_stateasync_set_state(ac_index,
"fan", CONST_FAN_CMD_MAP[fan_mode])
75 """Set the target temperature mode."""
76 _LOGGER.debug(
"Set Temp[%s]='%s'", ac_index, temp)
None __init__(self, HomeAssistant hass, str host, int port)
None async_set_fan_mode(self, ac_index, str fan_mode)
None async_set_temperature(self, ac_index, temp)
CCM15DeviceState _fetch_data(self)
CCM15DeviceState _async_update_data(self)
None async_set_hvac_mode(self, ac_index, HVACMode hvac_mode)
CCM15SlaveDevice|None get_ac_data(self, int ac_index)
None async_set_state(self, int ac_index, str state, int value)
None async_request_refresh(self)