Skip to content

Commit 4512ccf

Browse files
authored
Allow configuring endpoint 1 selection behavior (#181)
* Allow configuring endpoint 1 selection behavior * Use the correct config property
1 parent bfbb5fe commit 4512ccf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

zigpy_znp/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def validator(value: typing.Any) -> None:
9494
CONF_SKIP_BOOTLOADER = "skip_bootloader"
9595
CONF_SREQ_TIMEOUT = "sync_request_timeout"
9696
CONF_ARSP_TIMEOUT = "async_response_timeout"
97+
CONF_PREFER_ENDPOINT_1 = "prefer_endpoint_1"
9798
CONF_AUTO_RECONNECT_RETRY_DELAY = "auto_reconnect_retry_delay"
9899
CONF_CONNECT_RTS_STATES = "connect_rts_pin_states"
99100
CONF_CONNECT_DTR_STATES = "connect_dtr_pin_states"
@@ -113,6 +114,7 @@ def validator(value: typing.Any) -> None:
113114
CONF_AUTO_RECONNECT_RETRY_DELAY, default=5
114115
): VolPositiveNumber,
115116
vol.Optional(CONF_SKIP_BOOTLOADER, default=True): cv_boolean,
117+
vol.Optional(CONF_PREFER_ENDPOINT_1, default=True): cv_boolean,
116118
vol.Optional(CONF_LED_MODE, default=LEDMode.OFF): vol.Any(
117119
None, EnumValue(LEDMode, transformer=bool_to_upper_str)
118120
),

zigpy_znp/zigbee/application.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,10 @@ def _find_endpoint(self, dst_ep: int, profile: int, cluster: int) -> int:
759759
return ZDO_ENDPOINT
760760

761761
# Newer Z-Stack releases ignore profiles and will work properly with endpoint 1
762-
if self._zstack_build_id >= 20210708:
762+
if (
763+
self._zstack_build_id >= 20210708
764+
and self.znp_config[conf.CONF_PREFER_ENDPOINT_1]
765+
):
763766
return ZHA_ENDPOINT
764767

765768
# Always fall back to endpoint 1

0 commit comments

Comments
 (0)