def test_status(self): self.device._reset_state() assert repr(self.state()) == repr( AirHumidifierStatus(self.device.start_state)) assert self.is_on() is True assert self.state( ).temperature == self.device.start_state["temp_dec"] / 10.0 assert self.state().humidity == self.device.start_state["humidity"] assert self.state().mode == OperationMode( self.device.start_state["mode"]) assert self.state().led_brightness == LedBrightness( self.device.start_state["led_b"]) assert self.state().buzzer == ( self.device.start_state["buzzer"] == 'on') assert self.state().child_lock == ( self.device.start_state["child_lock"] == 'on') assert self.state( ).target_humidity == self.device.start_state["limit_hum"] assert self.state( ).trans_level == self.device.start_state["trans_level"] assert self.state().speed == self.device.start_state["speed"] assert self.state().depth == self.device.start_state["depth"] assert self.state().dry == (self.device.start_state["dry"] == 'on') assert self.state().use_time == self.device.start_state["use_time"] assert self.state( ).hardware_version == self.device.start_state["hw_version"] assert self.state( ).button_pressed == self.device.start_state["button_pressed"]
def test_status(self): self.device._reset_state() device_info = DeviceInfo(self.device.dummy_device_info) assert repr(self.state()) == repr(AirHumidifierStatus(self.device.start_state, device_info)) assert self.is_on() is True assert self.state().temperature == self.device.start_state["temp_dec"] / 10.0 assert self.state().humidity == self.device.start_state["humidity"] assert self.state().mode == OperationMode(self.device.start_state["mode"]) assert self.state().led_brightness == LedBrightness(self.device.start_state["led_b"]) assert self.state().buzzer == (self.device.start_state["buzzer"] == 'on') assert self.state().child_lock == (self.device.start_state["child_lock"] == 'on') assert self.state().target_humidity == self.device.start_state["limit_hum"] assert self.state().trans_level == self.device.start_state["trans_level"] assert self.state().motor_speed is None assert self.state().depth is None assert self.state().dry is None assert self.state().use_time == self.device.start_state["use_time"] assert self.state().hardware_version == self.device.start_state["hw_version"] assert self.state().button_pressed == self.device.start_state["button_pressed"] assert self.state().firmware_version == device_info.firmware_version assert self.state().firmware_version_major == device_info.firmware_version.rsplit('_', 1)[0] assert self.state().firmware_version_minor == int(device_info.firmware_version.rsplit('_', 1)[1]) assert self.state().strong_mode_enabled is False
def speed(self): """Return the current speed.""" if self._state: from miio.airhumidifier import OperationMode return OperationMode(self._state_attrs[ATTR_MODE]).name return None
def test_status(dev): assert dev.status().is_on is True assert dev.status().humidity == dev.start_state["humidity"] assert dev.status().mode == OperationMode(dev.start_state["mode"]) assert dev.status().led_brightness == LedBrightness( dev.start_state["led_b"]) assert dev.status().buzzer == (dev.start_state["buzzer"] == "on") assert dev.status().child_lock == (dev.start_state["child_lock"] == "on") assert dev.status().target_humidity == dev.start_state["limit_hum"] if dev.model == MODEL_HUMIDIFIER_CB1: assert dev.status().temperature == dev.start_state["temperature"] else: assert dev.status().temperature == dev.start_state["temp_dec"] / 10.0 if dev.model == MODEL_HUMIDIFIER_V1: # Extra props only on v1 assert dev.status().trans_level == dev.start_state["trans_level"] assert dev.status().button_pressed == dev.start_state["button_pressed"] assert dev.status().motor_speed is None assert dev.status().depth is None assert dev.status().dry is None assert dev.status().water_level is None assert dev.status().water_tank_detached is None if dev.model in [MODEL_HUMIDIFIER_CA1, MODEL_HUMIDIFIER_CB1]: assert dev.status().motor_speed == dev.start_state["speed"] assert dev.status().depth == dev.start_state["depth"] assert dev.status().water_level == int(dev.start_state["depth"] / 1.2) assert dev.status().water_tank_detached == ( dev.start_state["depth"] == 127) assert dev.status().dry == (dev.start_state["dry"] == "on") # Extra props only on v1 should be none now assert dev.status().trans_level is None assert dev.status().button_pressed is None assert dev.status().use_time == dev.start_state["use_time"] assert dev.status().hardware_version == dev.start_state["hw_version"] device_info = DeviceInfo(dev.dummy_device_info) assert dev.status().firmware_version == device_info.firmware_version assert (dev.status().firmware_version_major == device_info.firmware_version.rsplit("_", 1)[0]) try: version_minor = int(device_info.firmware_version.rsplit("_", 1)[1]) except IndexError: version_minor = 0 assert dev.status().firmware_version_minor == version_minor assert dev.status().strong_mode_enabled is False
def test_status(self): self.device._reset_state() assert self.is_on() is True assert self.state( ).temperature == self.device.start_state["temp_dec"] / 10.0 assert self.state().humidity == self.device.start_state["humidity"] assert self.state().mode == OperationMode( self.device.start_state["mode"]) assert self.state().led_brightness == LedBrightness( self.device.start_state["led_b"]) assert self.state().buzzer == ( self.device.start_state["buzzer"] == 'on')
def test_status(self): self.device._reset_state() device_info = DeviceInfo(self.device.dummy_device_info) assert repr(self.state()) == repr( AirHumidifierStatus(self.device.start_state, device_info)) assert self.is_on() is True assert self.state( ).temperature == self.device.start_state["temp_dec"] / 10.0 assert self.state().humidity == self.device.start_state["humidity"] assert self.state().mode == OperationMode( self.device.start_state["mode"]) assert self.state().led_brightness == LedBrightness( self.device.start_state["led_b"]) assert self.state().buzzer == ( self.device.start_state["buzzer"] == "on") assert self.state().child_lock == ( self.device.start_state["child_lock"] == "on") assert self.state( ).target_humidity == self.device.start_state["limit_hum"] assert self.state().trans_level is None assert self.state().motor_speed == self.device.start_state["speed"] assert self.state().depth == self.device.start_state["depth"] assert self.state().water_level == int( self.device.start_state["depth"] / 1.25) assert self.state().water_tank_detached == ( self.device.start_state["depth"] == 127) assert self.state().dry == (self.device.start_state["dry"] == "on") assert self.state().use_time == self.device.start_state["use_time"] assert self.state( ).hardware_version == self.device.start_state["hw_version"] assert self.state().button_pressed is None assert self.state().firmware_version == device_info.firmware_version assert (self.state().firmware_version_major == device_info.firmware_version.rsplit("_", 1)[0]) try: version_minor = int(device_info.firmware_version.rsplit("_", 1)[1]) except IndexError: version_minor = 0 assert self.state().firmware_version_minor == version_minor assert self.state().strong_mode_enabled is False