From f3255e3331d42f14072b834f06bd94efe1d4d343 Mon Sep 17 00:00:00 2001 From: starkillerOG Date: Thu, 25 Jun 2020 23:29:33 +0200 Subject: [PATCH] gateway: cleanup SensorHT and Plug class (#735) * Update SensorHT and Plug class Remove properties that do not apply to these devices * fix wrong model for SensorHT apprently i mixed this one up when filling in all the models.... * add unit to Plug device --- miio/gateway.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/miio/gateway.py b/miio/gateway.py index de8dacf73..2cb8006ea 100644 --- a/miio/gateway.py +++ b/miio/gateway.py @@ -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) @@ -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): @@ -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 " @@ -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" @@ -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):