-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #464 from puddly/rc
0.31.0 Release
- Loading branch information
Showing
33 changed files
with
4,042 additions
and
249 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,4 +70,8 @@ ENV/ | |
.*.swp | ||
|
||
# Visual Studio Code | ||
.vscode | ||
.vscode | ||
|
||
|
||
# macOS | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
MAJOR_VERSION = 0 | ||
MINOR_VERSION = 30 | ||
MINOR_VERSION = 31 | ||
PATCH_VERSION = "0" | ||
__short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" | ||
__version__ = f"{__short_version__}.{PATCH_VERSION}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""""EZSP Protocol version 8 protocol handler.""" | ||
import asyncio | ||
import logging | ||
from typing import Tuple | ||
|
||
import voluptuous | ||
|
||
import bellows.config | ||
|
||
from . import commands, config, types as v9_types | ||
from .. import protocol | ||
|
||
EZSP_VERSION = 9 | ||
LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class EZSPv9(protocol.ProtocolHandler): | ||
"""EZSP Version 8 Protocol version handler.""" | ||
|
||
COMMANDS = commands.COMMANDS | ||
SCHEMAS = { | ||
bellows.config.CONF_EZSP_CONFIG: voluptuous.Schema(config.EZSP_SCHEMA), | ||
bellows.config.CONF_EZSP_POLICIES: voluptuous.Schema(config.EZSP_POLICIES_SCH), | ||
} | ||
types = v9_types | ||
|
||
def _ezsp_frame_tx(self, name: str) -> bytes: | ||
"""Serialize the frame id.""" | ||
cmd_id = self.COMMANDS[name][0] | ||
hdr = [self._seq, 0x00, 0x01] | ||
return bytes(hdr) + self.types.uint16_t(cmd_id).serialize() | ||
|
||
def _ezsp_frame_rx(self, data: bytes) -> Tuple[int, int, bytes]: | ||
"""Handler for received data frame.""" | ||
seq, data = data[0], data[3:] | ||
frame_id, data = self.types.uint16_t.deserialize(data) | ||
|
||
return seq, frame_id, data | ||
|
||
async def pre_permit(self, time_s: int) -> None: | ||
"""Temporarily change TC policy while allowing new joins.""" | ||
wild_card_ieee = v9_types.EmberEUI64([0xFF] * 8) | ||
tc_link_key = v9_types.EmberKeyData(b"ZigBeeAlliance09") | ||
await self.addTransientLinkKey(wild_card_ieee, tc_link_key) | ||
await self.setPolicy( | ||
v9_types.EzspPolicyId.TRUST_CENTER_POLICY, | ||
v9_types.EzspDecisionBitmask.ALLOW_JOINS | ||
| v9_types.EzspDecisionBitmask.ALLOW_UNSECURED_REJOINS, | ||
) | ||
await asyncio.sleep(time_s + 2) | ||
await self.setPolicy( | ||
v9_types.EzspPolicyId.TRUST_CENTER_POLICY, | ||
self.tc_policy, | ||
) | ||
|
||
async def set_source_routing(self) -> None: | ||
"""Enable source routing on NCP.""" | ||
await self.setSourceRouteDiscoveryMode(1) |
Oops, something went wrong.