Пример #1
0
async def test_attributes(caplog, aio_httpclient):
    caplog.set_level(logging.DEBUG)
    auth = MagicMock()

    aio_httpclient.get.return_value = MockResponse(json.dumps(DATA1), 200)

    aircon = Aircon(BackendSelectorMock(), auth, SAID, None)
    await aircon.connect()
    assert aircon.get_online() is False
    assert aircon.get_power_on() is False
    assert aircon.get_display_on() is False
    assert aircon.get_current_temp() == 23
    assert aircon.get_current_humidity() == 56
    assert aircon.get_temp() == 30
    assert aircon.get_humidity() == 40
    assert aircon.get_mode() == Mode.Heat
    assert aircon.get_sixthsense_mode() is False
    assert aircon.get_fanspeed() == FanSpeed.Off
    assert aircon.get_h_louver_swing() is True
    assert aircon.get_turbo_mode() is False
    assert aircon.get_eco_mode() is False
    assert aircon.get_quiet_mode() is False
    await aircon.disconnect()

    aio_httpclient.get.return_value = MockResponse(json.dumps(DATA2), 200)
    await aircon.connect()
    assert aircon.get_online() is True
    assert aircon.get_power_on() is True
    assert aircon.get_display_on() is True
    assert aircon.get_current_temp() == 30
    assert aircon.get_current_humidity() == 31
    assert aircon.get_temp() == 29
    assert aircon.get_humidity() == 45
    assert aircon.get_mode() == Mode.Fan
    assert aircon.get_sixthsense_mode() is True
    assert aircon.get_fanspeed() == FanSpeed.Auto
    assert aircon.get_h_louver_swing() is False
    assert aircon.get_turbo_mode() is True
    assert aircon.get_eco_mode() is True
    assert aircon.get_quiet_mode() is True
    await aircon.disconnect()
Пример #2
0
 def print_status(ac: Aircon):
     print("online: " + str(ac.get_online()))
     print("power_on: " + str(ac.get_power_on()))
     print("temp: " + str(ac.get_temp()))
     print("humidity: " + str(ac.get_humidity()))
     print("current_temp: " + str(ac.get_current_temp()))
     print("current_humidity: " + str(ac.get_current_humidity()))
     print("mode: " + str(ac.get_mode()))
     print("sixthsense_mode: " + str(ac.get_sixthsense_mode()))
     print("fanspeed: " + str(ac.get_fanspeed()))
     print("h_louver_swing: " + str(ac.get_h_louver_swing()))
     print("turbo_mode: " + str(ac.get_turbo_mode()))
     print("eco_mode: " + str(ac.get_eco_mode()))
     print("quiet_mode: " + str(ac.get_quiet_mode()))
     print("display_on: " + str(ac.get_display_on()))