Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HmIPW-DRS4 Switch Actuator #477

Merged
merged 4 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions homematicip/aio/class_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
DeviceType.WIRED_DIMMER_3: AsyncWiredDimmer3,
DeviceType.WIRED_INPUT_32: AsyncWiredInput32,
DeviceType.WIRED_SWITCH_8: AsyncWiredSwitch8,
DeviceType.WIRED_SWITCH_4: AsyncWiredSwitch4,
}

TYPE_GROUP_MAP = {
Expand Down
4 changes: 4 additions & 0 deletions homematicip/aio/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,10 @@ class AsyncWiredSwitch8(WiredSwitch8, AsyncSwitch):
"""HMIPW-DRS8 (Homematic IP Wired Switch Actuator – 8x channels)"""


class AsyncWiredSwitch4(WiredSwitch4, AsyncSwitch):
"""HMIPW-DRS4 (Homematic IP Wired Switch Actuator – 4x channels)"""


class AsyncDinRailSwitch4(DinRailSwitch4, AsyncSwitch):
"""HMIP-DRSI4 (Homematic IP Switch Actuator for DIN rail mount – 4x channels)"""

Expand Down
1 change: 1 addition & 0 deletions homematicip/base/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ class DeviceType(AutoNameEnum):
WIRED_DIMMER_3 = auto()
WIRED_INPUT_32 = auto()
WIRED_SWITCH_8 = auto()
WIRED_SWITCH_4 = auto()


class GroupType(AutoNameEnum):
Expand Down
1 change: 1 addition & 0 deletions homematicip/class_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
DeviceType.WIRED_DIMMER_3: WiredDimmer3,
DeviceType.WIRED_INPUT_32: WiredInput32,
DeviceType.WIRED_SWITCH_8: WiredSwitch8,
DeviceType.WIRED_SWITCH_4: WiredSwitch4,
}

TYPE_GROUP_MAP = {
Expand Down
4 changes: 4 additions & 0 deletions homematicip/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,10 @@ class WiredSwitch8(Switch):
"""HMIPW-DRS8 (Homematic IP Wired Switch Actuator – 8x channels)"""


class WiredSwitch4(Switch):
"""HMIPW-DRS4 (Homematic IP Wired Switch Actuator – 4x channels)"""


class DinRailSwitch4(Switch):
"""HMIP-DRSI4 (Homematic IP Switch Actuator for DIN rail mount – 4x channels)"""

Expand Down
100 changes: 100 additions & 0 deletions homematicip_demo/json_data/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,106 @@
"type": "WIRED_SWITCH_8",
"updateState": "UP_TO_DATE"
},
"3014F711000WIREDSWITCH4": {
"availableFirmwareVersion": "0.0.0",
"connectionType": "HMIP_WIRED",
"firmwareVersion": "1.2.4",
"firmwareVersionInteger": 66052,
"functionalChannels": {
"0": {
"coProFaulty": false,
"coProRestartNeeded": false,
"coProUpdateFailure": false,
"configPending": false,
"deviceId": "3014F711000WIREDSWITCH4",
"deviceOverheated": false,
"deviceOverloaded": false,
"devicePowerFailureDetected": false,
"deviceUndervoltage": false,
"dutyCycle": null,
"functionalChannelType": "DEVICE_BASE",
"groupIndex": 0,
"groups": [],
"index": 0,
"label": "",
"lowBat": null,
"routerModuleEnabled": false,
"routerModuleSupported": false,
"rssiDeviceValue": null,
"rssiPeerValue": null,
"supportedOptionalFeatures": {
"IFeatureDeviceCoProError": false,
"IFeatureDeviceCoProRestart": false,
"IFeatureDeviceCoProUpdate": false,
"IFeatureDeviceIdentify": true,
"IFeatureDeviceOverheated": true,
"IFeatureDeviceOverloaded": false,
"IFeatureDevicePowerFailure": false,
"IFeatureDeviceTemperatureOutOfRange": false,
"IFeatureDeviceUndervoltage": true
},
"temperatureOutOfRange": false,
"unreach": false
},
"1": {
"deviceId": "3014F711000WIREDSWITCH4",
"functionalChannelType": "SWITCH_CHANNEL",
"groupIndex": 1,
"groups": [],
"index": 1,
"label": "Fernseher (Wohnzimmer)",
"on": true,
"profileMode": "AUTOMATIC",
"userDesiredProfileMode": "AUTOMATIC"
},
"2": {
"deviceId": "3014F711000WIREDSWITCH8",
"functionalChannelType": "SWITCH_CHANNEL",
"groupIndex": 2,
"groups": [],
"index": 2,
"label": "Steckdosen (Wohnzimmer)",
"on": true,
"profileMode": "AUTOMATIC",
"userDesiredProfileMode": "AUTOMATIC"
},
"3": {
"deviceId": "3014F711000WIREDSWITCH4",
"functionalChannelType": "SWITCH_CHANNEL",
"groupIndex": 3,
"groups": [],
"index": 3,
"label": "Steckdosen Kaffeeecke (K\u00fcche)",
"on": true,
"profileMode": "AUTOMATIC",
"userDesiredProfileMode": "AUTOMATIC"
},
"4": {
"deviceId": "3014F711000WIREDSWITCH4",
"functionalChannelType": "SWITCH_CHANNEL",
"groupIndex": 4,
"groups": [],
"index": 4,
"label": "Steckdosen (K\u00fcche)",
"on": true,
"profileMode": "AUTOMATIC",
"userDesiredProfileMode": "AUTOMATIC"
}
},
"homeId": "00000000-0000-0000-0000-000000000001",
"id": "3014F711000WIREDSWITCH4",
"label": "Wired Schaltaktor \u2013 4-fach",
"lastStatusUpdate": 1595225535806,
"liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED",
"manufacturerCode": 1,
"modelId": 343,
"modelType": "HmIPW-DRS4",
"oem": "eQ-3",
"permanentlyReachable": true,
"serializedGlobalTradeItemNumber": "3014F711000WIREDSWITCH4",
"type": "WIRED_SWITCH_4",
"updateState": "UP_TO_DATE"
},
"3014F711000WIREDDIMMER3": {
"availableFirmwareVersion": "0.0.0",
"connectionType": "HMIP_WIRED",
Expand Down
14 changes: 14 additions & 0 deletions tests/aio_tests/test_async_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,3 +840,17 @@ async def test_multibox_io(no_ssl_fake_async_home: AsyncHome):
await d.turn_off(1)
await no_ssl_fake_async_home.get_current_state()
assert d.functionalChannels[1].on == False


@pytest.mark.asyncio
async def test_wired_din_rail_switch_4(no_ssl_fake_async_home: AsyncHome):
d = no_ssl_fake_async_home.search_device_by_id("3014F711000WIREDSWITCH4")
assert isinstance(d, AsyncWiredSwitch4)

for i in range(1, 4):
await d.turn_on(i)
await no_ssl_fake_async_home.get_current_state()
assert d.functionalChannels[i].on == True
await d.turn_off(i)
await no_ssl_fake_async_home.get_current_state()
assert d.functionalChannels[i].on == False
14 changes: 14 additions & 0 deletions tests/test_devices.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,3 +1560,17 @@ def test_door_lock_sensor(fake_home: Home):
assert d.doorLockNeutralPosition == "HORIZONTAL"
assert d.doorLockTurns == 2
assert d.lockState == None


def test_wired_din_rail_switch4(fake_home: Home):
with no_ssl_verification():
d = fake_home.search_device_by_id("3014F711000WIREDSWITCH4")
assert isinstance(d, WiredSwitch4)

for i in range(1, 4):
d.turn_on(i)
fake_home.get_current_state()
assert d.functionalChannels[i].on == True
d.turn_off(i)
fake_home.get_current_state()
assert d.functionalChannels[i].on == False