Add device HmIP-DRDI3 (#83337)

pull/83380/head
hahn-th 2022-12-18 20:44:49 +01:00 committed by GitHub
parent d423cbf8eb
commit 5e5e89ea18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 319 additions and 5 deletions

View File

@ -8,6 +8,7 @@ from homematicip.aio.device import (
AsyncBrandSwitchMeasuring,
AsyncBrandSwitchNotificationLight,
AsyncDimmer,
AsyncDinRailDimmer3,
AsyncFullFlushDimmer,
AsyncPluggableDimmer,
AsyncWiredDimmer3,
@ -53,7 +54,7 @@ async def async_setup_entry(
hap, device, device.bottomLightChannelIndex
)
)
elif isinstance(device, AsyncWiredDimmer3):
elif isinstance(device, (AsyncWiredDimmer3, AsyncDinRailDimmer3)):
for channel in range(1, 4):
entities.append(HomematicipMultiDimmer(hap, device, channel=channel))
elif isinstance(

View File

@ -3,7 +3,7 @@
"name": "HomematicIP Cloud",
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/homematicip_cloud",
"requirements": ["homematicip==1.0.11"],
"requirements": ["homematicip==1.0.13"],
"codeowners": [],
"quality_scale": "platinum",
"iot_class": "cloud_push",

View File

@ -894,7 +894,7 @@ home-assistant-frontend==20221213.1
homeconnect==0.7.2
# homeassistant.components.homematicip_cloud
homematicip==1.0.11
homematicip==1.0.13
# homeassistant.components.home_plus_control
homepluscontrol==0.0.5

View File

@ -674,7 +674,7 @@ home-assistant-frontend==20221213.1
homeconnect==0.7.2
# homeassistant.components.homematicip_cloud
homematicip==1.0.11
homematicip==1.0.13
# homeassistant.components.home_plus_control
homepluscontrol==0.0.5

View File

@ -22,7 +22,7 @@ async def test_hmip_load_all_supported_devices(hass, default_mock_hap_factory):
test_devices=None, test_groups=None
)
assert len(mock_hap.hmip_device_by_entity_id) == 267
assert len(mock_hap.hmip_device_by_entity_id) == 270
async def test_hmip_remove_device(hass, default_mock_hap_factory):

View File

@ -325,3 +325,174 @@ async def test_hmip_wired_multi_dimmer(hass, default_mock_hap_factory):
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
assert not ha_state.attributes.get(ATTR_BRIGHTNESS)
async def test_hmip_din_rail_dimmer_3_channel1(hass, default_mock_hap_factory):
"""Test HomematicIP DinRailDimmer3 Channel 1."""
entity_id = "light.3_dimmer_channel1"
entity_name = "3-Dimmer Channel1"
device_model = "HmIP-DRDI3"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=["3-Dimmer"]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == STATE_ON
assert ha_state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert ha_state.attributes[ATTR_SUPPORTED_FEATURES] == 0
service_call_counter = len(hmip_device.mock_calls)
await hass.services.async_call(
"light", "turn_on", {"entity_id": entity_id}, blocking=True
)
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (1, 1)
await hass.services.async_call(
"light",
"turn_on",
{"entity_id": entity_id, "brightness": "100"},
blocking=True,
)
assert len(hmip_device.mock_calls) == service_call_counter + 2
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (0.39215686274509803, 1)
await async_manipulate_test_data(hass, hmip_device, "dimLevel", 1, channel=1)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_ON
assert ha_state.attributes[ATTR_BRIGHTNESS] == 255
assert ha_state.attributes[ATTR_COLOR_MODE] == ColorMode.BRIGHTNESS
assert ha_state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert ha_state.attributes[ATTR_SUPPORTED_FEATURES] == 0
await hass.services.async_call(
"light", "turn_off", {"entity_id": entity_id}, blocking=True
)
assert len(hmip_device.mock_calls) == service_call_counter + 4
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (0, 1)
await async_manipulate_test_data(hass, hmip_device, "dimLevel", 0, channel=1)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
await async_manipulate_test_data(hass, hmip_device, "dimLevel", None, channel=1)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
assert not ha_state.attributes.get(ATTR_BRIGHTNESS)
async def test_hmip_din_rail_dimmer_3_channel2(hass, default_mock_hap_factory):
"""Test HomematicIP DinRailDimmer3 Channel 2."""
entity_id = "light.3_dimmer_channel2"
entity_name = "3-Dimmer Channel2"
device_model = "HmIP-DRDI3"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=["3-Dimmer"]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == STATE_ON
assert ha_state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert ha_state.attributes[ATTR_SUPPORTED_FEATURES] == 0
service_call_counter = len(hmip_device.mock_calls)
await hass.services.async_call(
"light", "turn_on", {"entity_id": entity_id}, blocking=True
)
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (1, 2)
await hass.services.async_call(
"light",
"turn_on",
{"entity_id": entity_id, "brightness": "100"},
blocking=True,
)
assert len(hmip_device.mock_calls) == service_call_counter + 2
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (0.39215686274509803, 2)
await async_manipulate_test_data(hass, hmip_device, "dimLevel", 1, channel=2)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_ON
assert ha_state.attributes[ATTR_BRIGHTNESS] == 255
assert ha_state.attributes[ATTR_COLOR_MODE] == ColorMode.BRIGHTNESS
assert ha_state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert ha_state.attributes[ATTR_SUPPORTED_FEATURES] == 0
await hass.services.async_call(
"light", "turn_off", {"entity_id": entity_id}, blocking=True
)
assert len(hmip_device.mock_calls) == service_call_counter + 4
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (0, 2)
await async_manipulate_test_data(hass, hmip_device, "dimLevel", 0, channel=2)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
await async_manipulate_test_data(hass, hmip_device, "dimLevel", None, channel=2)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
assert not ha_state.attributes.get(ATTR_BRIGHTNESS)
async def test_hmip_din_rail_dimmer_3_channel3(hass, default_mock_hap_factory):
"""Test HomematicIP DinRailDimmer3 Channel 3."""
entity_id = "light.esstisch"
entity_name = "Esstisch"
device_model = "HmIP-DRDI3"
mock_hap = await default_mock_hap_factory.async_get_mock_hap(
test_devices=["3-Dimmer"]
)
ha_state, hmip_device = get_and_check_entity_basics(
hass, mock_hap, entity_id, entity_name, device_model
)
assert ha_state.state == STATE_ON
assert ha_state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert ha_state.attributes[ATTR_SUPPORTED_FEATURES] == 0
service_call_counter = len(hmip_device.mock_calls)
await hass.services.async_call(
"light", "turn_on", {"entity_id": entity_id}, blocking=True
)
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (1, 3)
await hass.services.async_call(
"light",
"turn_on",
{"entity_id": entity_id, "brightness": "100"},
blocking=True,
)
assert len(hmip_device.mock_calls) == service_call_counter + 2
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (0.39215686274509803, 3)
await async_manipulate_test_data(hass, hmip_device, "dimLevel", 1, channel=3)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_ON
assert ha_state.attributes[ATTR_BRIGHTNESS] == 255
assert ha_state.attributes[ATTR_COLOR_MODE] == ColorMode.BRIGHTNESS
assert ha_state.attributes[ATTR_SUPPORTED_COLOR_MODES] == [ColorMode.BRIGHTNESS]
assert ha_state.attributes[ATTR_SUPPORTED_FEATURES] == 0
await hass.services.async_call(
"light", "turn_off", {"entity_id": entity_id}, blocking=True
)
assert len(hmip_device.mock_calls) == service_call_counter + 4
assert hmip_device.mock_calls[-1][0] == "set_dim_level"
assert hmip_device.mock_calls[-1][1] == (0, 3)
await async_manipulate_test_data(hass, hmip_device, "dimLevel", 0, channel=3)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
await async_manipulate_test_data(hass, hmip_device, "dimLevel", None, channel=3)
ha_state = hass.states.get(entity_id)
assert ha_state.state == STATE_OFF
assert not ha_state.attributes.get(ATTR_BRIGHTNESS)

View File

@ -6977,6 +6977,148 @@
"permanentlyReachable": true,
"supported": true,
"type": "EXTERNAL"
},
"3014F711A000DIN_RAIL_DIMMER3": {
"availableFirmwareVersion": "1.2.0",
"connectionType": "HMIP_RF",
"firmwareVersion": "1.2.0",
"firmwareVersionInteger": 66048,
"functionalChannels": {
"0": {
"busConfigMismatch": null,
"coProFaulty": false,
"coProRestartNeeded": false,
"coProUpdateFailure": false,
"configPending": false,
"deviceId": "3014F711A000DIN_RAIL_DIMMER3",
"deviceOverheated": false,
"deviceOverloaded": false,
"devicePowerFailureDetected": false,
"deviceUndervoltage": false,
"dutyCycle": false,
"functionalChannelType": "DEVICE_BASE",
"groupIndex": 0,
"groups": ["49bf77e1-a07b-4a3c-8151-e0a7aca331bb"],
"index": 0,
"label": "",
"lowBat": null,
"mountingOrientation": null,
"multicastRoutingEnabled": false,
"particulateMatterSensorCommunicationError": null,
"particulateMatterSensorError": null,
"powerShortCircuit": null,
"profilePeriodLimitReached": null,
"routerModuleEnabled": false,
"routerModuleSupported": false,
"rssiDeviceValue": -64,
"rssiPeerValue": -66,
"shortCircuitDataLine": null,
"supportedOptionalFeatures": {
"IFeatureBusConfigMismatch": false,
"IFeatureDeviceCoProError": false,
"IFeatureDeviceCoProRestart": false,
"IFeatureDeviceCoProUpdate": false,
"IFeatureDeviceIdentify": true,
"IFeatureDeviceOverheated": true,
"IFeatureDeviceOverloaded": false,
"IFeatureDeviceParticulateMatterSensorCommunicationError": false,
"IFeatureDeviceParticulateMatterSensorError": false,
"IFeatureDevicePowerFailure": true,
"IFeatureDeviceTemperatureHumiditySensorCommunicationError": false,
"IFeatureDeviceTemperatureHumiditySensorError": false,
"IFeatureDeviceTemperatureOutOfRange": false,
"IFeatureDeviceUndervoltage": false,
"IFeatureMulticastRouter": false,
"IFeaturePowerShortCircuit": false,
"IFeatureProfilePeriodLimit": true,
"IFeatureRssiValue": true,
"IFeatureShortCircuitDataLine": false,
"IOptionalFeatureDutyCycle": true,
"IOptionalFeatureLowBat": false,
"IOptionalFeatureMountingOrientation": false
},
"temperatureHumiditySensorCommunicationError": null,
"temperatureHumiditySensorError": null,
"temperatureOutOfRange": false,
"unreach": false
},
"1": {
"binaryBehaviorType": "NORMALLY_CLOSE",
"coProFaulty": true,
"coProRestartNeeded": false,
"deviceId": "3014F711A000DIN_RAIL_DIMMER3",
"deviceOverheated": false,
"deviceOverloaded": false,
"dimLevel": 0.1,
"functionalChannelType": "MULTI_MODE_INPUT_DIMMER_CHANNEL",
"groupIndex": 1,
"groups": [],
"index": 1,
"label": "",
"multiModeInputMode": "KEY_BEHAVIOR",
"on": true,
"profileMode": "AUTOMATIC",
"supportedOptionalFeatures": {
"IFeatureDeviceOverloaded": true
},
"userDesiredProfileMode": "AUTOMATIC"
},
"2": {
"binaryBehaviorType": "NORMALLY_CLOSE",
"coProFaulty": true,
"coProRestartNeeded": false,
"deviceId": "3014F711A000DIN_RAIL_DIMMER3",
"deviceOverheated": false,
"deviceOverloaded": false,
"dimLevel": 0.2,
"functionalChannelType": "MULTI_MODE_INPUT_DIMMER_CHANNEL",
"groupIndex": 2,
"groups": [],
"index": 2,
"label": "",
"multiModeInputMode": "KEY_BEHAVIOR",
"on": true,
"profileMode": "AUTOMATIC",
"supportedOptionalFeatures": {
"IFeatureDeviceOverloaded": true
},
"userDesiredProfileMode": "AUTOMATIC"
},
"3": {
"binaryBehaviorType": "NORMALLY_CLOSE",
"coProFaulty": false,
"coProRestartNeeded": false,
"deviceId": "3014F711A000DIN_RAIL_DIMMER3",
"deviceOverheated": false,
"deviceOverloaded": false,
"dimLevel": 0.3,
"functionalChannelType": "MULTI_MODE_INPUT_DIMMER_CHANNEL",
"groupIndex": 3,
"groups": [],
"index": 3,
"label": "Esstisch",
"multiModeInputMode": "KEY_BEHAVIOR",
"on": true,
"profileMode": "AUTOMATIC",
"supportedOptionalFeatures": {
"IFeatureDeviceOverloaded": true
},
"userDesiredProfileMode": "AUTOMATIC"
}
},
"homeId": "00000000-0000-0000-0000-000000000001",
"id": "3014F711A000DIN_RAIL_DIMMER3",
"label": "3-Dimmer",
"lastStatusUpdate": 1618223872902,
"liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
"manufacturerCode": 1,
"modelId": 407,
"modelType": "HmIP-DRDI3",
"oem": "eQ-3",
"permanentlyReachable": true,
"serializedGlobalTradeItemNumber": "3014F711A000DIN_RAIL_DIMMER3",
"type": "DIN_RAIL_DIMMER_3",
"updateState": "UP_TO_DATE"
}
},
"groups": {