mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-20 03:30:12 +00:00
move has_emeter implementation from SmartDevice to SmartPlug, avoid using features() internally (#93)
* move has_emeter implementation from SmartDevice to SmartPlug, avoid using features() internally * add stacklevel to deprecation warnings to see where they are really called * make tests pass on a real device. if PLUG_IP is not None, the tests will be run on a device at the defined IP address
This commit is contained in:
@@ -80,6 +80,16 @@ class SmartPlug(SmartDevice):
|
||||
else:
|
||||
raise ValueError("State %s is not valid.", value)
|
||||
|
||||
@property
|
||||
def has_emeter(self):
|
||||
"""
|
||||
Returns whether device has an energy meter.
|
||||
:return: True if energy meter is available
|
||||
False otherwise
|
||||
"""
|
||||
features = self.sys_info['feature'].split(':')
|
||||
return SmartDevice.FEATURE_ENERGY_METER in features
|
||||
|
||||
@property
|
||||
def is_on(self) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user