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

gateway: cleanup SensorHT and Plug class #735

Merged
merged 3 commits into from
Jun 25, 2020
Merged
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
16 changes: 6 additions & 10 deletions miio/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,9 @@ class SensorHT(SubDevice):
"""Subdevice SensorHT specific properties and methods."""

accessor = "get_prop_sensor_ht"
properties = ["temperature", "humidity", "pressure"]
properties = ["temperature", "humidity"]
_zigbee_model = "lumi.sensor_ht"
_model = "RTCGQ01LM"
_model = "WSDCGQ01LM"
_name = "Weather sensor"

@attr.s(auto_attribs=True)
Expand All @@ -962,7 +962,6 @@ class props:

temperature: int = None # in degrees celsius
humidity: int = None # in %
pressure: int = None # in hPa

@command()
def update(self):
Expand All @@ -971,7 +970,6 @@ def update(self):
try:
self._props.temperature = values[0] / 100
self._props.humidity = values[1] / 100
self._props.pressure = values[2] / 100
except Exception as ex:
raise GatewayException(
"One or more unexpected results while "
Expand All @@ -983,7 +981,7 @@ class Plug(SubDevice):
"""Subdevice Plug specific properties and methods."""

accessor = "get_prop_plug"
properties = ["power", "neutral_0", "load_power"]
properties = ["neutral_0", "load_power"]
_zigbee_model = "lumi.plug"
_model = "ZNCZ02LM"
_name = "Plug"
Expand All @@ -993,16 +991,14 @@ class props:
"""Device specific properties."""

status: str = None # 'on' / 'off'
power: int = None # diffrent power consumption?? in ?unit?
load_power: int = None # power consumption in ?unit?
load_power: int = None # power consumption in Watt

@command()
def update(self):
"""Update all device properties."""
values = self.get_property_exp(self.properties)
self._props.power = values[0]
self._props.status = values[1]
self._props.load_power = values[2]
self._props.status = values[0]
self._props.load_power = values[1]


class RemoteSwitchDoubleV1(SubDevice):
Expand Down