Minor cleanup of Zimi Integration (#144293)

This commit is contained in:
markhannon 2025-05-31 02:53:33 +09:00 committed by GitHub
parent 9ec02633b3
commit 6e44552d41
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View File

@ -51,7 +51,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ZimiConfigEntry) -> bool
config_entry_id=entry.entry_id,
identifiers={(DOMAIN, api.mac)},
manufacturer=api.brand,
name=f"{api.network_name}",
name=api.network_name,
model="Zimi Cloud Connect",
sw_version=api.firmware_version,
connections={(CONNECTION_NETWORK_MAC, api.mac)},

View File

@ -32,7 +32,7 @@ async def async_setup_entry(
]
lights.extend(
[ZimiDimmer(device, api) for device in api.lights if device.type == "dimmer"]
ZimiDimmer(device, api) for device in api.lights if device.type == "dimmer"
)
async_add_entities(lights)
@ -81,8 +81,6 @@ class ZimiDimmer(ZimiLight):
super().__init__(device, api)
self._attr_color_mode = ColorMode.BRIGHTNESS
self._attr_supported_color_modes = {ColorMode.BRIGHTNESS}
if self._device.type != "dimmer":
raise ValueError("ZimiDimmer needs a dimmable light")
async def async_turn_on(self, **kwargs: Any) -> None:
"""Instruct the light to turn on (with optional brightness)."""

View File

@ -63,6 +63,10 @@ async def test_user_discovery_success(
)
assert result["type"] is FlowResultType.CREATE_ENTRY
assert result["context"] == {
"source": config_entries.SOURCE_USER,
"unique_id": INPUT_MAC,
}
assert result["data"] == {
"host": INPUT_HOST,
"port": INPUT_PORT,