diff --git a/homeassistant/components/bond/button.py b/homeassistant/components/bond/button.py index a2d88bc6f6a..42915c7dc0b 100644 --- a/homeassistant/components/bond/button.py +++ b/homeassistant/components/bond/button.py @@ -237,6 +237,20 @@ BUTTONS: tuple[BondButtonEntityDescription, ...] = ( mutually_exclusive=Action.SET_POSITION, argument=STEP_SIZE, ), + BondButtonEntityDescription( + key=Action.OPEN_NEXT, + name="Open Next", + translation_key="open_next", + mutually_exclusive=None, + argument=None, + ), + BondButtonEntityDescription( + key=Action.CLOSE_NEXT, + name="Close Next", + translation_key="close_next", + mutually_exclusive=None, + argument=None, + ), ) diff --git a/homeassistant/components/bond/icons.json b/homeassistant/components/bond/icons.json index 48b351b1c76..b150d1c1fa3 100644 --- a/homeassistant/components/bond/icons.json +++ b/homeassistant/components/bond/icons.json @@ -84,6 +84,12 @@ }, "decrease_position": { "default": "mdi:minus-box" + }, + "open_next": { + "default": "mdi:plus-box" + }, + "close_next": { + "default": "mdi:minus-box" } }, "light": { diff --git a/tests/components/bond/test_button.py b/tests/components/bond/test_button.py index 8c8f38db72b..c14bba0d01f 100644 --- a/tests/components/bond/test_button.py +++ b/tests/components/bond/test_button.py @@ -57,6 +57,15 @@ def light(name: str): } +def motorized_shade(name: str): + """Create a motorized shade with a given name.""" + return { + "name": name, + "type": DeviceType.MOTORIZED_SHADES, + "actions": [Action.OPEN, Action.OPEN_NEXT, Action.CLOSE, Action.CLOSE_NEXT], + } + + async def test_entity_registry( hass: HomeAssistant, entity_registry: er.EntityRegistry, @@ -180,3 +189,38 @@ async def test_press_button(hass: HomeAssistant) -> None: mock_action.assert_called_once_with( "test-device-id", Action(Action.START_DECREASING_BRIGHTNESS) ) + + +async def test_motorized_shade_actions(hass: HomeAssistant) -> None: + """Tests motorized shade open next and close next actions.""" + await setup_platform( + hass, + BUTTON_DOMAIN, + motorized_shade("name-1"), + bond_device_id="test-device-id", + ) + + assert hass.states.get("button.name_1_open_next") + assert hass.states.get("button.name_1_close_next") + + with patch_bond_action() as mock_action, patch_bond_device_state(): + await hass.services.async_call( + BUTTON_DOMAIN, + SERVICE_PRESS, + {ATTR_ENTITY_ID: "button.name_1_open_next"}, + blocking=True, + ) + await hass.async_block_till_done() + + mock_action.assert_called_once_with("test-device-id", Action(Action.OPEN_NEXT)) + + with patch_bond_action() as mock_action, patch_bond_device_state(): + await hass.services.async_call( + BUTTON_DOMAIN, + SERVICE_PRESS, + {ATTR_ENTITY_ID: "button.name_1_close_next"}, + blocking=True, + ) + await hass.async_block_till_done() + + mock_action.assert_called_once_with("test-device-id", Action(Action.CLOSE_NEXT))