Skip to content

Commit

Permalink
Hide firmware-level manual source routing behind manual_source_routing
Browse files Browse the repository at this point in the history
  • Loading branch information
puddly committed Jun 5, 2024
1 parent a24c84e commit 55690bd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 9 additions & 0 deletions bellows/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
cv_boolean,
)

CONF_BELLOWS_CONFIG = "bellows_config"
CONF_MANUAL_SOURCE_ROUTING = "manual_source_routing"

CONF_USE_THREAD = "use_thread"
CONF_EZSP_CONFIG = "ezsp_config"
CONF_EZSP_POLICIES = "ezsp_policies"
Expand All @@ -31,6 +34,12 @@
{vol.Optional(str): int}
),
vol.Optional(CONF_USE_THREAD, default=True): cv_boolean,
# The above config really should belong in here
vol.Optional(CONF_BELLOWS_CONFIG, default={}): vol.Schema(
{
vol.Optional(CONF_MANUAL_SOURCE_ROUTING, default=False): bool,
}
),
}
)

Expand Down
7 changes: 6 additions & 1 deletion bellows/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@

import bellows
from bellows.config import (
CONF_BELLOWS_CONFIG,
CONF_EZSP_CONFIG,
CONF_EZSP_POLICIES,
CONF_MANUAL_SOURCE_ROUTING,
CONF_USE_THREAD,
CONFIG_SCHEMA,
)
Expand Down Expand Up @@ -781,7 +783,10 @@ async def _reset_mfg_id(self, mfg_id: int) -> None:
async def _set_source_route(
self, nwk: zigpy.types.NWK, relays: list[zigpy.types.NWK]
) -> bool:
if FirmwareFeatures.MANUAL_SOURCE_ROUTE in self._ezsp._xncp_features:
if (
FirmwareFeatures.MANUAL_SOURCE_ROUTE in self._ezsp._xncp_features
and self.config[CONF_BELLOWS_CONFIG][CONF_MANUAL_SOURCE_ROUTING]
):
await self._ezsp.xncp_set_manual_source_route(nwk, relays)
return True
else:
Expand Down

0 comments on commit 55690bd

Please sign in to comment.