Skip to content
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

Rename of Strip to PowerStrip to avoid confusion with led strips #97

Merged
merged 1 commit into from
Oct 21, 2017
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
2 changes: 1 addition & 1 deletion miio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from miio.airpurifier import AirPurifier
from miio.airhumidifier import AirHumidifier
from miio.waterpurifier import WaterPurifier
from miio.strip import Strip
from miio.powerstrip import PowerStrip
from miio.ceil import Ceil
from miio.philips_bulb import PhilipsBulb
from miio.philips_eyecare import PhilipsEyecare
Expand Down
6 changes: 3 additions & 3 deletions miio/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ipaddress
import inspect
import codecs
from . import (Device, Vacuum, Plug, PlugV1, Strip, AirPurifier, Ceil,
from . import (Device, Vacuum, Plug, PlugV1, PowerStrip, AirPurifier, Ceil,
PhilipsBulb, PhilipsEyecare, ChuangmiIr, AirHumidifier,
WaterPurifier, WifiSpeaker, Yeelight)
from typing import Union, Callable, Dict, Optional # noqa: F401
Expand All @@ -17,8 +17,8 @@
"chuangmi-plug-m1": Plug,
"chuangmi-plug-v2": Plug,
"chuangmi-plug-v1": PlugV1,
"qmi-powerstrip-v1": Strip,
"zimi-powerstrip-v2": Strip,
"qmi-powerstrip-v1": PowerStrip,
"zimi-powerstrip-v2": PowerStrip,
"zhimi-airpurifier-m1": AirPurifier,
"zhimi-airpurifier-m2": AirPurifier,
"zhimi-airpurifier-v1": AirPurifier,
Expand Down
14 changes: 7 additions & 7 deletions miio/strip.py → miio/powerstrip.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ class PowerMode(enum.Enum):
Normal = 'normal'


class StripStatus:
"""Container for status reports from the strip."""
class PowerStripStatus:
"""Container for status reports from the power strip."""

def __init__(self, data: Dict[str, Any]) -> None:
# Device model: qmi.powerstrip.v1, zimi.powerstrip.v2
Expand Down Expand Up @@ -47,7 +47,7 @@ def mode(self) -> PowerMode:
return PowerMode(self.data["mode"])

def __str__(self) -> str:
s = "<StripStatus power=%s, temperature=%s, " \
s = "<PowerStripStatus power=%s, temperature=%s, " \
"load_power=%s mode=%s>" % \
(self.power,
self.temperature,
Expand All @@ -56,10 +56,10 @@ def __str__(self) -> str:
return s


class Strip(Device):
"""Main class representing the smart strip."""
class PowerStrip(Device):
"""Main class representing the smart power strip."""

def status(self) -> StripStatus:
def status(self) -> PowerStripStatus:
"""Retrieve properties."""
properties = ['power', 'temperature', 'current', 'mode']
values = self.send(
Expand All @@ -75,7 +75,7 @@ def status(self) -> StripStatus:
"count (%s) of received values.",
properties_count, values_count)

return StripStatus(
return PowerStripStatus(
defaultdict(lambda: None, zip(properties, values)))

def on(self):
Expand Down