def test_status(self):
        self.device._reset_state()

        assert self.is_on() is True
        assert self.state().mode == PowerMode(self.device.start_state["mode"])
        assert self.state().temperature == self.device.start_state["temperature"]
        assert self.state().current == self.device.start_state["current"]
        assert self.state().load_power == self.device.start_state["power_consume_rate"]
Exemplo n.º 2
0
    async def async_set_power_mode(self, mode: str):
        """Set the power mode."""
        if self._device_features & FEATURE_SET_POWER_MODE == 0:
            return

        from miio.powerstrip import PowerMode

        await self._try_command(
            "Setting the power mode of the power strip failed.",
            self._plug.set_power_mode, PowerMode(mode))
Exemplo n.º 3
0
    def async_set_power_mode(self, mode: str):
        """Set the power mode."""
        if self.supported_features & SUPPORT_SET_POWER_MODE == 0:
            return

        from miio.powerstrip import PowerMode

        yield from self._try_command(
            "Setting the power mode of the power strip failed.",
            self._plug.set_power_mode, PowerMode(mode))
Exemplo n.º 4
0
    def test_status(self):
        self.device._reset_state()

        assert repr(self.state()) == repr(PowerStripStatus(self.device.start_state))

        assert self.is_on() is True
        assert self.state().mode == PowerMode(self.device.start_state["mode"])
        assert self.state().temperature == self.device.start_state["temperature"]
        assert self.state().current == self.device.start_state["current"]
        assert self.state().load_power == self.device.start_state["power_consume_rate"]
        assert self.state().voltage == self.device.start_state["voltage"] / 100.0
        assert self.state().power_factor == self.device.start_state["power_factor"]
        assert self.state().leakage_current == self.device.start_state["elec_leakage"]