mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-09 20:24:02 +00:00
Consolidate update parameters
This commit is contained in:
@@ -36,14 +36,14 @@ class SmartChildDevice(SmartDevice):
|
||||
self._id = info["device_id"]
|
||||
self.protocol = _ChildProtocolWrapper(self._id, parent.protocol)
|
||||
|
||||
async def update(self, update_children: bool = True, update_parent: bool = True):
|
||||
async def update(self, update_children_or_parent: bool = True):
|
||||
"""Update the device.
|
||||
|
||||
Calling update directly on a child device will update the parent
|
||||
and only this child.
|
||||
"""
|
||||
if update_parent:
|
||||
await self._parent._update(update_children=False, called_from_child=self)
|
||||
if update_children_or_parent:
|
||||
await self._parent._update(called_from_child=self)
|
||||
else:
|
||||
await self._update()
|
||||
|
||||
|
@@ -147,9 +147,9 @@ class SmartDevice(Device):
|
||||
if "child_device" in self._components and not self.children:
|
||||
await self._initialize_children()
|
||||
|
||||
async def update(self, update_children: bool = True, update_parent: bool = True):
|
||||
async def update(self, update_children_or_parent: bool = True):
|
||||
"""Update the device."""
|
||||
await self._update(update_children)
|
||||
await self._update(update_children_or_parent)
|
||||
|
||||
async def _update(
|
||||
self, update_children: bool = True, called_from_child: SmartDevice | None = None
|
||||
|
Reference in New Issue
Block a user