Cleanup some typing in isy994 (#141859)

Now that pyisy is mostly typed there were some obvious
issues. We are still a long way away from being able
to add py.typed to pyisy, but we can now see some
obvious things in an IDE
This commit is contained in:
J. Nick Koston 2025-03-30 09:18:30 -10:00 committed by GitHub
parent 02397a8d2d
commit b5e1f7e03e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 6 additions and 4 deletions

View File

@ -227,9 +227,9 @@ async def async_unload_entry(
"""Unload a config entry.""" """Unload a config entry."""
unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS) unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
isy_data = hass.data[DOMAIN][entry.entry_id] isy_data: IsyData = hass.data[DOMAIN][entry.entry_id]
isy: ISY = isy_data.root isy = isy_data.root
_LOGGER.debug("ISY Stopping Event Stream and automatic updates") _LOGGER.debug("ISY Stopping Event Stream and automatic updates")
isy.websocket.stop() isy.websocket.stop()

View File

@ -181,6 +181,7 @@ class ISYProgramEntity(ISYEntity):
_actions: Program _actions: Program
_status: Program _status: Program
_node: Program
def __init__(self, name: str, status: Program, actions: Program = None) -> None: def __init__(self, name: str, status: Program, actions: Program = None) -> None:
"""Initialize the ISY program-based entity.""" """Initialize the ISY program-based entity."""

View File

@ -21,6 +21,7 @@ from homeassistant.helpers.service import entity_service_call
from homeassistant.helpers.typing import VolDictType from homeassistant.helpers.typing import VolDictType
from .const import _LOGGER, DOMAIN from .const import _LOGGER, DOMAIN
from .models import IsyData
# Common Services for All Platforms: # Common Services for All Platforms:
SERVICE_SEND_PROGRAM_COMMAND = "send_program_command" SERVICE_SEND_PROGRAM_COMMAND = "send_program_command"
@ -149,7 +150,7 @@ def async_setup_services(hass: HomeAssistant) -> None:
isy_name = service.data.get(CONF_ISY) isy_name = service.data.get(CONF_ISY)
for config_entry_id in hass.data[DOMAIN]: for config_entry_id in hass.data[DOMAIN]:
isy_data = hass.data[DOMAIN][config_entry_id] isy_data: IsyData = hass.data[DOMAIN][config_entry_id]
isy = isy_data.root isy = isy_data.root
if isy_name and isy_name != isy.conf["name"]: if isy_name and isy_name != isy.conf["name"]:
continue continue

View File

@ -157,7 +157,7 @@ class ISYEnableSwitchEntity(ISYAuxControlEntity, SwitchEntity):
device_info=device_info, device_info=device_info,
) )
self._attr_name = description.name # Override super self._attr_name = description.name # Override super
self._change_handler: EventListener = None self._change_handler: EventListener | None = None
# pylint: disable-next=hass-missing-super-call # pylint: disable-next=hass-missing-super-call
async def async_added_to_hass(self) -> None: async def async_added_to_hass(self) -> None: