Skip to content

Commit

Permalink
0.20.3 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminiuga authored Sep 28, 2020
2 parents 2aaeb73 + 9209151 commit 8a8e06c
Show file tree
Hide file tree
Showing 40 changed files with 458 additions and 504 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
rev: 3.8.3
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
- repo: https://github.com/PyCQA/isort
rev: 5.5.2
hooks:
- id: isort
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ bellows interacts with the Zigbee Network Coprocessor (NCP) with EmberZNet PRO Z

EmberZNet based Zigbee radios using the EZSP protocol (via the [bellows](https://github.com/zigpy/bellows) library for zigpy)
- [ITEAD Sonoff ZBBridge](https://www.itead.cc/smart-home/sonoff-zbbridge.html) (Note! This first have to be flashed with [Tasmota firmware and EmberZNet firmware](https://www.digiblur.com/2020/07/how-to-use-sonoff-zigbee-bridge-with.html))
- [Nortek GoControl QuickStick Combo Model HUSBZB-1 (Z-Wave & Zigbee USB Adapter)](https://www.nortekcontrol.com/products/2gig/husbzb-1-gocontrol-quickstick-combo/)
- [Elelabs Zigbee USB Adapter](https://elelabs.com/products/elelabs_usb_adapter.html)
- [Elelabs Zigbee Raspberry Pi Shield](https://elelabs.com/products/elelabs_zigbee_shield.html)
- [Nortek GoControl QuickStick Combo Model HUSBZB-1 (Z-Wave & Zigbee Ember 3581 USB Adapter)](https://www.nortekcontrol.com/products/2gig/husbzb-1-gocontrol-quickstick-combo/) (Note! Not a must but recommend [upgrade the EmberZNet NCP application firmware](https://github.com/walthowd/husbzb-firmware))
- [Elelabs Zigbee USB Adapter](https://elelabs.com/products/elelabs_usb_adapter.html) (Note! Not a must but recommend [upgrade the EmberZNet NCP application firmware](https://github.com/Elelabs/elelabs-zigbee-ezsp-utility))
- [Elelabs Zigbee Raspberry Pi Shield](https://elelabs.com/products/elelabs_zigbee_shield.html) (Note! Not a must but recommend [upgrade the EmberZNet NCP application firmware](https://github.com/Elelabs/elelabs-zigbee-ezsp-utility))
- Telegesis ETRX357USB (Note! This first have to be flashed with other EmberZNet firmware)
- Telegesis ETRX357USB-LRS (Note! This first have to be flashed with other EmberZNet firmware)
- Telegesis ETRX357USB-LRS+8M (Note! This first have to be flashed with other EmberZNet firmware)
Expand All @@ -30,6 +30,14 @@ Silabs did use to provide two main NCP images pre-build with firmware for EM35x,

Silicon Labs no longer provide pre-build firmware images, so now you have to build and compile firmware with their Simplicity Studio SDK for EmberZNet PRO Zigbee Protocol Stack Software. Simplicity Studio is a free download but building and compiling EmberZNet PRO Zigbee firmware images required that you have the serialnumber of an official Zigbee devkit registered to your Silicon Labs user account.

### EmberZNet and EZSP Protocol Version

Silicon Labs do not currently have a consolidated list of changes by EmberZNet SDK or EZSP protocol version. The EZSP additions, changes and deletions have only ever been listed in the "Zigbee EmberZNet Release Notes" (EmberZNet SDK) under the "New items" section as well as the matching UG100 EZSP Reference Guide included with each EmberZNet SDK release.

The largest change was between EZSP v4 (first added in EmberZNet 4.7.2 SDK) and EZSP v5 that was added in EmberZNet 5.9.0 SDK which requires the Legacy Frame ID 0xFF. The change from EZSP v5 to EZSP v6 was done in EmberZNet 6.0.0 SDK. The change from EZSP v6 to EZSP v7 was in EmberZNet 6.4.0 SDK. EmberZNet 6.7.0 SDK added EZSP v8 (and Secure EZSP Protocol Version 2).

Perhaps more important to know today is that EZSP v5, v6 and v7 (EmberZNet 6.6.x.x) use the same framing format, but EmberZNet 6.7.x.x/EZSP v8 introduced new framing format and expanded command id field from 8 bits to 16 bits.

## Project status

This project is in early stages, so it is likely that APIs will change.
Expand Down
2 changes: 1 addition & 1 deletion bellows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAJOR_VERSION = 0
MINOR_VERSION = 20
PATCH_VERSION = "2"
PATCH_VERSION = "3"
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
9 changes: 5 additions & 4 deletions bellows/cli/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
import asyncio
import binascii

import bellows.config
import bellows.ezsp
import bellows.types as t
import bellows.zigbee.application
import click
import zigpy.config
import zigpy.endpoint
import zigpy.exceptions

import bellows.config
import bellows.ezsp
import bellows.types as t
import bellows.zigbee.application

from . import opts, util
from .main import main

Expand Down
3 changes: 2 additions & 1 deletion bellows/cli/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import logging
import os

import bellows.types as t
import click
import voluptuous as vol
from zigpy.config.validators import cv_hex, cv_key
import zigpy.types
import zigpy.zdo.types

import bellows.types as t

from . import util
from .main import main

Expand Down
3 changes: 2 additions & 1 deletion bellows/cli/ncp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import bellows.types as t
import click

import bellows.types as t

from . import util
from .main import main

Expand Down
3 changes: 2 additions & 1 deletion bellows/cli/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import logging
import math

import click

import bellows.types as t
import bellows.zigbee.util as zutil
import click

from . import opts, util
from .main import main
Expand Down
5 changes: 3 additions & 2 deletions bellows/cli/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import functools
import logging

import click
import zigpy.config as zigpy_conf

import bellows.config as config
import bellows.ezsp
import bellows.types as t
import click
import zigpy.config as zigpy_conf

LOGGER = logging.getLogger(__name__)

Expand Down
5 changes: 3 additions & 2 deletions bellows/ezsp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import logging
from typing import Any, Awaitable, Callable, Dict, Tuple

import serial
from zigpy.typing import DeviceType

from bellows.config import (
CONF_DEVICE,
CONF_DEVICE_PATH,
Expand All @@ -14,8 +17,6 @@
from bellows.exception import APIException, EzspError
import bellows.types as t
import bellows.uart
import serial
from zigpy.typing import DeviceType

from . import v4, v5, v6, v7, v8

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v4/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import logging
from typing import Tuple

import bellows.config
import voluptuous

import bellows.config

from . import commands, config, types as v4_types
from .. import protocol

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v4/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import voluptuous as vol

from bellows.config import cv_uint16
import bellows.multicast
import voluptuous as vol

from . import types

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v5/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
import logging
from typing import Tuple

import bellows.config
import voluptuous

import bellows.config

from . import commands, config, types as v5_types
from ..v4 import EZSPv4

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v5/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from bellows.config import cv_uint16
import voluptuous as vol

from bellows.config import cv_uint16

from ..v4 import config as v4_config, types

_deletions = ("CONFIG_BROADCAST_ALARM_DATA_SIZE", "CONFIG_UNICAST_ALARM_DATA_SIZE")
Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v6/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""""EZSP Protocol version 6 protocol handler."""
import logging

import bellows.config
import voluptuous

import bellows.config

from . import commands, config, types as v6_types
from ..v5 import EZSPv5

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v6/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from bellows.config import cv_uint16
import voluptuous as vol

from bellows.config import cv_uint16

from ..v4.config import EZSP_POLICIES_SHARED
from ..v5 import config as v5_config
from .types import EzspConfigId, EzspPolicyId
Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v7/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
""""EZSP Protocol version 7 protocol handler."""
import logging

import bellows.config
import voluptuous

import bellows.config

from . import commands, config, types as v7_types
from ..v5 import EZSPv5

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v7/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import voluptuous as vol

from bellows.config import cv_uint16
import bellows.multicast
import voluptuous as vol

from ..v4.config import EZSP_POLICIES_SHARED
from .types import EmberZdoConfigurationFlags, EzspConfigId, EzspPolicyId
Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v8/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import logging
from typing import Tuple

import bellows.config
import voluptuous

import bellows.config

from . import commands, config, types as v8_types
from .. import protocol

Expand Down
3 changes: 2 additions & 1 deletion bellows/ezsp/v8/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import voluptuous as vol

from bellows.config import cv_uint16
import bellows.multicast
import voluptuous as vol

from ..v4.config import EZSP_POLICIES_SHARED
from .types import (
Expand Down
5 changes: 3 additions & 2 deletions bellows/uart.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import binascii
import logging

import serial
import serial_asyncio

from bellows.config import CONF_DEVICE_BAUDRATE, CONF_DEVICE_PATH
from bellows.thread import EventLoopThread, ThreadsafeProxy
import bellows.types as t
import serial
import serial_asyncio

LOGGER = logging.getLogger(__name__)
RESET_TIMEOUT = 5
Expand Down
31 changes: 15 additions & 16 deletions bellows/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
import os
from typing import Dict

from serial import SerialException
import zigpy.application
import zigpy.config
import zigpy.device
from zigpy.quirks import CustomDevice, CustomEndpoint
from zigpy.types import BroadcastAddress
import zigpy.util
import zigpy.zdo.types as zdo_t

from bellows.config import (
CONF_PARAM_SRC_RTG,
CONF_PARAM_UNK_DEV,
Expand All @@ -15,14 +24,6 @@
import bellows.multicast
import bellows.types as t
import bellows.zigbee.util
from serial import SerialException
import zigpy.application
import zigpy.config
import zigpy.device
from zigpy.quirks import CustomDevice, CustomEndpoint
from zigpy.types import BroadcastAddress
import zigpy.util
import zigpy.zdo.types as zdo_t

APS_ACK_TIMEOUT = 120
EZSP_DEFAULT_RADIUS = 0
Expand Down Expand Up @@ -539,16 +540,14 @@ async def permit_with_key(self, node, code, time_s=60):
if v[0] != t.EmberStatus.SUCCESS:
raise Exception("Failed to set link key")

v = await self._ezsp.setPolicy(
self._ezsp.types.EzspPolicyId.TC_KEY_REQUEST_POLICY,
self._ezsp.types.EzspDecisionId.GENERATE_NEW_TC_LINK_KEY,
)
if v[0] != t.EmberStatus.SUCCESS:
raise Exception(
"Failed to change policy to allow generation of new trust center keys"
if self._ezsp.ezsp_version >= 8:
mask_type = self._ezsp.types.EzspDecisionBitmask.ALLOW_JOINS
bitmask = mask_type.ALLOW_JOINS | mask_type.JOINS_USE_INSTALL_CODE_KEY
await self._ezsp.setPolicy(
self._ezsp.types.EzspPolicyId.TRUST_CENTER_POLICY, bitmask
)

return await self.permit(time_s)
return await super().permit(time_s)

def _handle_id_conflict(self, nwk: t.EmberNodeId) -> None:
LOGGER.warning("NWK conflict is reported for 0x%04x", nwk)
Expand Down
3 changes: 2 additions & 1 deletion bellows/zigbee/util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import os
from typing import Any, Dict

import bellows.types as t
import zigpy.config

import bellows.types as t


def zha_security(
config: Dict[str, Any], controller: bool = False, hashed_tclk: bool = True
Expand Down
16 changes: 2 additions & 14 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,9 @@ ignore =
D202

[isort]
# https://github.com/timothycrosley/isort
# https://github.com/timothycrosley/isort/wiki/isort-Settings
# splits long import on multiple lines indented by 4 spaces
multi_line_output = 3
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
line_length=88
indent = " "
# by default isort don't check module indexes
not_skip = __init__.py
profile = black
# will group `import x` and `from x import` of the same module.
force_sort_within_sections = true
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
known_first_party = homeassistant,tests
known_first_party = bellows,tests
forced_separate = tests
combine_as_imports = true
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Setup module for bellows"""

import bellows
from setuptools import find_packages, setup

import bellows

setup(
name="bellows",
version=bellows.__version__,
Expand All @@ -20,7 +21,7 @@
"pure_pcapy3==1.0.1",
"pyserial-asyncio",
"voluptuous",
"zigpy>=0.20.1a3",
"zigpy>=0.21.0",
],
dependency_links=["https://codeload.github.com/rcloran/pure-pcapy-3/zip/master"],
tests_require=["asynctest", "pytest", "pytest-asyncio"],
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests modules."""
9 changes: 9 additions & 0 deletions tests/async_mock.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Mock utilities that are async aware."""
import sys

if sys.version_info[:2] < (3, 8):
from asynctest.mock import * # noqa

AsyncMock = CoroutineMock # noqa: F405
else:
from unittest.mock import * # noqa
Loading

0 comments on commit 8a8e06c

Please sign in to comment.