diff --git a/homeassistant/components/blebox/button.py b/homeassistant/components/blebox/button.py index 16ab7b4493d715..e82216c8f0f434 100644 --- a/homeassistant/components/blebox/button.py +++ b/homeassistant/components/blebox/button.py @@ -21,6 +21,9 @@ "fav": ButtonEntityDescription(key="fav", translation_key="fav"), "open": ButtonEntityDescription(key="open", translation_key="open"), "close": ButtonEntityDescription(key="close", translation_key="close"), + "second_output": ButtonEntityDescription( + key="second_output", translation_key="second_output" + ), } _DEFAULT_BUTTON = ButtonEntityDescription(key="button") diff --git a/homeassistant/components/blebox/strings.json b/homeassistant/components/blebox/strings.json index 82f9cb4944f6a8..70c49a6f98b200 100644 --- a/homeassistant/components/blebox/strings.json +++ b/homeassistant/components/blebox/strings.json @@ -78,6 +78,7 @@ "down": { "name": "Down" }, "fav": { "name": "Favorite" }, "open": { "name": "Open" }, + "second_output": { "name": "Second output" }, "up": { "name": "Up" } }, "light": { "channel": { "name": "Channel {index}" } }, diff --git a/tests/components/blebox/test_button.py b/tests/components/blebox/test_button.py index 1ec63623141bc6..1a18de458b1679 100644 --- a/tests/components/blebox/test_button.py +++ b/tests/components/blebox/test_button.py @@ -1,7 +1,7 @@ """Blebox button entities tests.""" import logging -from unittest.mock import PropertyMock +from unittest.mock import Mock, PropertyMock import blebox_uniapi import pytest @@ -56,6 +56,44 @@ async def test_tvliftbox_init( assert state.name == "My tvLiftBox" +@pytest.fixture(name="gatebox_second_output") +def gatebox_second_output_fixture(caplog: pytest.LogCaptureFixture): + """Return a gateBox second output button entity mock.""" + caplog.set_level(logging.ERROR) + + feature = mock_feature( + "buttons", + blebox_uniapi.button.Button, + unique_id="BleBox-gateBox-1afe34d27e4f-second_output", + full_name="gateBox-second_output", + query_string="second_output", + ) + + product = feature.product + type(product).name = PropertyMock(return_value="My gateBox") + type(product).type = PropertyMock(return_value="gateBox") + type(product).model = PropertyMock(return_value="gateBox") + + return (feature, "button.my_gatebox_second_output") + + +async def test_gatebox_second_output_init( + hass: HomeAssistant, + gatebox_second_output: tuple[Mock, str], + caplog: pytest.LogCaptureFixture, +) -> None: + """Test gateBox second output button initialisation.""" + caplog.set_level(logging.ERROR) + + _, entity_id = gatebox_second_output + entry = await async_setup_entity(hass, entity_id) + state = hass.states.get(entity_id) + + assert entry.unique_id == "BleBox-gateBox-1afe34d27e4f-second_output" + assert entry.translation_key == "second_output" + assert state.name == "My gateBox Second output" + + @pytest.mark.parametrize( ("query_string", "expected_translation_key", "expected_entity_id", "expected_name"), query_translation_key_matching,