Skip to content

Commit

Permalink
Allow configuring endpoint 1 selection behavior (#181)
Browse files Browse the repository at this point in the history
* Allow configuring endpoint 1 selection behavior

* Use the correct config property
  • Loading branch information
puddly authored Oct 3, 2022
1 parent bfbb5fe commit 4512ccf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions zigpy_znp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def validator(value: typing.Any) -> None:
CONF_SKIP_BOOTLOADER = "skip_bootloader"
CONF_SREQ_TIMEOUT = "sync_request_timeout"
CONF_ARSP_TIMEOUT = "async_response_timeout"
CONF_PREFER_ENDPOINT_1 = "prefer_endpoint_1"
CONF_AUTO_RECONNECT_RETRY_DELAY = "auto_reconnect_retry_delay"
CONF_CONNECT_RTS_STATES = "connect_rts_pin_states"
CONF_CONNECT_DTR_STATES = "connect_dtr_pin_states"
Expand All @@ -113,6 +114,7 @@ def validator(value: typing.Any) -> None:
CONF_AUTO_RECONNECT_RETRY_DELAY, default=5
): VolPositiveNumber,
vol.Optional(CONF_SKIP_BOOTLOADER, default=True): cv_boolean,
vol.Optional(CONF_PREFER_ENDPOINT_1, default=True): cv_boolean,
vol.Optional(CONF_LED_MODE, default=LEDMode.OFF): vol.Any(
None, EnumValue(LEDMode, transformer=bool_to_upper_str)
),
Expand Down
5 changes: 4 additions & 1 deletion zigpy_znp/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,10 @@ def _find_endpoint(self, dst_ep: int, profile: int, cluster: int) -> int:
return ZDO_ENDPOINT

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

# Always fall back to endpoint 1
Expand Down

0 comments on commit 4512ccf

Please sign in to comment.