Add support for Shelly SHBTN-2 device triggers (#46644)

This commit is contained in:
CurrentThread
2021-02-26 19:21:02 +00:00
committed by Paulus Schoutsen
parent 101897c260
commit 6a850a1481
+2 -2
View File
@@ -111,7 +111,7 @@ def get_device_channel_name(
def is_momentary_input(settings: dict, block: aioshelly.Block) -> bool:
"""Return true if input button settings is set to a momentary 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
button = settings.get("relays") or settings.get("lights") or settings.get("inputs")
@@ -158,7 +158,7 @@ def get_input_triggers(
else:
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
elif device.settings["device"]["type"] == "SHIX3-1":
trigger_types = SHIX3_1_INPUTS_EVENTS_TYPES