Пример #1
0
        async def assertRemaining(duration, remaining, last_power, result):
            getter = LightMessages.GetHevCycle()
            state = LightMessages.StateHevCycle(
                duration_s=duration, remaining_s=remaining, last_power=last_power
            )
            await assertResponse(getter, [state])

            getter = LightMessages.GetLastHevCycleResult()
            state = LightMessages.StateLastHevCycleResult(result=result)
            await assertResponse(getter, [state])
Пример #2
0
        assert device.attrs.clean_details.indication is False
        assert device.attrs.clean_details.default_duration_s == 7200

        getter = LightMessages.GetLightPower()
        state = DeviceMessages.StatePower(level=0)
        await assertResponse(getter, [state])
        assert device.attrs.power == 0
        getter = DeviceMessages.GetPower()
        state = DeviceMessages.StatePower(level=0)
        await assertResponse(getter, [state])
        assert device.attrs.power == 0

        setter = LightMessages.SetHevCycle(enable=True, duration_s=0, res_required=False)
        await assertResponse(setter, True)
        getter = LightMessages.GetHevCycle()
        state = LightMessages.StateHevCycle(duration_s=7200, remaining_s=7200, last_power=0)
        await assertResponse(getter, [state])
        assert device.attrs.clean_details.enabled is True
        assert device.attrs.clean_details.duration_s == 7200
        assert device.attrs.clean_details.remaining_s == 7200
        assert device.attrs.clean_details.last_result is LightLastHevCycleResult.BUSY
        assert device.attrs.clean_details.indication is False
        assert device.attrs.clean_details.default_duration_s == 7200

        # Reports as on even though it's actually not
        assert device.attrs.power == 0
        getter = DeviceMessages.GetPower()
        state = DeviceMessages.StatePower(level=0xFFFF)
        await assertResponse(getter, [state])
        assert device.attrs.power == 0
        getter = LightMessages.GetLightPower()