Address cleanup commentary for Guardian Paired Sensors (#41785)

This commit is contained in:
Aaron Bach authored and GitHub committed 2020-10-13 22:01:10 +02:00
1 parent e791946f00
commit 3a59f7c2b7
3 files changed
+6 -5

No files matched your search

@@ -153,7 +153,7 @@ class PairedSensorManager:
async def async_pair_sensor(self, uid: str) -> None:
"""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)
@@ -202,7 +202,7 @@ class PairedSensorManager:
async def async_unpair_sensor(self, uid: str) -> None:
"""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:
self._paired_uids.remove(uid)
@@ -305,7 +305,6 @@ class PairedSensorEntity(GuardianEntity):
async def async_added_to_hass(self) -> None:
"""Perform tasks when the entity is added."""
await super().async_added_to_hass()
self._async_update_from_latest_data()
@@ -45,7 +45,8 @@ async def async_setup_entry(
) -> None:
"""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."""
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][
API_SENSOR_PAIRED_SENSOR_STATUS
+2 -1
View File
@@ -49,7 +49,8 @@ async def async_setup_entry(
) -> None:
"""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."""
coordinator = hass.data[DOMAIN][DATA_COORDINATOR][entry.entry_id][
API_SENSOR_PAIRED_SENSOR_STATUS