async def test_async_auth_challenge_no_pin(event_loop,fake_async_home:AsyncHome): with no_ssl_verification(): auth = AsyncAuth(event_loop) sgtin = "3014F711A000000BAD0C0DED" devicename = "auth_test" await auth.init(sgtin, lookup_url=fake_async_home._connection._lookup_url) result = await auth.connectionRequest(devicename) #TODO: Investigate why result is always None #assert result.status_code == 200 #assert (await auth.isRequestAcknowledged()) == False #assert (await auth.isRequestAcknowledged()) == False #fake_async_home._connection.api_call("auth/simulateBlueButton") #assert await auth.isRequestAcknowledged() == True #token = auth.requestAuthToken() #assert await token == hashlib.sha512(auth.uuid.encode('utf-8')).hexdigest().upper() #resultId = auth.confirmAuthToken(token) #assert await resultId == auth.uuid
def test_heating_dehumidifier_group(fake_home: Home): with no_ssl_verification(): g = fake_home.search_group_by_id( "00000000-0000-0000-0000-000000000055") assert isinstance(g, HeatingDehumidifierGroup) assert g.on == None assert str(g) == "HEATING_DEHUMIDIFIER HEATING_DEHUMIDIFIER on(None)"
def test_full_flush_shutter(fake_home: Home): with no_ssl_verification(): d = FullFlushShutter(fake_home._connection) d = fake_home.search_device_by_id("3014F711ACBCDABCADCA66") assert d.bottomToTopReferenceTime == 30.080000000000002 assert d.changeOverDelay == 0.5 assert d.delayCompensationValue == 12.7 assert d.endpositionAutoDetectionEnabled == True assert d.previousShutterLevel == None assert d.processing == False assert d.profileMode == "AUTOMATIC" assert d.selfCalibrationInProgress == None assert d.shutterLevel == 1.0 assert d.supportingDelayCompensation == True assert d.supportingEndpositionAutoDetection == True assert d.supportingSelfCalibration == True assert d.topToBottomReferenceTime == 24.68 assert d.userDesiredProfileMode == "AUTOMATIC" assert str(d) == ( "HmIP-BROLL *** lowbat(None) unreach(False) rssiDeviceValue(-78) rssiPeerValue(-77) configPending(False)" " dutyCycle(False) shutterLevel(1.0) topToBottom(24.68) bottomToTop(30.080000000000002)" ) d.set_shutter_level(0.4) d.set_shutter_stop() # this will not do anything in the test run fake_home.get_current_state() d = fake_home.search_device_by_id("3014F711ACBCDABCADCA66") assert d.shutterLevel == 0.4
def test_invlid_authorization(fake_cloud): with no_ssl_verification(): response = requests.post("{}/hmip/home/getCurrentState".format( fake_cloud.url)) js = json.loads(response.text) assert js["errorCode"] == "INVALID_AUTHORIZATION" assert response.status_code == 403
def test_rules(fake_home: Home): with no_ssl_verification(): rule = fake_home.search_rule_by_id( '00000000-0000-0000-0000-000000000065') assert rule.active == True assert rule.label == 'Alarmanlage' assert isinstance(rule, SimpleRule) assert rule.ruleErrorCategories == [] assert rule.errorRuleTriggerItems == [] assert rule.errorRuleConditionItems == [] assert rule.errorRuleActionItems == [] assert str(rule) == "SIMPLE Alarmanlage active(True)" #disable test rule.disable() rule.set_label("DISABLED_RULE") fake_home.get_current_state() rule = fake_home.search_rule_by_id( '00000000-0000-0000-0000-000000000065') assert rule.active == False assert rule.label == "DISABLED_RULE" #endable test rule.enable() rule.set_label("ENABLED_RULE") fake_home.get_current_state() rule = fake_home.search_rule_by_id( '00000000-0000-0000-0000-000000000065') assert rule.active == True assert rule.label == "ENABLED_RULE"
def test_floor_terminal_block(fake_home: Home): with no_ssl_verification(): d = FloorTerminalBlock6(fake_home._connection) d = fake_home.search_device_by_id("3014F7110000000000BBBBB1") assert d.frostProtectionTemperature == 8.0 assert d.coolingEmergencyValue == 0.0 assert d.globalPumpControl == 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)" )
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
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
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
def test_auth_challenge_no_pin(fake_home: Home): with no_ssl_verification(): auth = Auth(fake_home) sgtin = "3014F711A000000BAD0C0DED" devicename = "auth_test" assert auth.connectionRequest(sgtin, devicename).status_code == 200 assert auth.isRequestAcknowledged() == False assert auth.isRequestAcknowledged() == False fake_home._connection._restCall("auth/simulateBlueButton") assert auth.isRequestAcknowledged() == True token = auth.requestAuthToken() assert token == hashlib.sha512( auth.uuid.encode('utf-8')).hexdigest().upper() resultId = auth.confirmAuthToken(token) assert resultId == auth.uuid fake_home.get_current_state() client = fake_home.search_client_by_id(resultId) assert client != None assert client.label == devicename
def test_full_flush_blind(fake_home: Home): with no_ssl_verification(): d = FullFlushBlind(fake_home._connection) d = fake_home.search_device_by_id("3014F711BADCAFE000000001") assert d.shutterLevel == 1.0 assert d.slatsLevel == 1.0 assert d.blindModeActive == True assert d.slatsReferenceTime == 2.0 d.set_slats_level(0.4) fake_home.get_current_state() d = fake_home.search_device_by_id("3014F711BADCAFE000000001") assert d.shutterLevel == 1.0 assert d.slatsLevel == 0.4 d.set_slats_level(0.8, 0.3) fake_home.get_current_state() d = fake_home.search_device_by_id("3014F711BADCAFE000000001") assert d.shutterLevel == 0.3 assert d.slatsLevel == 0.8 assert str(d) == ( "HmIP-FBL Sofa links lowbat(None) unreach(False) rssiDeviceValue(-73) " "rssiPeerValue(-78) configPending(False) dutyCycle(False) " "shutterLevel(0.3) topToBottom(41.0) bottomToTop(41.0) " "slatsLevel(0.8) blindModeActive(True)" )
def test_wall_mounted_thermostat_pro(fake_home : Home ): d = fake_home.search_device_by_id('3014F7110000000000000022') assert isinstance(d, WallMountedThermostatPro) 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" assert str(d) == ('HmIP-WTH-2 Wandthermostat lowbat(False) unreach(False) rssiDeviceValue(-76) rssiPeerValue(-63) configPending(False) dutyCycle(False): operationLockActive(False):' ' actualTemperature(24.7) humidity(43) setPointTemperature(5.0)') assert d._rawJSONData == fake_home_download_configuration()["devices"]["3014F7110000000000000022"] with no_ssl_verification(): d.set_display( ClimateControlDisplay.ACTUAL) fake_home.get_current_state() d = fake_home.search_device_by_id('3014F7110000000000000022') assert d.display == ClimateControlDisplay.ACTUAL
def test_basic_device_functions(fake_home:Home): with no_ssl_verification(): d = fake_home.search_device_by_id('3014F7110000000000000009') assert d.label == "Brunnen" assert d.routerModuleEnabled == True d.set_label("new label") d.set_router_module_enabled(False) fake_home.get_current_state() d = fake_home.search_device_by_id('3014F7110000000000000009') assert d.label == "new label" assert d.routerModuleEnabled == False d.set_label("other label") d.set_router_module_enabled(True) fake_home.get_current_state() d = fake_home.search_device_by_id('3014F7110000000000000009') assert d.label == "other label" assert d.routerModuleEnabled == True d2 = fake_home.search_device_by_id('3014F7110000000000000005') d.delete() fake_home.get_current_state() dNotFound = fake_home.search_device_by_id('3014F7110000000000000009') assert dNotFound == None assert d2 is fake_home.search_device_by_id('3014F7110000000000000005') # make sure that the objects got updated and not completely renewed #check if the server is answering properly result = d.set_label("BLa") assert result["errorCode"] == "INVALID_DEVICE" result = d.delete() assert result["errorCode"] == "INVALID_DEVICE"
def test_home_getOAuthOTK(fake_home: Home): with no_ssl_verification(): token = fake_home.get_OAuth_OTK() assert token.authToken == "C001ED" assert token.expirationTimestamp == datetime( 2018, 12, 23, 11, 38, 21, 680000 ) + timedelta(0, utc_offset)
def test_set_powermeter_unit_price(fake_home: Home): with no_ssl_verification(): fake_home.set_powermeter_unit_price(12.0) fake_home.get_current_state() assert fake_home.powerMeterUnitPrice == 12.0 fake_home.set_powermeter_unit_price(8.5) fake_home.get_current_state() assert fake_home.powerMeterUnitPrice == 8.5
def test_alarm_siren_indoor(fake_home: Home): with no_ssl_verification(): d = AlarmSirenIndoor(fake_home._connection) d = fake_home.search_device_by_id("3014F7110000000000BBBBB8") assert str( d ) == "HmIP-ASIR Alarmsirene lowbat(False) unreach(False) rssiDeviceValue(-59) rssiPeerValue(None) configPending(False) dutyCycle(False) sabotage(False)"
def test_switching_group(fake_home : Home): with no_ssl_verification(): g = fake_home.search_group_by_id('00000000-0000-0000-0000-000000000018') assert isinstance(g, SwitchingGroup) 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)') g.turn_off() g.set_label("NEW GROUP") g.set_shutter_level(50) fake_home.get_current_state() g = fake_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)') g.turn_on() fake_home.get_current_state() g = fake_home.search_group_by_id('00000000-0000-0000-0000-000000000018') assert g.on == True fake_home.delete_group(g) fake_home.get_current_state() gNotFound = fake_home.search_group_by_id('00000000-0000-0000-0000-000000000018') assert gNotFound == None result = g.delete() assert result["errorCode"] == 'INVALID_GROUP' result = g.set_label('LABEL') assert result["errorCode"] == 'INVALID_GROUP' result = g.turn_off() assert result["errorCode"] == 'INVALID_GROUP' result = g.set_shutter_level(50) assert result["errorCode"] == 'INVALID_GROUP'
def test_heating_failure_alert_group(fake_home: Home): with no_ssl_verification(): g = fake_home.search_group_by_id( "00000000-BBBB-0000-0000-000000000052") assert str(g) == ( "HEATING_FAILURE_ALERT_RULE_GROUP HEATING_FAILURE_ALERT_RULE_GROUP" " enabled(True) heatingFailureValidationResult(NO_HEATING_FAILURE)" " checkInterval(600) validationTimeout(86400000)" " lastExecutionTimestamp(2019-02-21 19:30:00.084000)")
def test_set_timezone(fake_home: Home): with no_ssl_verification(): assert fake_home.timeZoneId == "Europe/Vienna" fake_home.set_timezone("Europe/Berlin") fake_home.get_current_state() assert fake_home.timeZoneId == "Europe/Berlin" fake_home.set_timezone("Europe/Vienna") fake_home.get_current_state() assert fake_home.timeZoneId == "Europe/Vienna"
def test_home_set_location(fake_home: Home): with no_ssl_verification(): fake_home.set_location("Berlin, Germany", "52.530644", "13.383068") fake_home.get_current_state() assert fake_home.location.city == "Berlin, Germany" assert fake_home.location.latitude == "52.530644" assert fake_home.location.longitude == "13.383068" assert str( fake_home.location ) == "city(Berlin, Germany) latitude(52.530644) longitude(13.383068)"
async def test_async_home_base(fake_async_home: AsyncHome): with no_ssl_verification(): assert fake_async_home.connected == True assert fake_async_home.currentAPVersion == "1.2.4" assert fake_async_home.deviceUpdateStrategy == "AUTOMATICALLY_IF_POSSIBLE" assert fake_async_home.dutyCycle == 8.0 assert fake_async_home.pinAssigned == False assert fake_async_home.powerMeterCurrency == "EUR" assert fake_async_home.powerMeterUnitPrice == 0.0 assert fake_async_home.timeZoneId == "Europe/Vienna" assert fake_async_home.updateState == "UP_TO_DATE"
def test_water_sensor(fake_home: Home): with no_ssl_verification(): d = WaterSensor(fake_home._connection) # just needed for intellisense d = fake_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 d.set_acoustic_alarm_timing(AcousticAlarmTiming.SIX_MINUTES) d.set_acoustic_alarm_signal( AcousticAlarmSignal.FREQUENCY_ALTERNATING_LOW_HIGH) d.set_inapp_water_alarm_trigger(WaterAlarmTrigger.MOISTURE_DETECTION) d.set_acoustic_water_alarm_trigger(WaterAlarmTrigger.NO_ALARM) d.set_siren_water_alarm_trigger(WaterAlarmTrigger.NO_ALARM) assert str(d) == ( "HmIP-SWD Wassersensor lowbat(False) unreach(False) rssiDeviceValue(-65) rssiPeerValue(None) configPending(False) " "dutyCycle(False) incorrectPositioned(True) acousticAlarmSignal(FREQUENCY_RISING) acousticAlarmTiming(ONCE_PER_MINUTE) " "acousticWaterAlarmTrigger(WATER_DETECTION) inAppWaterAlarmTrigger(WATER_MOISTURE_DETECTION) moistureDetected(False) " "sirenWaterAlarmTrigger(WATER_MOISTURE_DETECTION) waterlevelDetected(False)" ) fake_home.get_current_state() d = fake_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 d.id = "INVALID_ID" result = d.set_acoustic_alarm_timing(AcousticAlarmTiming.SIX_MINUTES) assert result["errorCode"] == "INVALID_DEVICE" result = d.set_acoustic_alarm_signal( AcousticAlarmSignal.FREQUENCY_ALTERNATING_LOW_HIGH) assert result["errorCode"] == "INVALID_DEVICE" result = d.set_inapp_water_alarm_trigger( WaterAlarmTrigger.MOISTURE_DETECTION) assert result["errorCode"] == "INVALID_DEVICE" result = d.set_acoustic_water_alarm_trigger(WaterAlarmTrigger.NO_ALARM) assert result["errorCode"] == "INVALID_DEVICE" result = d.set_siren_water_alarm_trigger(WaterAlarmTrigger.NO_ALARM) assert result["errorCode"] == "INVALID_DEVICE"
def test_pluggable_switch_measuring(fake_home: Home): d = fake_home.search_device_by_id("3014F7110000000000000009") assert isinstance(d, PlugableSwitchMeasuring) 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 == False assert d.profileMode == "AUTOMATIC" assert d.userDesiredProfileMode == "AUTOMATIC" assert d.currentPowerConsumption == 0.0 assert d.energyCounter == 0.4754 assert d.lowBat == None assert d.routerModuleEnabled == True assert d.routerModuleSupported == True assert d.rssiDeviceValue == -60 assert d.rssiPeerValue == -66 assert d.unreach == 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 == False assert d.configPending == 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)" ) assert ( d._rawJSONData == fake_home_download_configuration()["devices"]["3014F7110000000000000009"] ) with no_ssl_verification(): d.turn_on() fake_home.get_current_state() d = fake_home.search_device_by_id("3014F7110000000000000009") assert d.on == True d.turn_off() fake_home.get_current_state() d = fake_home.search_device_by_id("3014F7110000000000000009") assert d.on == False d.id = "INVALID_ID" result = d.turn_off() assert result["errorCode"] == "INVALID_DEVICE"
def test_environment_group(fake_home : Home): with no_ssl_verification(): g = fake_home.search_group_by_id('00000000-AAAA-0000-0000-000000000001') assert isinstance(g, EnvironmentGroup) assert g.actualTemperature == 15.4 assert g.illumination == 4703.0 assert g.raining == False assert g.humidity == 65 assert g.windSpeed == 29.1 assert str(g) == "ENVIRONMENT Terrasse: actualTemperature(15.4) illumination(4703.0) raining(False) windSpeed(29.1) humidity(65)"
def test_home_getSecurityJournal(fake_home: Home): with no_ssl_verification(): journal = fake_home.get_security_journal() #todo make more advanced tests assert isinstance(journal[0], ActivationChangedEvent) assert isinstance(journal[1], ActivationChangedEvent) assert isinstance(journal[2], AccessPointDisconnectedEvent) assert isinstance(journal[3], AccessPointConnectedEvent) assert isinstance(journal[4], SensorEvent) assert isinstance(journal[5], SabotageEvent) assert isinstance(journal[6], MoistureDetectionEvent) assert isinstance(journal[7], SecurityEvent)
def test_security_zones_activation(fake_home: Home): with no_ssl_verification(): internal, external = fake_home.get_security_zones_activation() assert internal == False assert external == False fake_home.set_security_zones_activation(True, True) fake_home.get_current_state() internal, external = fake_home.get_security_zones_activation() assert internal == True assert external == True
def test_heating_cooling_demand_pump_group(fake_home : Home): with no_ssl_verification(): g = fake_home.search_group_by_id('00000000-0000-0000-0000-000000000057') assert isinstance(g, HeatingCoolingDemandPumpGroup) assert g.on == None assert g.heatDemandRuleEnabled == False assert g.pumpFollowUpTime == 2 assert g.pumpLeadTime == 2 assert g.pumpProtectionDuration == 1 assert g.pumpProtectionSwitchingInterval == 14 assert str(g) == ("HEATING_COOLING_DEMAND_PUMP HEATING_COOLING_DEMAND_PUMP: on(None) pumpProtectionDuration(1)" " pumpProtectionSwitchingInterval(14) pumpFollowUpTime(2) pumpLeadTime(2)" " heatDemandRuleEnabled(False)")
def test_security_setIntrusionAlertThroughSmokeDetectors(fake_home: Home): with no_ssl_verification(): securityAlarmHome = fake_home.get_functionalHome(SecurityAndAlarmHome) assert securityAlarmHome.intrusionAlertThroughSmokeDetectors == False fake_home.set_intrusion_alert_through_smoke_detectors(True) fake_home.get_current_state() securityAlarmHome = fake_home.get_functionalHome(SecurityAndAlarmHome) assert securityAlarmHome.intrusionAlertThroughSmokeDetectors == True fake_home.set_intrusion_alert_through_smoke_detectors(False) fake_home.get_current_state() securityAlarmHome = fake_home.get_functionalHome(SecurityAndAlarmHome) assert securityAlarmHome.intrusionAlertThroughSmokeDetectors == False
def test_security_setZoneActivationDelay(fake_home: Home): with no_ssl_verification(): securityAlarmHome = fake_home.get_functionalHome(SecurityAndAlarmHome) assert securityAlarmHome.zoneActivationDelay == 0.0 fake_home.set_zone_activation_delay(5.0) fake_home.get_current_state() securityAlarmHome = fake_home.get_functionalHome(SecurityAndAlarmHome) assert securityAlarmHome.zoneActivationDelay == 5.0 fake_home.set_zone_activation_delay(0.0) fake_home.get_current_state() securityAlarmHome = fake_home.get_functionalHome(SecurityAndAlarmHome) assert securityAlarmHome.zoneActivationDelay == 0.0
def test_wall_mounted_thermostat_pro(fake_home: Home): d = fake_home.search_device_by_id("3014F7110000000000000022") assert isinstance(d, WallMountedThermostatPro) 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 == DeviceUpdateState.UP_TO_DATE assert d.humidity == 43 assert d.vaporAmount == 6.177718198711658 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" a, b, c = [int(i) for i in d.firmwareVersion.split(".")] assert d.firmwareVersionInteger == (a << 16) | (b << 8) | c assert str(d) == ( "HmIP-WTH-2 Wandthermostat lowbat(False) unreach(False) rssiDeviceValue(-76) rssiPeerValue(-63)" " configPending(False) dutyCycle(False) operationLockActive(False)" " actualTemperature(24.7) humidity(43) vaporAmount(6.177718198711658) setPointTemperature(5.0)" ) assert ( d._rawJSONData == fake_home_download_configuration()["devices"]["3014F7110000000000000022"] ) with no_ssl_verification(): d.set_display(ClimateControlDisplay.ACTUAL) fake_home.get_current_state() d = fake_home.search_device_by_id("3014F7110000000000000022") assert d.display == ClimateControlDisplay.ACTUAL d.id = "INVALID_ID" result = d.set_display(ClimateControlDisplay.ACTUAL) assert result["errorCode"] == "INVALID_DEVICE"