mirror of
https://github.com/python-kasa/python-kasa.git
synced 2024-12-23 03:33:35 +00:00
prefer sync attribute over asyncio.run
This commit is contained in:
parent
9907c6416b
commit
583c785611
@ -211,16 +211,6 @@ class SmartDevice:
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
@property
|
|
||||||
def sys_info(self) -> Dict[str, Any]:
|
|
||||||
"""Return the complete system information.
|
|
||||||
|
|
||||||
:return: System information dict.
|
|
||||||
:rtype: dict
|
|
||||||
"""
|
|
||||||
|
|
||||||
return asyncio.run(self.get_sys_info())
|
|
||||||
|
|
||||||
async def get_sys_info(self) -> Dict:
|
async def get_sys_info(self) -> Dict:
|
||||||
"""Retrieve system information.
|
"""Retrieve system information.
|
||||||
|
|
||||||
@ -601,11 +591,11 @@ class SmartDevice:
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s model %s at %s (%s), is_on: %s - dev specific: %s>" % (
|
return "<%s model %s at %s (%s), is_on: %s - dev specific: %s>" % (
|
||||||
self.__class__.__name__,
|
self.__class__.__name__,
|
||||||
asyncio.run(self.get_model()),
|
self.sync.get_model(),
|
||||||
self.host,
|
self.host,
|
||||||
asyncio.run(self.get_alias()),
|
self.sync.get_alias(),
|
||||||
asyncio.run(self.is_on()),
|
self.sync.is_on(),
|
||||||
asyncio.run(self.get_state_information()),
|
self.sync.get_state_information(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class SmartStrip(SmartPlug):
|
|||||||
self._device_type = DeviceType.Strip
|
self._device_type = DeviceType.Strip
|
||||||
self.plugs = {}
|
self.plugs = {}
|
||||||
|
|
||||||
sys_info = asyncio.run(self.get_sys_info())
|
sys_info = self.sync.get_sys_info()
|
||||||
children = sys_info["children"]
|
children = sys_info["children"]
|
||||||
self.num_children = len(children)
|
self.num_children = len(children)
|
||||||
for plug in range(self.num_children):
|
for plug in range(self.num_children):
|
||||||
|
Loading…
Reference in New Issue
Block a user