Source code for homematicip.aio.device

import logging

from homematicip.base.enums import *
from homematicip.device import *

ERROR_CODE = "errorCode"

_LOGGER = logging.getLogger(__name__)


[docs]class AsyncDevice(Device): """ Async implementation of a genereric homematic ip device """
[docs] async def set_label(self, label): return await self._connection.api_call(*super().set_label(label))
[docs] async def authorizeUpdate(self): return await self._connection.api_call(*super().authorizeUpdate())
[docs] async def delete(self): return await self._connection.api_call(*super().delete())
[docs] async def set_router_module_enabled(self, enabled=True): return await self._connection.api_call( *super().set_router_module_enabled(enabled) )
[docs] async def is_update_applicable(self): return await self._connection.api_call(*super().is_update_applicable())
[docs]class AsyncSwitch(Switch, AsyncDevice): """ Generic async switch """
[docs] async def set_switch_state(self, on=True, channelIndex=1): _LOGGER.debug("Async switch set_switch_state") url, data = super().set_switch_state(on, channelIndex) return await self._connection.api_call(url, data)
[docs] async def turn_on(self, channelIndex=1): _LOGGER.debug("Async switch turn_on") return await self.set_switch_state(True, channelIndex)
[docs] async def turn_off(self, channelIndex=1): _LOGGER.debug("Async switch turn_off") return await self.set_switch_state(False, channelIndex)
[docs]class AsyncSwitchMeasuring(SwitchMeasuring, AsyncSwitch): """ Generic async switch measuring"""
[docs] async def reset_energy_counter(self): return await self._connection.api_call(*super().reset_energy_counter())
[docs]class AsyncHeatingSwitch2(HeatingSwitch2, AsyncSwitch): """ HMIP-WHS2 (Switch Actuator for heating systems – 2x channels) """
[docs]class AsyncPlugableSwitch(PlugableSwitch, AsyncSwitch): """ Async implementation of HMIP-PS (Pluggable Switch) """
[docs]class AsyncPrintedCircuitBoardSwitchBattery( PrintedCircuitBoardSwitchBattery, AsyncSwitch ): """ HMIP-PCBS-BAT (Printed Circuit Board Switch Battery) """
[docs]class AsyncPrintedCircuitBoardSwitch2(PrintedCircuitBoardSwitch2, AsyncSwitch): """ Async implementation of HMIP-PCBS2 (Switch Circuit Board - 2x channels) """
[docs]class AsyncLightSensor(LightSensor, AsyncDevice): """ Async implementation of HMIP-SLO (Light Sensor outdoor) """
[docs]class AsyncSabotageDevice(SabotageDevice, AsyncDevice): """ Async implementation sabotage signaling devices """
[docs]class AsyncOpenCollector8Module(OpenCollector8Module, AsyncSwitch): """ Async implementation of HMIP-MOD-OC8 ( Open Collector Module ) """
[docs]class AsyncOperationLockableDevice(OperationLockableDevice, AsyncDevice):
[docs] async def set_operation_lock(self, operationLock=True): return await self._connection.api_call( *super().set_operation_lock(operationLock=operationLock) )
[docs]class AsyncBrandSwitchNotificationLight(BrandSwitchNotificationLight, AsyncSwitch): """ HMIP-BSL (Switch Actuator for brand switches – with signal lamp) """
[docs] async def set_rgb_dim_level( self, channelIndex: int, rgb: RGBColorState, dimLevel: float ): return await self._connection.api_call( *super().set_rgb_dim_level(channelIndex, rgb, dimLevel) )
[docs] async def set_rgb_dim_level_with_time( self, channelIndex: int, rgb: RGBColorState, dimLevel: float, onTime: float, rampTime: float, ): return await self._connection.api_call( *super().set_rgb_dim_level_with_time( channelIndex, rgb, dimLevel, onTime, rampTime ) )
[docs]class AsyncPlugableSwitchMeasuring(PlugableSwitchMeasuring, AsyncSwitchMeasuring): """ HMIP-PSM (Pluggable Switch and Meter) """
[docs]class AsyncBrandSwitchMeasuring(BrandSwitchMeasuring, AsyncSwitchMeasuring): """ HMIP-BSM (Brand Switch and Meter) """
[docs]class AsyncFullFlushSwitchMeasuring(FullFlushSwitchMeasuring, AsyncSwitchMeasuring): """ HMIP-FSM (Full flush Switch and Meter) """
[docs]class AsyncShutterContact(ShutterContact, AsyncSabotageDevice): """ HMIP-SWDO (Door / Window Contact - optical) / HMIP-SWDO-I (Door / Window Contact Invisible - optical) """
[docs]class AsyncShutterContactOpticalPlus(ShutterContactOpticalPlus, AsyncShutterContact): """ HmIP-SWDO-PL ( Window / Door Contact – optical, plus )"""
[docs]class AsyncShutterContactMagnetic(ShutterContactMagnetic, AsyncDevice): """ HMIP-SWDM / HMIP-SWDM-B2 (Door / Window Contact - magnetic """
[docs]class AsyncContactInterface(ContactInterface, AsyncSabotageDevice): """ HMIP-SCI (Contact Interface Sensor) """
[docs]class AsyncRotaryHandleSensor(RotaryHandleSensor, AsyncSabotageDevice): """ HMIP-SRH """
[docs]class AsyncTemperatureHumiditySensorOutdoor( TemperatureHumiditySensorOutdoor, AsyncDevice ): """ HMIP-STHO (Temperature and Humidity Sensor outdoor) """
[docs]class AsyncHeatingThermostat(HeatingThermostat, AsyncOperationLockableDevice): """ HMIP-eTRV (Radiator Thermostat) """
[docs]class AsyncHeatingThermostatCompact(HeatingThermostatCompact, AsyncSabotageDevice): """ HMIP-eTRV-C (Heating-thermostat compact without display) """
[docs]class AsyncHeatingThermostatEvo(HeatingThermostatEvo, AsyncSabotageDevice): """ HMIP-eTRV-E (Heating-thermostat new evo version) """
[docs]class AsyncTemperatureHumiditySensorWithoutDisplay( TemperatureHumiditySensorWithoutDisplay, AsyncDevice ): """ HMIP-STH (Temperature and Humidity Sensor without display - indoor) """
[docs]class AsyncTemperatureHumiditySensorDisplay( TemperatureHumiditySensorDisplay, AsyncDevice ): """ HMIP-STHD (Temperature and Humidity Sensor with display - indoor) """
[docs] async def set_display( self, display: ClimateControlDisplay = ClimateControlDisplay.ACTUAL ): await self._connection.api_call(*super().set_display(display=display))
[docs]class AsyncWallMountedThermostatPro( WallMountedThermostatPro, AsyncTemperatureHumiditySensorDisplay, AsyncOperationLockableDevice, ): """ HMIP-WTH, HMIP-WTH-2 (Wall Thermostat with Humidity Sensor) / HMIP-BWTH (Brand Wall Thermostat with Humidity Sensor)"""
[docs]class AsyncWallMountedThermostatBasicHumidity(AsyncWallMountedThermostatPro): """ HMIP-WTH-B (Wall Thermostat – basic)"""
[docs]class AsyncSmokeDetector(SmokeDetector, AsyncDevice): """ HMIP-SWSD (Smoke Alarm with Q label) """
[docs]class AsyncFloorTerminalBlock6(FloorTerminalBlock6, AsyncDevice): """ HMIP-FAL230-C6 (Floor Heating Actuator - 6 channels, 230 V) """
[docs]class AsyncFloorTerminalBlock10(FloorTerminalBlock10, AsyncFloorTerminalBlock6): """ HMIP-FAL24-C10 (Floor Heating Actuator – 10x channels, 24V) """
[docs]class AsyncFloorTerminalBlock12(FloorTerminalBlock12, AsyncDevice): """ HMIP-FALMOT-C12 (Floor Heating Actuator – 12x channels, motorised) """
[docs] async def set_minimum_floor_heating_valve_position( self, minimumFloorHeatingValvePosition: float ): """ sets the minimum floot heating valve position Args: minimumFloorHeatingValvePosition(float): the minimum valve position. must be between 0.0 and 1.0 Returns: the result of the _restCall """ await self._connection.api_call( *super().set_minimum_floor_heating_valve_position( minimumFloorHeatingValvePosition=minimumFloorHeatingValvePosition ) )
[docs]class AsyncPushButton(PushButton, AsyncDevice): """ HMIP-WRC2 (Wall-mount Remote Control - 2-button) """
[docs]class AsyncPushButton6(PushButton6, AsyncPushButton): """ HMIP-WRC6 (Wall-mount Remote Control - 6-button) """
[docs]class AsyncPushButtonFlat(PushButtonFlat, AsyncPushButton): """ HMIP-WRCC2 (Wall-mount Remote Control – flat) """
[docs]class AsyncBrandPushButton(BrandPushButton, AsyncPushButton): """ HMIP-BRC2 (Remote Control for brand switches – 2x channels) """
[docs]class AsyncKeyRemoteControl4(KeyRemoteControl4, AsyncPushButton): """ HMIP-KRC4 (Key Ring Remote Control - 4 buttons) """
[docs]class AsyncRemoteControl8(RemoteControl8, AsyncPushButton): """ HMIP-RC8 (Remote Control - 8 buttons) """
[docs]class AsyncRemoteControl8Module(RemoteControl8Module, AsyncRemoteControl8): """ HMIP-MOD-RC8 (Open Collector Module Sender - 8x) """
[docs]class AsyncAlarmSirenIndoor(AlarmSirenIndoor, AsyncSabotageDevice): """ HMIP-ASIR (Alarm Siren) """
[docs]class AsyncAlarmSirenOutdoor(AlarmSirenOutdoor, AsyncAlarmSirenIndoor): """ HMIP-ASIR-O (Alarm Siren Outdoor) """
[docs]class AsyncMotionDetectorIndoor(MotionDetectorIndoor, AsyncSabotageDevice): """ HMIP-SMI (Motion Detector with Brightness Sensor - indoor) """
[docs]class AsyncMotionDetectorOutdoor(MotionDetectorOutdoor, AsyncDevice): """ HMIP-SMO-A (Motion Detector with Brightness Sensor - outdoor) """
[docs]class AsyncMotionDetectorPushButton(MotionDetectorPushButton, AsyncDevice): """ HMIP-SMI55 (Motion Detector with Brightness Sensor and Remote Control - 2-button) """
[docs]class AsyncPresenceDetectorIndoor(PresenceDetectorIndoor, AsyncSabotageDevice): """ HMIP-SPI (Presence Sensor - indoor) """
[docs]class AsyncPassageDetector(PassageDetector, AsyncSabotageDevice): """ HMIP-SPDR (Passage Detector) """
[docs]class AsyncKeyRemoteControlAlarm(KeyRemoteControlAlarm, AsyncDevice): """ HMIP-KRCA (Key Ring Remote Control - alarm) """
[docs]class AsyncFullFlushContactInterface(FullFlushContactInterface, AsyncDevice): """ HMIP-FCI1 (Contact Interface flush-mount – 1 channel) """
[docs]class AsyncFullFlushContactInterface6(FullFlushContactInterface6, AsyncDevice): """ HMIP-FCI6 (Contact Interface flush-mount – 6 channels) """
[docs]class AsyncFullFlushInputSwitch(FullFlushInputSwitch, AsyncSwitch): """ HMIP-FSI16 (Switch Actuator with Push-button Input 230V, 16A) """
[docs]class AsyncDinRailSwitch(DinRailSwitch, AsyncFullFlushInputSwitch): """ HMIP-DRSI1 (Switch Actuator for DIN rail mount – 1x channel) """
[docs]class AsyncShutter(Shutter, AsyncDevice): """ Base class for async shutter devices """
[docs] async def set_shutter_level(self, level=0.0, channelIndex=1): return await self._connection.api_call( *super().set_shutter_level(level, channelIndex) )
[docs] async def set_shutter_stop(self, channelIndex=1): return await self._connection.api_call(*super().set_shutter_stop(channelIndex))
[docs]class AsyncBlind(Blind, AsyncShutter): """ Base class for async blind devices """
[docs] async def set_slats_level(self, slatsLevel=0.0, shutterLevel=None, channelIndex=1): return await self._connection.api_call( *super().set_slats_level(slatsLevel, shutterLevel, channelIndex) )
[docs]class AsyncFullFlushShutter(FullFlushShutter, AsyncShutter): """ HMIP-FROLL (Shutter Actuator - flush-mount) / HMIP-BROLL (Shutter Actuator - Brand-mount) """
[docs]class AsyncFullFlushBlind(FullFlushBlind, AsyncBlind): """HMIP-FBL (Blind Actuator - flush-mount)"""
[docs]class AsyncBrandBlind(BrandBlind, AsyncFullFlushBlind): """ HMIP-BBL (Blind Actuator for brand switches) """
[docs]class AsyncDinRailBlind4(DinRailBlind4, AsyncBlind): """ HmIP-DRBLI4 (Blind Actuator for DIN rail mount – 4 channels) """
[docs]class AsyncDimmer(Dimmer, AsyncDevice): """Base dimmer device class"""
[docs] async def set_dim_level(self, dimLevel=0.0, channelIndex=1): return await self._connection.api_call( *super().set_dim_level(dimLevel=dimLevel, channelIndex=channelIndex) )
[docs]class AsyncPluggableDimmer(AsyncDimmer): """HMIP-PDT Pluggable Dimmer"""
[docs]class AsyncBrandDimmer(AsyncDimmer): """HMIP-BDT Brand Dimmer"""
[docs]class AsyncFullFlushDimmer(AsyncDimmer): """HMIP-FDT Dimming Actuator flush-mount"""
[docs]class AsyncWeatherSensor(WeatherSensor, AsyncDevice): """ HMIP-SWO-B """
[docs]class AsyncWeatherSensorPlus(WeatherSensorPlus, AsyncDevice): """ HMIP-SWO-PL """
[docs]class AsyncWeatherSensorPro(WeatherSensorPro, AsyncDevice): """ HMIP-SWO-PR """
[docs]class AsyncMultiIOBox(MultiIOBox, AsyncSwitch): """ HMIP-MIOB (Multi IO Box for floor heating & cooling) """
[docs]class AsyncWaterSensor(WaterSensor, AsyncDevice): """ HMIP-SWD """
[docs] async def set_acoustic_alarm_signal(self, acousticAlarmSignal: AcousticAlarmSignal): return await self._connection.api_call( *super().set_acoustic_alarm_signal(acousticAlarmSignal=acousticAlarmSignal) )
[docs] async def set_acoustic_alarm_timing(self, acousticAlarmTiming: AcousticAlarmTiming): return await self._connection.api_call( *super().set_acoustic_alarm_timing(acousticAlarmTiming=acousticAlarmTiming) )
[docs] async def set_acoustic_water_alarm_trigger( self, acousticWaterAlarmTrigger: WaterAlarmTrigger ): return await self._connection.api_call( *super().set_acoustic_water_alarm_trigger( acousticWaterAlarmTrigger=acousticWaterAlarmTrigger ) )
[docs] async def set_inapp_water_alarm_trigger( self, inAppWaterAlarmTrigger: WaterAlarmTrigger ): return await self._connection.api_call( *super().set_inapp_water_alarm_trigger( inAppWaterAlarmTrigger=inAppWaterAlarmTrigger ) )
[docs] async def set_siren_water_alarm_trigger( self, sirenWaterAlarmTrigger: WaterAlarmTrigger ): return await self._connection.api_call( *super().set_siren_water_alarm_trigger( sirenWaterAlarmTrigger=sirenWaterAlarmTrigger ) )
[docs]class AsyncAccelerationSensor(AccelerationSensor, AsyncDevice): """ HMIP-SAM """
[docs] async def set_acceleration_sensor_mode( self, mode: AccelerationSensorMode, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_mode(mode, channelIndex) )
[docs] async def set_acceleration_sensor_neutral_position( self, neutralPosition: AccelerationSensorNeutralPosition, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_neutral_position( neutralPosition, channelIndex ) )
[docs] async def set_acceleration_sensor_sensitivity( self, sensitivity: AccelerationSensorSensitivity, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_sensitivity(sensitivity, channelIndex) )
[docs] async def set_acceleration_sensor_trigger_angle(self, angle: int, channelIndex=1): return await self._connection.api_call( *super().set_acceleration_sensor_trigger_angle(angle, channelIndex) )
[docs] async def set_acceleration_sensor_event_filter_period( self, period: float, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_event_filter_period(period, channelIndex) )
[docs] async def set_notification_sound_type( self, soundType: NotificationSoundType, isHighToLow: bool, channelIndex=1 ): return await self._connection.api_call( *super().set_notification_sound_type(soundType, isHighToLow, channelIndex) )
[docs]class AsyncDoorModule(DoorModule, AsyncDevice): """ Generic Door Module class """
[docs] async def send_door_command(self, doorCommand=DoorCommand.STOP): return await self._connection.api_call(*super().send_door_command(doorCommand))
[docs]class AsyncGarageDoorModuleTormatic(GarageDoorModuleTormatic, AsyncDoorModule): """ HMIP-MOD-TM (Garage Door Module Tormatic) """
[docs]class AsyncHoermannDrivesModule(HoermannDrivesModule, AsyncDoorModule): """ HMIP-MOD-HO (Garage Door Module for Hörmann) """
[docs]class AsyncPluggableMainsFailureSurveillance( PluggableMainsFailureSurveillance, AsyncDevice ): """ [HMIP-PMFS] (Plugable Power Supply Monitoring) """
[docs]class AsyncRoomControlDevice(RoomControlDevice, AsyncWallMountedThermostatPro): """ ALPHA-IP-RBG (Alpha IP Wall Thermostat Display) """
[docs]class AsyncRoomControlDeviceAnalog(AsyncDevice): """ ALPHA-IP-RBGa (ALpha IP Wall Thermostat Display analog) """ def __init__(self, connection): super().__init__(connection) self.actualTemperature = 0.0 self.setPointTemperature = 0.0 self.temperatureOffset = 0.0
[docs] def from_json(self, js): super().from_json(js) c = get_functional_channel("ANALOG_ROOM_CONTROL_CHANNEL", js) if c: self.set_attr_from_dict("actualTemperature", c) self.set_attr_from_dict("setPointTemperature", c) self.set_attr_from_dict("temperatureOffset", c)
[docs]class AsyncWiredDimmer3(WiredDimmer3, AsyncDimmer): """HMIPW-DRD3 (Homematic IP Wired Dimming Actuator – 3x channels)"""
[docs]class AsyncWiredInput32(WiredInput32, AsyncFullFlushContactInterface): """ HMIPW-DRI32 (Homematic IP Wired Inbound module – 32x channels) """
[docs]class AsyncWiredSwitch8(WiredSwitch8, AsyncSwitch): """ HMIPW-DRS8 (Homematic IP Wired Switch Actuator – 8x channels) """
[docs]class AsyncDinRailSwitch4(DinRailSwitch4, AsyncSwitch): """ HMIP-DRSI4 (Homematic IP Switch Actuator for DIN rail mount – 4x channels) """
[docs]class AsyncTiltVibrationSensor(TiltVibrationSensor, AsyncDevice): """ HMIP-STV (Inclination and vibration Sensor) """
[docs] async def set_acceleration_sensor_mode( self, mode: AccelerationSensorMode, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_mode(mode, channelIndex) )
[docs] async def set_acceleration_sensor_sensitivity( self, sensitivity: AccelerationSensorSensitivity, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_sensitivity(sensitivity, channelIndex) )
[docs] async def set_acceleration_sensor_trigger_angle(self, angle: int, channelIndex=1): return await self._connection.api_call( *super().set_acceleration_sensor_trigger_angle(angle, channelIndex) )
[docs] async def set_acceleration_sensor_event_filter_period( self, period: float, channelIndex=1 ): return await self._connection.api_call( *super().set_acceleration_sensor_event_filter_period(period, channelIndex) )
[docs]class AsyncHomeControlAccessPoint(HomeControlAccessPoint, AsyncDevice): """ HMIP-HAP """
[docs]class AsyncBlindModule(BlindModule, AsyncDevice): """ HMIP-HDM1 (Hunter Douglas & erfal window blinds) """
[docs] async def set_primary_shading_level(self, primaryShadingLevel: float): return await self._connection.api_call( *super().set_primary_shading_level(primaryShadingLevel) )
[docs] async def set_secondary_shading_level( self, primaryShadingLevel: float, secondaryShadingLevel: float ): return await self._connection.api_call( *super().set_secondary_shading_level( primaryShadingLevel, secondaryShadingLevel ) )
[docs] async def stop(self): return await self._connection.api_call(*super().stop())
[docs]class AsyncRainSensor(RainSensor, AsyncDevice): """ HMIP-SRD (Rain Sensor) """
[docs]class AsyncTemperaturDifferenceSensor2(TemperaturDifferenceSensor2, AsyncDevice): """ HmIP-STE2-PCB (Temperature Difference Sensors - 2x sensors) """