diff --git a/homeassistant/components/homematicip_cloud/switch.py b/homeassistant/components/homematicip_cloud/switch.py index 8f01c65589c..59216c904a4 100644 --- a/homeassistant/components/homematicip_cloud/switch.py +++ b/homeassistant/components/homematicip_cloud/switch.py @@ -17,6 +17,7 @@ from homematicip.device import ( PlugableSwitch, PrintedCircuitBoardSwitch2, PrintedCircuitBoardSwitchBattery, + StatusBoard8, SwitchMeasuring, WiredInput32, WiredInputSwitch6, @@ -57,6 +58,7 @@ async def async_setup_entry( WiredSwitch4, WiredSwitch8, OpenCollector8Module, + StatusBoard8, BrandSwitch2, PrintedCircuitBoardSwitch2, HeatingSwitch2, diff --git a/tests/components/homematicip_cloud/fixtures/homematicip_cloud.json b/tests/components/homematicip_cloud/fixtures/homematicip_cloud.json index 44d8cc33c80..5369b2fb7bb 100644 --- a/tests/components/homematicip_cloud/fixtures/homematicip_cloud.json +++ b/tests/components/homematicip_cloud/fixtures/homematicip_cloud.json @@ -9091,6 +9091,66 @@ "serializedGlobalTradeItemNumber": "3014F71100000000000SHWSM", "type": "WATERING_ACTUATOR", "updateState": "UP_TO_DATE" + }, + "3014F7110000000000000SB8": { + "availableFirmwareVersion": "0.0.0", + "connectionType": "HMIP_RF", + "firmwareVersion": "1.8.12", + "firmwareVersionInteger": 67596, + "functionalChannels": { + "0": { + "configPending": false, + "deviceId": "3014F7110000000000000SB8", + "dutyCycle": false, + "functionalChannelType": "DEVICE_BASE", + "groupIndex": 0, + "groups": ["00000000-0000-0000-0000-000000000041"], + "index": 0, + "label": "", + "lowBat": null, + "routerModuleEnabled": false, + "routerModuleSupported": false, + "rssiDeviceValue": -62, + "rssiPeerValue": -60, + "unreach": false, + "supportedOptionalFeatures": {} + }, + "1": { + "deviceId": "3014F7110000000000000SB8", + "functionalChannelType": "SWITCH_CHANNEL", + "groupIndex": 1, + "groups": ["00000000-0000-0000-0000-000000000042"], + "index": 1, + "label": "LED 1", + "on": false, + "profileMode": "AUTOMATIC", + "userDesiredProfileMode": "AUTOMATIC" + }, + "2": { + "deviceId": "3014F7110000000000000SB8", + "functionalChannelType": "SWITCH_CHANNEL", + "groupIndex": 2, + "groups": ["00000000-0000-0000-0000-000000000042"], + "index": 2, + "label": "LED 2", + "on": true, + "profileMode": "AUTOMATIC", + "userDesiredProfileMode": "AUTOMATIC" + } + }, + "homeId": "00000000-0000-0000-0000-000000000001", + "id": "3014F7110000000000000SB8", + "label": "Status Board", + "lastStatusUpdate": 1543746604446, + "liveUpdateState": "LIVE_UPDATE_NOT_SUPPORTED", + "manufacturerCode": 9, + "modelId": 574, + "modelType": "ELV-SH-SB8", + "oem": "eQ-3", + "permanentlyReachable": true, + "serializedGlobalTradeItemNumber": "3014F7110000000000000SB8", + "type": "STATUS_BOARD_8", + "updateState": "UP_TO_DATE" } }, "groups": { diff --git a/tests/components/homematicip_cloud/test_device.py b/tests/components/homematicip_cloud/test_device.py index 8c9ffc7dfd4..09770277709 100644 --- a/tests/components/homematicip_cloud/test_device.py +++ b/tests/components/homematicip_cloud/test_device.py @@ -22,7 +22,7 @@ async def test_hmip_load_all_supported_devices( test_devices=None, test_groups=None ) - assert len(mock_hap.hmip_device_by_entity_id) == 340 + assert len(mock_hap.hmip_device_by_entity_id) == 342 async def test_hmip_remove_device( diff --git a/tests/components/homematicip_cloud/test_switch.py b/tests/components/homematicip_cloud/test_switch.py index 50d527775bd..b010a1964db 100644 --- a/tests/components/homematicip_cloud/test_switch.py +++ b/tests/components/homematicip_cloud/test_switch.py @@ -263,3 +263,36 @@ async def test_hmip_wired_multi_switch( await async_manipulate_test_data(hass, hmip_device, "on", True) ha_state = hass.states.get(entity_id) assert ha_state.state == STATE_ON + + +async def test_hmip_status_board_switch( + hass: HomeAssistant, default_mock_hap_factory: HomeFactory +) -> None: + """Test HomematicipMultiSwitch with StatusBoard8.""" + entity_id = "switch.led_1" + entity_name = "LED 1" + device_model = "ELV-SH-SB8" + mock_hap = await default_mock_hap_factory.async_get_mock_hap( + test_devices=["Status Board"] + ) + + ha_state, hmip_device = get_and_check_entity_basics( + hass, mock_hap, entity_id, entity_name, device_model + ) + + assert ha_state.state == STATE_OFF + service_call_counter = len(hmip_device.functionalChannels[1].mock_calls) + + await hass.services.async_call( + "switch", "turn_on", {"entity_id": entity_id}, blocking=True + ) + assert len(hmip_device.functionalChannels[1].mock_calls) == service_call_counter + 1 + assert hmip_device.functionalChannels[1].mock_calls[-1][0] == "async_turn_on" + await async_manipulate_test_data(hass, hmip_device, "on", True) + ha_state = hass.states.get(entity_id) + assert ha_state.state == STATE_ON + + # Verify second channel exists and has correct initial state (on=true in fixture) + ha_state2 = hass.states.get("switch.led_2") + assert ha_state2 is not None + assert ha_state2.state == STATE_ON