Code fixes and cleanup for roomba integration (#34409)
* Remove side effects from properties * Remove redundant return value in async_send_command * Move callback registeration to async_added_to_hass * Code cleanup for roomba
This commit is contained in:
parent
7a8d1c00a4
commit
2686869f88
4 changed files with 4 additions and 16 deletions
|
@ -18,7 +18,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
status = roomba_reported_state(roomba).get("bin", {})
|
||||
if "full" in status:
|
||||
roomba_vac = RoombaBinStatus(roomba, blid)
|
||||
roomba_vac.register_callback()
|
||||
async_add_entities([roomba_vac], True)
|
||||
|
||||
|
||||
|
@ -45,8 +44,4 @@ class RoombaBinStatus(IRobotEntity, BinarySensorDevice):
|
|||
@property
|
||||
def state(self):
|
||||
"""Return the state of the sensor."""
|
||||
bin_status = (
|
||||
roomba_reported_state(self.vacuum).get("bin", {}).get("full", False)
|
||||
)
|
||||
_LOGGER.debug("Update Full Bin status from the vacuum: %s", bin_status)
|
||||
return bin_status
|
||||
return roomba_reported_state(self.vacuum).get("bin", {}).get("full", False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue