8000 Check for emeter support on power strips/multiple plug outlets by acmay · Pull Request #41 · python-kasa/python-kasa · GitHub
[go: up one dir, main page]

Skip to content

Check for emeter support on power strips/multiple plug outlets #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions kasa/smartdevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,17 @@ async def _query_helper(

return result

@property # type: ignore
@requires_update
def has_emeter(self) -> bool:
"""Return if device has an energy meter.
"""Return whether device has an energy meter.

:return: True if energey meter is available
False if energymeter is missing
:return: True if energy meter is available
False otherwise
"""
raise NotImplementedError()
sys_info = self.sys_info
features = sys_info["feature"].split(":")
return "ENE" in features

async def get_sys_info(self) -> Dict[str, Any]:
"""Retrieve system information.
Expand Down
12 changes: 0 additions & 12 deletions kasa/smartplug.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,6 @@ def is_dimmable(self):
sys_info = self.sys_info
return "brightness" in sys_info

@property # type: ignore
@requires_update
def has_emeter(self):
"""Return whether device has an energy meter.

:return: True if energy meter is available
False otherwise
"""
sys_info = self.sys_info
features = sys_info["feature"].split(":")
return "ENE" in features

@property # type: ignore
@requires_update
def is_on(self) -> bool:
Expand Down
10 changes: 0 additions & 10 deletions kasa/smartstrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ class SmartStrip(SmartDevice):
and should be handled by the user of the library.
"""

def has_emeter(self) -> bool:
"""Return True as strips has always an emeter."""
return True

def __init__(self, host: str, *, cache_ttl: int = 3) -> None:
SmartDevice.__init__(self, host=host, cache_ttl=cache_ttl)
self.emeter_type = "emeter"
Expand Down Expand Up @@ -288,12 +284,6 @@ def device_id(self) -> str:
"""
return f"{self.mac}_{self.child_id}"

@property # type: ignore
@requires_update
def has_emeter(self):
"""Single sockets have always an emeter."""
return True

@property # type: ignore
@requires_update
def alias(self) -> str:
Expand Down
0