Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions homeassistant/components/blebox/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions homeassistant/components/blebox/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}" } },
Expand Down
36 changes: 36 additions & 0 deletions tests/components/blebox/test_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,42 @@ 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(
gatebox_second_output, hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
Comment thread
bkobus-bbx marked this conversation as resolved.
"""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,
Expand Down
Loading