Skip to content

Commit

Permalink
0.6.0 Release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminiuga committed Oct 16, 2019
2 parents 9262c17 + c5d9491 commit 2a1a16d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
author_email="rcloran@gmail.com",
license="GPL-3.0",
packages=find_packages(exclude=["*.tests"]),
install_requires=["pyserial-asyncio", "zigpy-homeassistant >= 0.9.0"],
install_requires=["pyserial-asyncio", "zigpy-homeassistant >= 0.10.0"],
tests_require=["pytest"],
)
6 changes: 3 additions & 3 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def test_rx_unknown_device(app, device):
app.devices[dev.ieee] = dev
app.get_device = mock.MagicMock(side_effect=[KeyError, dev])
app.handle_rx(
b"\x01\x02\x03\x04\x05\x06\x07\x08",
b"\x08\x07\x06\x05\x04\x03\x02\x01",
0x3334,
mock.sentinel.src_ep,
mock.sentinel.dst_ep,
Expand Down Expand Up @@ -300,8 +300,8 @@ async def _at_command_mock(cmd, *args):
"NJ": mock.sentinel.at_nj,
"OI": mock.sentinel.at_oi,
"OP": mock.sentinel.at_op,
"SH": 0x01020304,
"SL": 0x05060708,
"SH": 0x08070605,
"SL": 0x04030201,
"ZS": zs,
}.get(cmd, None)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ def test_deserialize():
assert rest == extra
assert result[0] == 0xFF
assert result[1] == -2
assert result[2] == t.EUI64((0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37))
assert result[2] == t.EUI64((0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30))


def test_serialize():
data = [0xFF, -2, t.EUI64([t.uint8_t(i) for i in range(0x30, 0x38)])]
schema = (t.uint8_t, t.int16s, t.EUI64)
result = t.serialize(data, schema)

assert result == b"\xff\xff\xfe01234567"
assert result == b"\xff\xff\xfe76543210"


def test_bytes_serialize():
Expand Down
2 changes: 1 addition & 1 deletion zigpy_xbee/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAJOR_VERSION = 0
MINOR_VERSION = 5
MINOR_VERSION = 6
PATCH_VERSION = "0"
__short_version__ = "{}.{}".format(MAJOR_VERSION, MINOR_VERSION)
__version__ = "{}.{}".format(__short_version__, PATCH_VERSION)
2 changes: 1 addition & 1 deletion zigpy_xbee/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def deserialize(cls, data):

def serialize(self):
assert self._length == len(self)
return b"".join([i.serialize() for i in self])
return super().serialize()[::-1]


class UndefinedEnumMeta(enum.EnumMeta):
Expand Down
12 changes: 7 additions & 5 deletions zigpy_xbee/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from zigpy.zcl.clusters.general import Groups
from zigpy.zdo.types import NodeDescriptor, ZDOCmd

from zigpy_xbee.types import TXStatus, UNKNOWN_IEEE, UNKNOWN_NWK
from zigpy_xbee.types import EUI64, TXStatus, UNKNOWN_IEEE, UNKNOWN_NWK


# how long coordinator would hold message for an end device in 10ms units
Expand Down Expand Up @@ -54,8 +54,10 @@ async def startup(self, auto_form=False):

serial_high = await self._api._at_command("SH")
serial_low = await self._api._at_command("SL")
as_bytes = serial_high.to_bytes(4, "big") + serial_low.to_bytes(4, "big")
self._ieee = zigpy.types.EUI64([zigpy.types.uint8_t(b) for b in as_bytes])
ieee = EUI64.deserialize(
serial_high.to_bytes(4, "big") + serial_low.to_bytes(4, "big")
)[0]
self._ieee = zigpy.types.EUI64(ieee)
LOGGER.debug("Read local IEEE address as %s", self._ieee)

association_state = await self._get_association_state()
Expand Down Expand Up @@ -277,10 +279,10 @@ async def broadcast(

LOGGER.debug("Broadcast request seq %s", sequence)
broadcast_as_bytes = [
zigpy.types.uint8_t(b) for b in broadcast_address.to_bytes(8, "big")
zigpy.types.uint8_t(b) for b in broadcast_address.to_bytes(8, "little")
]
request = self._api.tx_explicit(
zigpy.types.EUI64(broadcast_as_bytes),
EUI64(broadcast_as_bytes),
broadcast_address,
src_ep,
dst_ep,
Expand Down

0 comments on commit 2a1a16d

Please sign in to comment.