Address late review in Honeywell (#115702)

Pass honeywell_data
This commit is contained in:
mkmer 2024-04-29 10:16:46 -04:00 committed by GitHub
parent f1dda8ef63
commit f5b4637da8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -40,7 +40,7 @@ async def async_setup_entry(
"""Set up the Honeywell switches.""" """Set up the Honeywell switches."""
data: HoneywellData = hass.data[DOMAIN][config_entry.entry_id] data: HoneywellData = hass.data[DOMAIN][config_entry.entry_id]
async_add_entities( async_add_entities(
HoneywellSwitch(hass, config_entry, device, description) HoneywellSwitch(data, device, description)
for device in data.devices.values() for device in data.devices.values()
if device.raw_ui_data.get("SwitchEmergencyHeatAllowed") if device.raw_ui_data.get("SwitchEmergencyHeatAllowed")
for description in SWITCH_TYPES for description in SWITCH_TYPES
@ -54,13 +54,12 @@ class HoneywellSwitch(SwitchEntity):
def __init__( def __init__(
self, self,
hass: HomeAssistant, honeywell_data: HoneywellData,
config_entry: ConfigEntry,
device: SomeComfortDevice, device: SomeComfortDevice,
description: SwitchEntityDescription, description: SwitchEntityDescription,
) -> None: ) -> None:
"""Initialize the switch.""" """Initialize the switch."""
self._data = hass.data[DOMAIN][config_entry.entry_id] self._data = honeywell_data
self._device = device self._device = device
self.entity_description = description self.entity_description = description
self._attr_unique_id = f"{device.deviceid}_{description.key}" self._attr_unique_id = f"{device.deviceid}_{description.key}"