mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 10:17:09 +00:00
Add support for Shelly SHBTN-2 device triggers (#46644)
This commit is contained in:
parent
5780615251
commit
d5ee49cd4e
@ -111,7 +111,7 @@ def get_device_channel_name(
|
|||||||
def is_momentary_input(settings: dict, block: aioshelly.Block) -> bool:
|
def is_momentary_input(settings: dict, block: aioshelly.Block) -> bool:
|
||||||
"""Return true if input button settings is set to a momentary type."""
|
"""Return true if input button settings is set to a momentary type."""
|
||||||
# Shelly Button type is fixed to momentary and no btn_type
|
# Shelly Button type is fixed to momentary and no btn_type
|
||||||
if settings["device"]["type"] == "SHBTN-1":
|
if settings["device"]["type"] in ("SHBTN-1", "SHBTN-2"):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
button = settings.get("relays") or settings.get("lights") or settings.get("inputs")
|
button = settings.get("relays") or settings.get("lights") or settings.get("inputs")
|
||||||
@ -158,7 +158,7 @@ def get_input_triggers(
|
|||||||
else:
|
else:
|
||||||
subtype = f"button{int(block.channel)+1}"
|
subtype = f"button{int(block.channel)+1}"
|
||||||
|
|
||||||
if device.settings["device"]["type"] == "SHBTN-1":
|
if device.settings["device"]["type"] in ("SHBTN-1", "SHBTN-2"):
|
||||||
trigger_types = SHBTN_1_INPUTS_EVENTS_TYPES
|
trigger_types = SHBTN_1_INPUTS_EVENTS_TYPES
|
||||||
elif device.settings["device"]["type"] == "SHIX3-1":
|
elif device.settings["device"]["type"] == "SHIX3-1":
|
||||||
trigger_types = SHIX3_1_INPUTS_EVENTS_TYPES
|
trigger_types = SHIX3_1_INPUTS_EVENTS_TYPES
|
||||||
|
Loading…
x
Reference in New Issue
Block a user