Address cleanup commentary for Guardian Paired Sensors (#41785)

This commit is contained in:
Aaron Bach 2020-10-13 14:01:10 -06:00 committed by GitHub
parent e791946f00
commit 3a59f7c2b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View file

@ -153,7 +153,7 @@ class PairedSensorManager:
async def async_pair_sensor(self, uid: str) -> None: async def async_pair_sensor(self, uid: str) -> None:
"""Add a new paired sensor coordinator.""" """Add a new paired sensor coordinator."""
LOGGER.info("Adding paired sensor: %s", uid) LOGGER.debug("Adding paired sensor: %s", uid)
self._paired_uids.add(uid) self._paired_uids.add(uid)
@ -202,7 +202,7 @@ class PairedSensorManager:
async def async_unpair_sensor(self, uid: str) -> None: async def async_unpair_sensor(self, uid: str) -> None:
"""Remove a paired sensor coordinator.""" """Remove a paired sensor coordinator."""
LOGGER.info("Removing paired sensor: %s", uid) LOGGER.debug("Removing paired sensor: %s", uid)
# Clear out objects related to this paired sensor: # Clear out objects related to this paired sensor:
self._paired_uids.remove(uid) self._paired_uids.remove(uid)
@ -305,7 +305,6 @@ class PairedSensorEntity(GuardianEntity):
async def async_added_to_hass(self) -> None: async def async_added_to_hass(self) -> None:
"""Perform tasks when the entity is added.""" """Perform tasks when the entity is added."""
await super().async_added_to_hass()
self._async_update_from_latest_data() self._async_update_from_latest_data()

View file

@ -45,7 +45,8 @@ async def async_setup_entry(
) -> None: ) -> None:
"""Set up Guardian switches based on a config entry.""" """Set up Guardian switches based on a config entry."""
async def add_new_paired_sensor(uid: str) -> None: @callback
def add_new_paired_sensor(uid: str) -> None:
"""Add a new paired sensor.""" """Add a new paired sensor."""
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][ coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][
API_SENSOR_PAIRED_SENSOR_STATUS API_SENSOR_PAIRED_SENSOR_STATUS

View file

@ -49,7 +49,8 @@ async def async_setup_entry(
) -> None: ) -> None:
"""Set up Guardian switches based on a config entry.""" """Set up Guardian switches based on a config entry."""
async def add_new_paired_sensor(uid: str) -> None: @callback
def add_new_paired_sensor(uid: str) -> None:
"""Add a new paired sensor.""" """Add a new paired sensor."""
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][ coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][
API_SENSOR_PAIRED_SENSOR_STATUS API_SENSOR_PAIRED_SENSOR_STATUS