Add support for `triple_push` event for Shelly gen2 devices (#88081)

* Add support for triple_push event

* Sort

* Fix tests
pull/88163/head
Maciej Bieniek 2023-02-15 10:20:27 +01:00 committed by GitHub
parent 50cbabb2d8
commit cd4ce86f07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 4 deletions

View File

@ -102,6 +102,7 @@ RPC_INPUTS_EVENTS_TYPES: Final = {
"btn_up",
"single_push",
"double_push",
"triple_push",
"long_push",
}

View File

@ -56,6 +56,7 @@
"btn_up": "{subtype} button up",
"single_push": "{subtype} single push",
"double_push": "{subtype} double push",
"triple_push": "{subtype} triple push",
"long_push": "{subtype} long push"
}
},

View File

@ -91,7 +91,14 @@ async def test_get_triggers_rpc_device(hass, mock_rpc_device):
CONF_SUBTYPE: "button1",
"metadata": {},
}
for type in ["btn_down", "btn_up", "single_push", "double_push", "long_push"]
for type in [
"btn_down",
"btn_up",
"single_push",
"double_push",
"triple_push",
"long_push",
]
]
triggers = await async_get_device_automations(

View File

@ -215,11 +215,12 @@ async def test_get_rpc_input_triggers(mock_rpc_device, monkeypatch):
"""Test get RPC input triggers."""
monkeypatch.setattr(mock_rpc_device, "config", {"input:0": {"type": "button"}})
assert set(get_rpc_input_triggers(mock_rpc_device)) == {
("long_push", "button1"),
("single_push", "button1"),
("btn_down", "button1"),
("double_push", "button1"),
("btn_up", "button1"),
("single_push", "button1"),
("double_push", "button1"),
("triple_push", "button1"),
("long_push", "button1"),
}
monkeypatch.setattr(mock_rpc_device, "config", {"input:0": {"type": "switch"}})