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:
Teemu R
2017-10-07 17:36:49 +02:00
committed by GitHub
parent af90a36153
commit d22eceefae
3 changed files with 43 additions and 17 deletions

View File

@@ -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:
"""