Пример #1
0
async def test_tilt_vibration_sensor(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id(
        "3014F7110TILTVIBRATIONSENSOR")
    assert isinstance(d, TiltVibrationSensor)
    assert d.accelerationSensorEventFilterPeriod == 0.5
    assert d.accelerationSensorMode == AccelerationSensorMode.FLAT_DECT
    assert (d.accelerationSensorSensitivity ==
            AccelerationSensorSensitivity.SENSOR_RANGE_2G)
    assert d.accelerationSensorTriggerAngle == 45
    assert d.accelerationSensorTriggered is True

    assert str(d) == (
        "HmIP-STV Garage Neigungs- und Erschütterungssensor lowBat(False) unreach(False)"
        " rssiDeviceValue(-59) rssiPeerValue(None) configPending(False) dutyCycle(False)"
        " accelerationSensorEventFilterPeriod(0.5) accelerationSensorMode(FLAT_DECT) "
        "accelerationSensorSensitivity(SENSOR_RANGE_2G) accelerationSensorTriggerAngle(45)"
        " accelerationSensorTriggered(True)")
    await asyncio.gather(
        d.set_acceleration_sensor_event_filter_period(10.0),
        d.set_acceleration_sensor_mode(AccelerationSensorMode.ANY_MOTION),
        d.set_acceleration_sensor_sensitivity(
            AccelerationSensorSensitivity.SENSOR_RANGE_4G),
        d.set_acceleration_sensor_trigger_angle(30),
    )
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id(
        "3014F7110TILTVIBRATIONSENSOR")

    assert d.accelerationSensorEventFilterPeriod == 10.0
    assert d.accelerationSensorMode == AccelerationSensorMode.ANY_MOTION
    assert (d.accelerationSensorSensitivity ==
            AccelerationSensorSensitivity.SENSOR_RANGE_4G)
    assert d.accelerationSensorTriggerAngle == 30
Пример #2
0
async def test_blind_module(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F71100BLIND_MODULE00")

    assert str(d) == (
        "HmIP-HDM1 Sonnenschutz Balkontür lowBat(False) unreach(False) rssiDeviceValue(-85) "
        "rssiPeerValue(-78) configPending(False) dutyCycle(False) automationDriveSpeed(SLOW_SPEED) "
        "manualDriveSpeed(NOMINAL_SPEED) favoritePrimaryShadingPosition(0.5) "
        "favoriteSecondaryShadingPosition(0.5) primaryCloseAdjustable(True) "
        "primaryOpenAdjustable(True) primaryShadingStateType(POSITION_USED) "
        "secondaryCloseAdjustable(False) secondaryOpenAdjustable(False) "
        "secondaryShadingStateType(NOT_EXISTENT) primaryShadingLevel(0.94956) "
        "secondaryShadingLevel(0) previousPrimaryShadingLevel(None) "
        "previousSecondaryShadingLevel(None) identifyOemSupported(True) productId(10) "
        "profileMode(AUTOMATIC) userDesiredProfileMode(AUTOMATIC) shadingDriveVersion(None) "
        "shadingPackagePosition(TOP) shadingPositionAdjustmentActive(None) "
        "shadingPositionAdjustmentClientId(None)")

    await d.set_primary_shading_level(5)

    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F71100BLIND_MODULE00")
    assert d.primaryShadingLevel == 5

    await d.stop()

    await d.set_secondary_shading_level(0.5, 1.0)

    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F71100BLIND_MODULE00")
    assert d.primaryShadingLevel == 0.5
    assert d.secondaryShadingLevel == 1.0
Пример #3
0
async def test_wall_mounted_thermostat_pro(fake_async_home: AsyncHome):
    d = fake_async_home.search_device_by_id('3014F7110000000000000022')
    assert isinstance(d, AsyncWallMountedThermostatPro)
    assert d.id == "3014F7110000000000000022"
    assert d.label == "Wandthermostat"
    assert d.lastStatusUpdate == datetime(2018, 4, 23, 20, 48, 54,
                                          382000) + timedelta(0, utc_offset)
    assert d.manufacturerCode == 1
    assert d.modelId == 297
    assert d.modelType == "HmIP-WTH-2"
    assert d.oem == "eQ-3"
    assert d.serializedGlobalTradeItemNumber == "3014F7110000000000000022"
    assert d.updateState == "UP_TO_DATE"
    assert d.humidity == 43
    assert d.setPointTemperature == 5.0
    assert d.display == ClimateControlDisplay.ACTUAL_HUMIDITY
    assert d.temperatureOffset == 0.0
    assert d.lowBat == False
    assert d.operationLockActive == False
    assert d.routerModuleEnabled == False
    assert d.routerModuleSupported == False
    assert d.rssiDeviceValue == -76
    assert d.rssiPeerValue == -63
    assert d.unreach == False
    assert d.dutyCycle == False
    assert d.availableFirmwareVersion == "0.0.0"
    assert d.firmwareVersion == "1.8.0"

    with no_ssl_verification():
        await d.set_display(ClimateControlDisplay.ACTUAL)
        await fake_async_home.get_current_state()
        d = fake_async_home.search_device_by_id('3014F7110000000000000022')
        assert d.display == ClimateControlDisplay.ACTUAL
Пример #4
0
async def test_water_sensor(fake_async_home: AsyncHome):
    with no_ssl_verification():
        d = fake_async_home.search_device_by_id("3014F7110000000000000050")
        assert d.label == "Wassersensor"
        assert d.routerModuleEnabled == False
        assert d.routerModuleSupported == False

        assert d.incorrectPositioned == True
        assert d.acousticAlarmSignal == AcousticAlarmSignal.FREQUENCY_RISING
        assert d.acousticAlarmTiming == AcousticAlarmTiming.ONCE_PER_MINUTE
        assert d.acousticWaterAlarmTrigger == WaterAlarmTrigger.WATER_DETECTION
        assert d.inAppWaterAlarmTrigger == WaterAlarmTrigger.WATER_MOISTURE_DETECTION
        assert d.moistureDetected == False
        assert d.sirenWaterAlarmTrigger == WaterAlarmTrigger.WATER_MOISTURE_DETECTION
        assert d.waterlevelDetected == False

        await d.set_acoustic_alarm_timing(AcousticAlarmTiming.SIX_MINUTES)
        await d.set_acoustic_alarm_signal(
            AcousticAlarmSignal.FREQUENCY_ALTERNATING_LOW_HIGH)
        await d.set_inapp_water_alarm_trigger(
            WaterAlarmTrigger.MOISTURE_DETECTION)
        await d.set_acoustic_water_alarm_trigger(WaterAlarmTrigger.NO_ALARM)
        await d.set_siren_water_alarm_trigger(WaterAlarmTrigger.NO_ALARM)

        await fake_async_home.get_current_state()
        d = fake_async_home.search_device_by_id("3014F7110000000000000050")

        assert d.acousticAlarmTiming == AcousticAlarmTiming.SIX_MINUTES
        assert d.acousticAlarmSignal == AcousticAlarmSignal.FREQUENCY_ALTERNATING_LOW_HIGH
        assert d.acousticWaterAlarmTrigger == WaterAlarmTrigger.NO_ALARM
        assert d.inAppWaterAlarmTrigger == WaterAlarmTrigger.MOISTURE_DETECTION
        assert d.sirenWaterAlarmTrigger == WaterAlarmTrigger.NO_ALARM
Пример #5
0
async def test_switching_alarm_group(no_ssl_fake_async_home: AsyncHome):
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000022")
    assert isinstance(g, AlarmSwitchingGroup)

    assert g.signalAcoustic == AcousticAlarmSignal.FREQUENCY_RISING
    assert g.signalOptical == OpticalAlarmSignal.DOUBLE_FLASHING_REPEATING
    assert str(g) == (
        "ALARM_SWITCHING SIREN on(False) dimLevel(None) onTime(180.0) "
        "signalAcoustic(FREQUENCY_RISING) signalOptical(DOUBLE_FLASHING_REPEATING) "
        "smokeDetectorAlarmType(IDLE_OFF) acousticFeedbackEnabled(True)")

    await g.test_signal_acoustic(AcousticAlarmSignal.FREQUENCY_HIGHON_OFF)
    await g.test_signal_optical(
        OpticalAlarmSignal.BLINKING_ALTERNATELY_REPEATING)

    await g.set_signal_acoustic(AcousticAlarmSignal.FREQUENCY_HIGHON_OFF)
    await g.set_signal_optical(
        OpticalAlarmSignal.BLINKING_ALTERNATELY_REPEATING)
    await g.set_on_time(5)

    await no_ssl_fake_async_home.get_current_state()
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000022")

    assert g.signalAcoustic == AcousticAlarmSignal.FREQUENCY_HIGHON_OFF
    assert g.signalOptical == OpticalAlarmSignal.BLINKING_ALTERNATELY_REPEATING
    assert g.onTime == 5
async def test_clearconfig(no_ssl_fake_async_home: AsyncHome):
    d1 = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000001")
    await no_ssl_fake_async_home.get_current_state(clearConfig=True)
    d2 = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000001")

    assert d1.id == d2.id
    assert d1 != d2
async def test_floor_terminal_block(no_ssl_fake_async_home: AsyncHome):
    d = AsyncFloorTerminalBlock6(no_ssl_fake_async_home._connection)
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000BBBBB1")

    assert d.frostProtectionTemperature == 8.0
    assert d.coolingEmergencyValue == 0.0
    assert d.globalPumpControl is True
    assert d.heatingEmergencyValue == 0.25
    assert d.heatingLoadType == HeatingLoadType.LOAD_BALANCING
    assert d.heatingValveType == HeatingValveType.NORMALLY_CLOSE
    assert d.valveProtectionDuration == 5
    assert d.valveProtectionSwitchingInterval == 14

    assert d.pumpFollowUpTime == 2
    assert d.pumpLeadTime == 2
    assert d.pumpProtectionDuration == 1
    assert d.pumpProtectionSwitchingInterval == 14

    assert str(d) == (
        "HmIP-FAL230-C6 Fußbodenheizungsaktor lowBat(None) unreach(False) "
        "rssiDeviceValue(-62) rssiPeerValue(None) configPending(False) dutyCycle(False) "
        "globalPumpControl(True) heatingValveType(NORMALLY_CLOSE) heatingLoadType(LOAD_BALANCING) "
        "coolingEmergencyValue(0.0) frostProtectionTemperature(8.0) "
        "heatingEmergencyValue(0.25) valveProtectionDuration(5) valveProtectionSwitchingInterval(14) "
        "pumpFollowUpTime(2) pumpLeadTime(2) "
        "pumpProtectionDuration(1) pumpProtectionSwitchingInterval(14)"
    )

    d = AsyncFloorTerminalBlock10(no_ssl_fake_async_home._connection)
    d = no_ssl_fake_async_home.search_device_by_id("3014F71100000000FAL24C10")

    assert str(d) == (
        "HmIP-FAL24-C10 Fußbodenheizungsaktor lowBat(None) unreach(False) "
        "rssiDeviceValue(-73) rssiPeerValue(-74) configPending(False) "
        "dutyCycle(False) globalPumpControl(True) heatingValveType(NORMALLY_CLOSE) "
        "heatingLoadType(LOAD_BALANCING) coolingEmergencyValue(0.0) "
        "frostProtectionTemperature(8.0) heatingEmergencyValue(0.25) "
        "valveProtectionDuration(5) valveProtectionSwitchingInterval(14) "
        "pumpFollowUpTime(2) pumpLeadTime(2) pumpProtectionDuration(1) "
        "pumpProtectionSwitchingInterval(14)"
    )

    d = AsyncFloorTerminalBlock12(no_ssl_fake_async_home._connection)
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000049")
    assert d.minimumFloorHeatingValvePosition == 0.0

    await d.set_minimum_floor_heating_valve_position(0.2)

    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000049")
    assert d.minimumFloorHeatingValvePosition == 0.2

    assert str(d) == (
        "HmIP-FALMOT-C12 Fußbodenheizungsaktor OG motorisch lowBat(None) unreach(False) "
        "rssiDeviceValue(-55) rssiPeerValue(None) configPending(False) dutyCycle(False) "
        "minimumFloorHeatingValvePosition(0.2) "
        "pulseWidthModulationAtLowFloorHeatingValvePositionEnabled(True) coolingEmergencyValue(0.0) "
        "frostProtectionTemperature(8.0) valveProtectionDuration(5) valveProtectionSwitchingInterval(14)"
    )
Пример #8
0
async def test_full_flush_shutter(no_ssl_fake_async_home: AsyncHome):
    d = FullFlushShutter(no_ssl_fake_async_home._connection)
    d = no_ssl_fake_async_home.search_device_by_id("3014F711ACBCDABCADCA66")
    assert d.shutterLevel == 1.0

    await d.set_shutter_level(0.4)
    await d.set_shutter_stop()  # this will not do anything in the test run
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F711ACBCDABCADCA66")
    assert d.shutterLevel == 0.4
async def test_acceleration_sensor(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000031")
    assert isinstance(d, AsyncAccelerationSensor)
    assert d.accelerationSensorEventFilterPeriod == 3.0
    assert d.accelerationSensorMode == AccelerationSensorMode.FLAT_DECT
    assert (
        d.accelerationSensorNeutralPosition
        == AccelerationSensorNeutralPosition.VERTICAL
    )
    assert (
        d.accelerationSensorSensitivity == AccelerationSensorSensitivity.SENSOR_RANGE_4G
    )
    assert d.accelerationSensorTriggerAngle == 45
    assert d.accelerationSensorTriggered is True
    assert d.notificationSoundTypeHighToLow == NotificationSoundType.SOUND_LONG
    assert d.notificationSoundTypeLowToHigh == NotificationSoundType.SOUND_LONG

    assert str(d) == (
        "HmIP-SAM Garagentor lowBat(False) unreach(False) "
        "rssiDeviceValue(-88) rssiPeerValue(None) configPending(False)"
        " dutyCycle(False) accelerationSensorEventFilterPeriod(3.0)"
        " accelerationSensorMode(FLAT_DECT) accelerationSensorNeutralPosition(VERTICAL)"
        " accelerationSensorSensitivity(SENSOR_RANGE_4G) accelerationSensorTriggerAngle(45)"
        " accelerationSensorTriggered(True) notificationSoundTypeHighToLow(SOUND_LONG)"
        " notificationSoundTypeLowToHigh(SOUND_LONG)"
    )
    await asyncio.gather(
        d.set_acceleration_sensor_event_filter_period(10.0),
        d.set_acceleration_sensor_mode(AccelerationSensorMode.ANY_MOTION),
        d.set_acceleration_sensor_neutral_position(
            AccelerationSensorNeutralPosition.HORIZONTAL
        ),
        d.set_acceleration_sensor_sensitivity(
            AccelerationSensorSensitivity.SENSOR_RANGE_2G
        ),
        d.set_acceleration_sensor_trigger_angle(30),
        d.set_notification_sound_type(NotificationSoundType.SOUND_SHORT, True),
        d.set_notification_sound_type(NotificationSoundType.SOUND_SHORT_SHORT, False),
    )
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000031")

    assert d.accelerationSensorEventFilterPeriod == 10.0
    assert d.accelerationSensorMode == AccelerationSensorMode.ANY_MOTION
    assert (
        d.accelerationSensorNeutralPosition
        == AccelerationSensorNeutralPosition.HORIZONTAL
    )
    assert (
        d.accelerationSensorSensitivity == AccelerationSensorSensitivity.SENSOR_RANGE_2G
    )
    assert d.accelerationSensorTriggerAngle == 30
    assert d.notificationSoundTypeHighToLow == NotificationSoundType.SOUND_SHORT
    assert d.notificationSoundTypeLowToHigh == NotificationSoundType.SOUND_SHORT_SHORT
async def test_security_zones_activation(no_ssl_fake_async_home: AsyncHome):
    internal, external = no_ssl_fake_async_home.get_security_zones_activation()
    assert internal == False
    assert external == False

    await no_ssl_fake_async_home.set_security_zones_activation(True, True)
    await no_ssl_fake_async_home.get_current_state()

    internal, external = no_ssl_fake_async_home.get_security_zones_activation()
    assert internal == True
    assert external == True
async def test_switching_group(no_ssl_fake_async_home:AsyncHome):
        g = no_ssl_fake_async_home.search_group_by_id('00000000-0000-0000-0000-000000000018')
        assert isinstance(g, AsyncSwitchingGroup)
        for d in g.devices:
            assert d.id in ['3014F7110000000000000010', '3014F7110000000000000009', '3014F7110000000000000008']

        assert g.dimLevel == None
        assert g.dutyCycle == False
        assert g.homeId == "00000000-0000-0000-0000-000000000001"
        assert g.id == "00000000-0000-0000-0000-000000000018"
        assert g.label == "Strom"
        assert g.lastStatusUpdate == datetime(2018, 4, 23, 20, 49, 14, 56000) + timedelta(0,utc_offset)
        assert g.lowBat == None
        assert g.metaGroup.id == "00000000-0000-0000-0000-000000000017"
        assert g.on == True
        assert g.processing == None
        assert g.shutterLevel == None
        assert g.slatsLevel == None
        assert g.unreach == False

        assert str(g) == ('SWITCHING Strom: on(True) dimLevel(None) processing(None) shutterLevel(None) slatsLevel(None)'
                          ' dutyCycle(False) lowBat(None)')

        await g.turn_off()
        await g.set_label("NEW GROUP")
        await g.set_shutter_level(50)
        await no_ssl_fake_async_home.get_current_state()
        g = no_ssl_fake_async_home.search_group_by_id('00000000-0000-0000-0000-000000000018')
        assert g.on == False
        assert g.label == "NEW GROUP"
        assert g.shutterLevel == 50

        assert str(g) == ('SWITCHING NEW GROUP: on(False) dimLevel(None) processing(None) shutterLevel(50) slatsLevel(None)'
                          ' dutyCycle(False) lowBat(None)')
        await g.turn_on()
        await no_ssl_fake_async_home.get_current_state()
        g = no_ssl_fake_async_home.search_group_by_id('00000000-0000-0000-0000-000000000018')
        assert g.on == True

        await no_ssl_fake_async_home.delete_group(g)
        await no_ssl_fake_async_home.get_current_state()
        gNotFound = no_ssl_fake_async_home.search_group_by_id('00000000-0000-0000-0000-000000000018')
        assert gNotFound == None

        with pytest.raises(HmipWrongHttpStatusError):
            result = await g.delete()
        with pytest.raises(HmipWrongHttpStatusError):
            result = await g.set_label('LABEL')
        with pytest.raises(HmipWrongHttpStatusError):
            result = await g.turn_off()
        with pytest.raises(HmipWrongHttpStatusError):
            result = await g.set_shutter_level(50)
Пример #12
0
async def test_security_setZoneActivationDelay(no_ssl_fake_async_home: AsyncHome):
    securityAlarmHome = no_ssl_fake_async_home.get_functionalHome(SecurityAndAlarmHome)
    assert securityAlarmHome.zoneActivationDelay == 0.0

    await no_ssl_fake_async_home.set_zone_activation_delay(5.0)
    await no_ssl_fake_async_home.get_current_state()
    securityAlarmHome = no_ssl_fake_async_home.get_functionalHome(SecurityAndAlarmHome)
    assert securityAlarmHome.zoneActivationDelay == 5.0

    await no_ssl_fake_async_home.set_zone_activation_delay(0.0)
    await no_ssl_fake_async_home.get_current_state()
    securityAlarmHome = no_ssl_fake_async_home.get_functionalHome(SecurityAndAlarmHome)
    assert securityAlarmHome.zoneActivationDelay == 0.0
async def test_pluggable_switch_measuring(no_ssl_fake_async_home: AsyncHome):
    no_ssl_fake_async_home = no_ssl_fake_async_home
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000009")
    assert isinstance(d, AsyncPlugableSwitchMeasuring)
    assert d.label == "Brunnen"
    assert d.lastStatusUpdate == (
        datetime(2018, 4, 23, 20, 36, 26, 303000) + timedelta(0, utc_offset)
    )
    assert d.manufacturerCode == 1
    assert d.modelId == 262
    assert d.modelType == "HMIP-PSM"
    assert d.oem == "eQ-3"
    assert d.serializedGlobalTradeItemNumber == "3014F7110000000000000009"
    assert d.updateState == DeviceUpdateState.UP_TO_DATE
    assert d.on is False
    assert d.profileMode == "AUTOMATIC"
    assert d.userDesiredProfileMode == "AUTOMATIC"
    assert d.currentPowerConsumption == 0.0
    assert d.energyCounter == 0.4754
    assert d.lowBat is None
    assert d.routerModuleEnabled is True
    assert d.routerModuleSupported is True
    assert d.rssiDeviceValue == -60
    assert d.rssiPeerValue == -66
    assert d.unreach is False
    assert d.availableFirmwareVersion == "0.0.0"
    assert d.firmwareVersion == "2.6.2"
    a, b, c = [int(i) for i in d.firmwareVersion.split(".")]
    assert d.firmwareVersionInteger == (a << 16) | (b << 8) | c
    assert d.dutyCycle is False
    assert d.configPending is False

    assert str(d) == (
        "HMIP-PSM Brunnen lowBat(None) unreach(False) rssiDeviceValue(-60) rssiPeerValue(-66) configPending(False) dutyCycle(False) on(False) profileMode(AUTOMATIC)"
        " userDesiredProfileMode(AUTOMATIC) energyCounter(0.4754) currentPowerConsumption(0.0W)"
    )

    await d.turn_on()
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000009")
    assert d.on is True

    await d.turn_off()
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000009")
    assert d.on is False

    d.id = "INVALID_ID"
    with pytest.raises(HmipWrongHttpStatusError):
        result = await d.turn_off()
Пример #14
0
async def test_hot_water(no_ssl_fake_async_home: AsyncHome):
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000067")
    assert g.profileMode is None

    await g.set_profile_mode(ProfileMode.AUTOMATIC)
    await no_ssl_fake_async_home.get_current_state()
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000067")

    assert g.profileMode == ProfileMode.AUTOMATIC

    assert str(
        g
    ) == "HOT_WATER HOT_WATER on(None) onTime(900.0) profileMode(AUTOMATIC)"
Пример #15
0
async def test_security_setIntrusionAlertThroughSmokeDetectors(
    no_ssl_fake_async_home: AsyncHome,
):
    securityAlarmHome = no_ssl_fake_async_home.get_functionalHome(SecurityAndAlarmHome)
    assert securityAlarmHome.intrusionAlertThroughSmokeDetectors is False

    await no_ssl_fake_async_home.set_intrusion_alert_through_smoke_detectors(True)
    await no_ssl_fake_async_home.get_current_state()
    securityAlarmHome = no_ssl_fake_async_home.get_functionalHome(SecurityAndAlarmHome)
    assert securityAlarmHome.intrusionAlertThroughSmokeDetectors is True

    await no_ssl_fake_async_home.set_intrusion_alert_through_smoke_detectors(False)
    await no_ssl_fake_async_home.get_current_state()
    securityAlarmHome = no_ssl_fake_async_home.get_functionalHome(SecurityAndAlarmHome)
    assert securityAlarmHome.intrusionAlertThroughSmokeDetectors is False
async def no_ssl_fake_async_home(fake_cloud, event_loop):
    home = AsyncHome(event_loop)
    home._connection._websession.post = partial(
        home._connection._websession.post, ssl=False)

    lookup_url = "{}/getHost".format(fake_cloud.url)
    home._fake_cloud = fake_cloud
    home.set_auth_token(
        "8A45BAA53BE37E3FCA58E9976EFA4C497DAFE55DB997DB9FD685236E5E63ED7DE")
    await home._connection.init(accesspoint_id="3014F711A000000BAD0C0DED",
                                lookup_url=lookup_url)
    await home.get_current_state()

    yield home

    await home._connection._websession.close()
Пример #17
0
async def test_home_control_access_point(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F711A000000BAD0C0DED")

    assert str(d) == (
        "HmIP-HAP HOME_CONTROL_ACCESS_POINT lowBat(None) unreach(False) rssiDeviceValue(None) "
        "rssiPeerValue(None) configPending(False) dutyCycle(False) dutyCycleLevel(8.0) "
        "accessPointPriority(1) signalBrightness(1.0)")
Пример #18
0
async def test_hoermann_drives_module(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000HOERMANN")

    assert d.doorState == DoorState.CLOSED
    assert d.on is False
    assert d.processing is False
    assert d.ventilationPositionSupported is True
async def test_heating_vacation(no_ssl_fake_async_home: AsyncHome):
    tomorrow = datetime.now() + timedelta(days=1)
    tomorrow = tomorrow.replace(second=0, microsecond=0)

    await no_ssl_fake_async_home.activate_vacation(tomorrow, 12)

    await no_ssl_fake_async_home.get_current_state()
    heatingHome = no_ssl_fake_async_home.get_functionalHome(IndoorClimateHome)
    assert heatingHome.absenceEndTime == tomorrow
    assert heatingHome.absenceType == AbsenceType.VACATION

    await no_ssl_fake_async_home.deactivate_vacation()

    await no_ssl_fake_async_home.get_current_state()
    heatingHome = no_ssl_fake_async_home.get_functionalHome(IndoorClimateHome)
    assert heatingHome.absenceEndTime == None
    assert heatingHome.absenceType == AbsenceType.NOT_ABSENT
async def test_heating_thermostat(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000015")
    assert isinstance(d, AsyncHeatingThermostat)
    assert d.label == "Wohnzimmer-Heizung"
    assert d.lastStatusUpdate == datetime(2018, 4, 23, 20, 5, 50, 325000) + timedelta(
        0, utc_offset
    )
    assert d.manufacturerCode == 1
    assert d.modelId == 269
    assert d.modelType == "HMIP-eTRV"
    assert d.oem == "eQ-3"
    assert d.serializedGlobalTradeItemNumber == "3014F7110000000000000015"
    assert d.updateState == DeviceUpdateState.UP_TO_DATE
    assert d.setPointTemperature == 5.0
    assert d.temperatureOffset == 0.0
    assert d.valvePosition == 0.0
    assert d.valveState == ValveState.ADAPTION_DONE
    assert d.lowBat is False
    assert d.operationLockActive is True
    assert d.routerModuleEnabled is False
    assert d.routerModuleSupported is False
    assert d.rssiDeviceValue == -65
    assert d.rssiPeerValue == -66
    assert d.unreach is False
    assert d.automaticValveAdaptionNeeded is False
    assert d.availableFirmwareVersion == "2.0.2"
    assert d.firmwareVersion == "2.0.2"
    a, b, c = [int(i) for i in d.firmwareVersion.split(".")]
    assert d.firmwareVersionInteger == (a << 16) | (b << 8) | c

    assert str(d) == (
        "HMIP-eTRV Wohnzimmer-Heizung lowBat(False) unreach(False) "
        "rssiDeviceValue(-65) rssiPeerValue(-66) configPending(False) "
        "dutyCycle(False) operationLockActive(True) valvePosition(0.0) "
        "valveState(ADAPTION_DONE) temperatureOffset(0.0) "
        "setPointTemperature(5.0) valveActualTemperature(20.0)"
    )

    await d.set_operation_lock(False)
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000000015")
    assert d.operationLockActive is False

    d.id = "INVALID_ID"
    with pytest.raises(HmipWrongHttpStatusError):
        result = await d.set_operation_lock(True)
Пример #21
0
async def test_din_rail_switch_4(no_ssl_fake_async_home: AsyncHome):
    no_ssl_fake_async_home = no_ssl_fake_async_home
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000005521")
    assert isinstance(d, AsyncDinRailSwitch4)
    assert d.label == "Schaltaktor Verteiler"
    assert d.lastStatusUpdate == (datetime(2020, 11, 13, 11, 49, 43, 993000) +
                                  timedelta(0, utc_offset))
    assert d.manufacturerCode == 1
    assert d.modelId == 405
    assert d.modelType == "HmIP-DRSI4"
    assert d.oem == "eQ-3"
    assert d.serializedGlobalTradeItemNumber == "3014F7110000000000005521"
    assert d.updateState == DeviceUpdateState.UP_TO_DATE
    assert d.on is None
    assert d.profileMode is None
    assert d.userDesiredProfileMode is None
    assert d.lowBat is None
    assert d.routerModuleEnabled is False
    assert d.routerModuleSupported is False
    assert d.rssiDeviceValue == -82
    assert d.rssiPeerValue == -78
    assert d.unreach is False
    assert d.availableFirmwareVersion == "1.4.2"
    assert d.firmwareVersion == "1.4.2"
    a, b, c = [int(i) for i in d.firmwareVersion.split(".")]
    assert d.firmwareVersionInteger == (a << 16) | (b << 8) | c
    assert d.dutyCycle is False
    assert d.configPending is False

    assert str(d) == (
        "HmIP-DRSI4 Schaltaktor Verteiler lowBat(None) unreach(False) rssiDeviceValue(-82) rssiPeerValue(-78) "
        "configPending(False) dutyCycle(False) deviceOverheated(False) devicePowerFailureDetected(False) on(None) "
        "profileMode(None) userDesiredProfileMode(None)")

    for channel in range(1, 4):
        await d.turn_on(channel)
        await no_ssl_fake_async_home.get_current_state()
        d = no_ssl_fake_async_home.search_device_by_id(
            "3014F7110000000000005521")
        assert d.functionalChannels[channel].on is True

        await d.turn_off(channel)
        await no_ssl_fake_async_home.get_current_state()
        d = no_ssl_fake_async_home.search_device_by_id(
            "3014F7110000000000005521")
        assert d.functionalChannels[channel].on is False
Пример #22
0
async def test_din_rail_blind_4(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000022311")
    assert isinstance(d, AsyncDinRailBlind4)
    assert d.label == "Jalousieaktor 1 für Hutschienenmontage – 4-fach"
    assert d.lastStatusUpdate == (datetime(2020, 11, 3, 13, 35, 24, 509000) +
                                  timedelta(0, utc_offset))
    assert d.manufacturerCode == 1
    assert d.modelId == 406
    assert d.modelType == "HmIP-DRBLI4"
    assert d.oem == "eQ-3"
    assert d.serializedGlobalTradeItemNumber == "3014F7110000000000022311"
    assert d.updateState == DeviceUpdateState.UP_TO_DATE
    assert d.lowBat is None
    assert d.routerModuleEnabled is False
    assert d.routerModuleSupported is False
    assert d.rssiDeviceValue == -70
    assert d.rssiPeerValue == -63
    assert d.unreach is False
    assert d.availableFirmwareVersion == "1.6.0"
    assert d.firmwareVersion == "1.6.0"
    a, b, c = [int(i) for i in d.firmwareVersion.split(".")]
    assert d.firmwareVersionInteger == (a << 16) | (b << 8) | c
    assert d.dutyCycle is False
    assert d.configPending is False

    for channel in range(1, 4):
        await d.set_shutter_level(0.35, channelIndex=channel)
        await no_ssl_fake_async_home.get_current_state()
        d = no_ssl_fake_async_home.search_device_by_id(
            "3014F7110000000000022311")
        assert d.functionalChannels[channel].shutterLevel == 0.35

        await d.set_slats_level(0.8, channelIndex=channel)
        await no_ssl_fake_async_home.get_current_state()
        d = no_ssl_fake_async_home.search_device_by_id(
            "3014F7110000000000022311")
        assert d.functionalChannels[channel].shutterLevel == 0.35
        assert d.functionalChannels[channel].slatsLevel == 0.8

        await d.set_slats_level(0.8, 0.3, channelIndex=channel)
        await no_ssl_fake_async_home.get_current_state()
        d = no_ssl_fake_async_home.search_device_by_id(
            "3014F7110000000000022311")
        assert d.functionalChannels[channel].shutterLevel == 0.3
        assert d.functionalChannels[channel].slatsLevel == 0.8
Пример #23
0
async def test_shutter_profile(no_ssl_fake_async_home: AsyncHome):
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000093")
    assert isinstance(g, AsyncShutterProfile)

    assert g.dutyCycle is False
    assert g.homeId == "00000000-0000-0000-0000-000000000001"
    assert g.label == "Rollladen Schiebet\u00fcr"
    assert g.lowBat is None
    assert g.metaGroup is None
    assert g.processing is False
    assert g.shutterLevel == 0.97
    assert g.slatsLevel is None
    assert g.unreach is False
    assert g.primaryShadingLevel == 0.97
    assert g.primaryShadingStateType == ShadingStateType.POSITION_USED
    assert g.secondaryShadingLevel is None
    assert g.secondaryShadingStateType == ShadingStateType.NOT_EXISTENT
    assert g.profileMode == ProfileMode.AUTOMATIC

    assert str(g) == (
        "SHUTTER_PROFILE Rollladen Schiebetür processing(False)"
        " shutterLevel(0.97) slatsLevel(None) profileMode(AUTOMATIC)")

    await g.set_shutter_level(50)
    await g.set_profile_mode(ProfileMode.MANUAL)
    await g.set_shutter_stop()
    await no_ssl_fake_async_home.get_current_state()
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000093")
    assert g.shutterLevel == 50
    assert g.profileMode == ProfileMode.MANUAL

    assert str(g) == ("SHUTTER_PROFILE Rollladen Schiebetür processing(False)"
                      " shutterLevel(50) slatsLevel(None) profileMode(MANUAL)")

    await g.set_slats_level(1.0, 20)

    await no_ssl_fake_async_home.get_current_state()
    g = no_ssl_fake_async_home.search_group_by_id(
        "00000000-0000-0000-0000-000000000093")
    assert g.slatsLevel == 1.0
    assert g.shutterLevel == 20
Пример #24
0
async def test_rain_sensor(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000RAIN_SENSOR")

    assert d.raining == True
    assert d.rainSensorSensitivity == 50.0

    assert str(d) == (
        "HmIP-SRD Regensensor lowBat(None) unreach(False) rssiDeviceValue(-91) "
        "rssiPeerValue(None) configPending(False) dutyCycle(False) "
        "rainSensorSensitivity(50.0) raining(True)")
Пример #25
0
async def test_pluggable_mains_failure(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F7110000000000ABCD50")

    assert d.powerMainsFailure is False
    assert d.genericAlarmSignal is AlarmSignalType.FULL_ALARM

    assert str(d) == (
        "HmIP-PMFS Netzausfallüberwachung lowBat(None) unreach(False) rssiDeviceValue(-58) "
        "rssiPeerValue(None) configPending(False) dutyCycle(False) powerMainsFailure(False) "
        "genericAlarmSignal(FULL_ALARM)")
Пример #26
0
async def test_full_flush_blind(no_ssl_fake_async_home: AsyncHome):
    d = AsyncFullFlushBlind(no_ssl_fake_async_home._connection)
    d = no_ssl_fake_async_home.search_device_by_id("3014F711BADCAFE000000001")

    assert d.shutterLevel == 1.0
    assert d.slatsLevel == 1.0
    assert d.blindModeActive is True
    assert d.slatsReferenceTime == 2.0

    await d.set_slats_level(0.4)
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F711BADCAFE000000001")
    assert d.shutterLevel == 1.0
    assert d.slatsLevel == 0.4

    await d.set_slats_level(0.8, 0.3)
    await no_ssl_fake_async_home.get_current_state()
    d = no_ssl_fake_async_home.search_device_by_id("3014F711BADCAFE000000001")
    assert d.shutterLevel == 0.3
    assert d.slatsLevel == 0.8
Пример #27
0
async def test_wall_thermostat_basic(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F711000000000000AAA5")

    assert d.display == ClimateControlDisplay.ACTUAL
    assert d.humidity == 42

    assert str(d) == (
        "HmIP-WTH-B Thermostat Schlafen Tal lowBat(False) unreach(False) rssiDeviceValue(-58) "
        "rssiPeerValue(-59) configPending(False) dutyCycle(False) operationLockActive(False) "
        "actualTemperature(16.0) humidity(42) vaporAmount(5.710127947243264) "
        "setPointTemperature(12.0)")
Пример #28
0
async def test_door_sensor_tm(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F0000000000000FAF9B4")

    assert d.doorState == DoorState.CLOSED
    assert d.on == False
    assert d.processing == False
    assert d.ventilationPositionSupported == True

    await no_ssl_fake_async_home.get_current_state()
    await d.send_door_command(DoorCommand.OPEN)
    await no_ssl_fake_async_home.get_current_state()
    assert d.doorState == DoorState.OPEN
Пример #29
0
async def test_room_control_device_analog(no_ssl_fake_async_home: AsyncHome):
    d = no_ssl_fake_async_home.search_device_by_id("3014F711000000BBBB000005")
    assert isinstance(d, AsyncRoomControlDeviceAnalog)

    assert d.temperatureOffset == 0.0
    assert d.setPointTemperature == 23.0
    assert d.actualTemperature == 23.3

    assert str(d) == (
        "ALPHA-IP-RBGa Raumbediengerät Analog lowBat(False) unreach(False) rssiDeviceValue(-41) "
        "rssiPeerValue(-29) configPending(False) dutyCycle(False) actualTemperature(23.3) "
        "setPointTemperature(23.0) temperatureOffset(0.0)")
Пример #30
0
async def test_basic_device_functions(fake_async_home: AsyncHome):
    with no_ssl_verification():
        d = fake_async_home.search_device_by_id('3014F7110000000000000009')
        assert d.label == "Brunnen"
        assert d.routerModuleEnabled == True

        await d.set_label("new label")
        await d.set_router_module_enabled(False)
        await fake_async_home.get_current_state()
        d = fake_async_home.search_device_by_id('3014F7110000000000000009')
        assert d.label == "new label"
        assert d.routerModuleEnabled == False

        await d.set_label("other label")
        await d.set_router_module_enabled(True)
        await fake_async_home.get_current_state()
        d = fake_async_home.search_device_by_id('3014F7110000000000000009')
        assert d.label == "other label"
        assert d.routerModuleEnabled == True

        d2 = fake_async_home.search_device_by_id('3014F7110000000000000005')
        await d.delete()
        await fake_async_home.get_current_state()
        d = fake_async_home.search_device_by_id('3014F7110000000000000009')
        assert d == None
        assert d2 is fake_async_home.search_device_by_id(
            '3014F7110000000000000005'
        )  # make sure that the objects got updated and not completely renewed
Пример #31
0
    async def get_hap(self, hass: HomeAssistant, hapid: str, authtoken: str,
                      name: str) -> AsyncHome:
        """Create a HomematicIP access point object."""
        home = AsyncHome(hass.loop, async_get_clientsession(hass))

        home.name = name
        home.label = 'Access Point'
        home.modelType = 'HmIP-HAP'

        home.set_auth_token(authtoken)
        try:
            await home.init(hapid)
            await home.get_current_state()
        except HmipConnectionError:
            raise HmipcConnectionError
        home.on_update(self.async_update)
        hass.loop.create_task(self.async_connect())

        return home
Пример #32
0
    async def get_hap(self, hass, hapid, authtoken, name):
        """Create a HomematicIP access point object."""
        from homematicip.aio.home import AsyncHome
        from homematicip.base.base_connection import HmipConnectionError

        home = AsyncHome(hass.loop, async_get_clientsession(hass))

        home.name = name
        home.label = 'Access Point'
        home.modelType = 'HmIP-HAP'

        home.set_auth_token(authtoken)
        try:
            await home.init(hapid)
            await home.get_current_state()
        except HmipConnectionError:
            raise HmipcConnectionError
        home.on_update(self.async_update)
        hass.loop.create_task(self.async_connect())

        return home