Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update aiolyric to 2.0.1 #123424

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions homeassistant/components/lyric/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from aiolyric.exceptions import LyricAuthenticationException, LyricException
from aiolyric.objects.device import LyricDevice
from aiolyric.objects.location import LyricLocation
from aiolyric.objects.priority import LyricAccessories, LyricRoom
from aiolyric.objects.priority import LyricAccessory, LyricRoom

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import Platform
Expand Down Expand Up @@ -80,11 +80,13 @@
await lyric.get_locations()
await asyncio.gather(
*(
lyric.get_thermostat_rooms(location.locationID, device.deviceID)
lyric.get_thermostat_rooms(
location.location_id, device.device_id
)
for location in lyric.locations
for device in location.devices
if device.deviceClass == "Thermostat"
and device.deviceID.startswith("LCC")
if device.device_class == "Thermostat"
and device.device_id.startswith("LCC")
)
)

Expand Down Expand Up @@ -143,7 +145,7 @@
super().__init__(coordinator)
self._key = key
self._location = location
self._mac_id = device.macID
self._mac_id = device.mac_id

Check warning on line 148 in homeassistant/components/lyric/__init__.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/__init__.py#L148

Added line #L148 was not covered by tests
self._update_thermostat = coordinator.data.update_thermostat
self._update_fan = coordinator.data.update_fan

Expand All @@ -155,7 +157,7 @@
@property
def location(self) -> LyricLocation:
"""Get the Lyric Location."""
return self.coordinator.data.locations_dict[self._location.locationID]
return self.coordinator.data.locations_dict[self._location.location_id]

Check warning on line 160 in homeassistant/components/lyric/__init__.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/__init__.py#L160

Added line #L160 was not covered by tests

@property
def device(self) -> LyricDevice:
Expand All @@ -173,7 +175,7 @@
identifiers={(dr.CONNECTION_NETWORK_MAC, self._mac_id)},
connections={(dr.CONNECTION_NETWORK_MAC, self._mac_id)},
manufacturer="Honeywell",
model=self.device.deviceModel,
model=self.device.device_model,
name=f"{self.device.name} Thermostat",
)

Expand All @@ -187,7 +189,7 @@
location: LyricLocation,
device: LyricDevice,
room: LyricRoom,
accessory: LyricAccessories,
accessory: LyricAccessory,
key: str,
) -> None:
"""Initialize the Honeywell Lyric accessory entity."""
Expand All @@ -207,7 +209,7 @@
},
manufacturer="Honeywell",
model="RCHTSENSOR",
name=f"{self.room.roomName} Sensor",
name=f"{self.room.room_name} Sensor",
via_device=(dr.CONNECTION_NETWORK_MAC, self._mac_id),
)

Expand All @@ -217,7 +219,7 @@
return self.coordinator.data.rooms_dict[self._mac_id][self._room_id]

@property
def accessory(self) -> LyricAccessories:
def accessory(self) -> LyricAccessory:
"""Get the Lyric Device."""
return next(
accessory
Expand Down
64 changes: 32 additions & 32 deletions homeassistant/components/lyric/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
LyricClimate(
coordinator,
ClimateEntityDescription(
key=f"{device.macID}_thermostat",
key=f"{device.mac_id}_thermostat",
name=device.name,
),
location,
Expand Down Expand Up @@ -185,7 +185,7 @@
) -> None:
"""Initialize Honeywell Lyric climate entity."""
# Define thermostat type (TCC - e.g., Lyric round; LCC - e.g., T5,6)
if device.changeableValues.thermostatSetpointStatus:
if device.changeable_values.thermostat_setpoint_status:

Check warning on line 188 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L188

Added line #L188 was not covered by tests
self._attr_thermostat_type = LyricThermostatType.LCC
else:
self._attr_thermostat_type = LyricThermostatType.TCC
Expand All @@ -202,15 +202,15 @@
self._attr_hvac_modes = [HVACMode.OFF]

# Add supported lyric thermostat features
if LYRIC_HVAC_MODE_HEAT in device.allowedModes:
if LYRIC_HVAC_MODE_HEAT in device.allowed_modes:

Check warning on line 205 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L205

Added line #L205 was not covered by tests
self._attr_hvac_modes.append(HVACMode.HEAT)

if LYRIC_HVAC_MODE_COOL in device.allowedModes:
if LYRIC_HVAC_MODE_COOL in device.allowed_modes:

Check warning on line 208 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L208

Added line #L208 was not covered by tests
self._attr_hvac_modes.append(HVACMode.COOL)

if (
LYRIC_HVAC_MODE_HEAT in device.allowedModes
and LYRIC_HVAC_MODE_COOL in device.allowedModes
LYRIC_HVAC_MODE_HEAT in device.allowed_modes
and LYRIC_HVAC_MODE_COOL in device.allowed_modes
):
self._attr_hvac_modes.append(HVACMode.HEAT_COOL)

Expand Down Expand Up @@ -242,83 +242,83 @@
coordinator,
location,
device,
f"{device.macID}_thermostat",
f"{device.mac_id}_thermostat",
)
self.entity_description = description

@property
def current_temperature(self) -> float | None:
"""Return the current temperature."""
return self.device.indoorTemperature
return self.device.indoor_temperature

Check warning on line 252 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L252

Added line #L252 was not covered by tests

@property
def hvac_action(self) -> HVACAction | None:
"""Return the current hvac action."""
action = HVAC_ACTIONS.get(self.device.operationStatus.mode, None)
action = HVAC_ACTIONS.get(self.device.operation_status.mode, None)

Check warning on line 257 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L257

Added line #L257 was not covered by tests
if action == HVACAction.OFF and self.hvac_mode != HVACMode.OFF:
action = HVACAction.IDLE
return action

@property
def hvac_mode(self) -> HVACMode:
"""Return the hvac mode."""
return HVAC_MODES[self.device.changeableValues.mode]
return HVAC_MODES[self.device.changeable_values.mode]

Check warning on line 265 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L265

Added line #L265 was not covered by tests

@property
def target_temperature(self) -> float | None:
"""Return the temperature we try to reach."""
device = self.device
if (
device.changeableValues.autoChangeoverActive
or HVAC_MODES[device.changeableValues.mode] == HVACMode.OFF
device.changeable_values.auto_changeover_active
or HVAC_MODES[device.changeable_values.mode] == HVACMode.OFF
):
return None
if self.hvac_mode == HVACMode.COOL:
return device.changeableValues.coolSetpoint
return device.changeableValues.heatSetpoint
return device.changeable_values.cool_setpoint
return device.changeable_values.heat_setpoint

Check warning on line 278 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L277-L278

Added lines #L277 - L278 were not covered by tests

@property
def target_temperature_high(self) -> float | None:
"""Return the highbound target temperature we try to reach."""
device = self.device
if (
not device.changeableValues.autoChangeoverActive
or HVAC_MODES[device.changeableValues.mode] == HVACMode.OFF
not device.changeable_values.auto_changeover_active
or HVAC_MODES[device.changeable_values.mode] == HVACMode.OFF
):
return None
return device.changeableValues.coolSetpoint
return device.changeable_values.cool_setpoint

Check warning on line 289 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L289

Added line #L289 was not covered by tests

@property
def target_temperature_low(self) -> float | None:
"""Return the lowbound target temperature we try to reach."""
device = self.device
if (
not device.changeableValues.autoChangeoverActive
or HVAC_MODES[device.changeableValues.mode] == HVACMode.OFF
not device.changeable_values.auto_changeover_active
or HVAC_MODES[device.changeable_values.mode] == HVACMode.OFF
):
return None
return device.changeableValues.heatSetpoint
return device.changeable_values.heat_setpoint

Check warning on line 300 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L300

Added line #L300 was not covered by tests

@property
def preset_mode(self) -> str | None:
"""Return current preset mode."""
return self.device.changeableValues.thermostatSetpointStatus
return self.device.changeable_values.thermostat_setpoint_status

Check warning on line 305 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L305

Added line #L305 was not covered by tests

@property
def min_temp(self) -> float:
"""Identify min_temp in Lyric API or defaults if not available."""
device = self.device
if LYRIC_HVAC_MODE_COOL in device.allowedModes:
return device.minCoolSetpoint
return device.minHeatSetpoint
if LYRIC_HVAC_MODE_COOL in device.allowed_modes:
return device.min_cool_setpoint
return device.min_heat_setpoint

Check warning on line 313 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L311-L313

Added lines #L311 - L313 were not covered by tests

@property
def max_temp(self) -> float:
"""Identify max_temp in Lyric API or defaults if not available."""
device = self.device
if LYRIC_HVAC_MODE_HEAT in device.allowedModes:
return device.maxHeatSetpoint
return device.maxCoolSetpoint
if LYRIC_HVAC_MODE_HEAT in device.allowed_modes:
return device.max_heat_setpoint
return device.max_cool_setpoint

Check warning on line 321 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L319-L321

Added lines #L319 - L321 were not covered by tests

@property
def fan_mode(self) -> str | None:
Expand All @@ -339,7 +339,7 @@
target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW)
target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH)

if device.changeableValues.mode == LYRIC_HVAC_MODE_HEAT_COOL:
if device.changeable_values.mode == LYRIC_HVAC_MODE_HEAT_COOL:

Check warning on line 342 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L342

Added line #L342 was not covered by tests
if target_temp_low is None or target_temp_high is None:
raise HomeAssistantError(
"Could not find target_temp_low and/or target_temp_high in"
Expand All @@ -349,7 +349,7 @@
# If TCC device pass the heatCoolMode value, otherwise
# if LCC device can skip the mode altogether
if self._attr_thermostat_type is LyricThermostatType.TCC:
mode = HVAC_MODES[device.changeableValues.heatCoolMode]
mode = HVAC_MODES[device.changeable_values.heat_cool_mode]

Check warning on line 352 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L352

Added line #L352 was not covered by tests
else:
mode = None

Expand Down Expand Up @@ -401,7 +401,7 @@
# otherwise it turns to Auto briefly and then reverts to Off.
# This is the behavior that happens with the native app as well,
# so likely a bug in the api itself.
if HVAC_MODES[self.device.changeableValues.mode] == HVACMode.OFF:
if HVAC_MODES[self.device.changeable_values.mode] == HVACMode.OFF:

Check warning on line 404 in homeassistant/components/lyric/climate.py

View check run for this annotation

Codecov / codecov/patch

homeassistant/components/lyric/climate.py#L404

Added line #L404 was not covered by tests
_LOGGER.debug(
"HVAC mode passed to lyric: %s",
HVAC_MODES[LYRIC_HVAC_MODE_COOL],
Expand All @@ -427,7 +427,7 @@
else:
_LOGGER.debug(
"HVAC mode passed to lyric: %s",
HVAC_MODES[self.device.changeableValues.mode],
HVAC_MODES[self.device.changeable_values.mode],
)
await self._update_thermostat(
self.location, self.device, autoChangeoverActive=True
Expand All @@ -448,7 +448,7 @@
# otherwise leave unchanged.
if (
LYRIC_HVAC_MODES[hvac_mode] == LYRIC_HVAC_MODE_HEAT_COOL
and not self.device.changeableValues.autoChangeoverActive
and not self.device.changeable_values.auto_changeover_active
):
auto_changeover = True
else:
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/lyric/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
"iot_class": "cloud_polling",
"loggers": ["aiolyric"],
"quality_scale": "silver",
"requirements": ["aiolyric==1.1.0"]
"requirements": ["aiolyric==2.0.1"]
}
Loading