How to use the zigpy.types.EUI64 function in zigpy

To help you get started, we’ve selected a few zigpy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zigpy / zigpy / tests / test_application.py View on Github external
async def test_permit(app, ieee):
    ncp_ieee = t.EUI64(map(t.uint8_t, range(8, 16)))
    app._ieee = ncp_ieee
    app.devices[ieee] = mock.MagicMock()
    app.devices[ieee].zdo.permit = mock.MagicMock(
        side_effect=asyncio.coroutine(mock.MagicMock())
    )
    app.permit_ncp = mock.MagicMock(side_effect=asyncio.coroutine(mock.MagicMock()))
    await app.permit(node=(1, 1, 1, 1, 1, 1, 1, 1))
    assert app.devices[ieee].zdo.permit.call_count == 0
    assert app.permit_ncp.call_count == 0
    await app.permit(node=ieee)
    assert app.devices[ieee].zdo.permit.call_count == 1
    assert app.permit_ncp.call_count == 0
    await app.permit(node=ncp_ieee)
    assert app.devices[ieee].zdo.permit.call_count == 1
    assert app.permit_ncp.call_count == 1
github zigpy / zigpy / tests / test_appdb.py View on Github external
def make_ieee(init=0):
    return t.EUI64(map(t.uint8_t, range(init, init + 8)))
github zigpy / zigpy / tests / test_device.py View on Github external
def dev(monkeypatch, app):
    monkeypatch.setattr(device, "APS_REPLY_TIMEOUT_EXTENDED", 0.1)
    ieee = t.EUI64(map(t.uint8_t, [0, 1, 2, 3, 4, 5, 6, 7]))
    return device.Device(app, ieee, 65535)
github zigpy / zigpy / tests / test_group.py View on Github external
def endpoint():
    app_mock = mock.MagicMock(spec_set=ControllerApplication)
    ieee = t.EUI64(map(t.uint8_t, [0, 1, 2, 3, 4, 5, 6, 7]))
    dev = zigpy.device.Device(app_mock, ieee, 65535)
    return zigpy.endpoint.Endpoint(dev, 3)
github zigpy / zigpy / tests / test_zdo_types.py View on Github external
def test_multi_address_3():
    ma = types.MultiAddress()
    ma.addrmode = 3
    ma.ieee = t.EUI64(map(t.uint8_t, [0, 1, 2, 3, 4, 5, 6, 7]))
    ma.endpoint = 1
    ser = ma.serialize()

    ma2, data = types.MultiAddress.deserialize(ser)
    assert data == b""
    assert ma2.addrmode == ma.addrmode
    assert ma2.ieee == ma.ieee
    assert ma2.endpoint == ma.endpoint
github zigpy / zigpy / zigpy / application.py View on Github external
def handle_join(self, nwk, ieee, parent_nwk):
        ieee = t.EUI64(ieee)
        LOGGER.info("Device 0x%04x (%s) joined the network", nwk, ieee)
        if ieee in self.devices:
            dev = self.get_device(ieee)
            if dev.nwk != nwk:
                LOGGER.debug(
                    "Device %s changed id (0x%04x => 0x%04x)", ieee, dev.nwk, nwk
                )
                dev.nwk = nwk
                dev.schedule_group_membership_scan()
            elif dev.initializing or dev.status == zigpy.device.Status.ENDPOINTS_INIT:
                LOGGER.debug("Skip initialization for existing device %s", ieee)
                dev.schedule_group_membership_scan()
                return
        else:
            dev = self.add_device(ieee, nwk)
github zigpy / zigpy / zigpy / zcl / clusters / general.py View on Github external
t.Optional(t.uint16_t),
            ),
            False,
        ),
        0x0004: (
            "image_page",
            (
                t.uint8_t,
                t.uint16_t,
                t.uint16_t,
                t.uint32_t,
                t.uint32_t,
                t.uint8_t,
                t.uint16_t,
                t.uint16_t,
                t.Optional(t.EUI64),
            ),
            False,
        ),
        0x0006: (
            "upgrade_end",
            (foundation.Status, t.uint16_t, t.uint16_t, t.uint32_t),
            False,
        ),
        0x0008: (
            "query_specific_file",
            (t.EUI64, t.uint16_t, t.uint16_t, t.uint32_t, t.uint16_t),
            False,
        ),
    }
    client_commands = {
        0x0000: (
github zigpy / bellows / bellows / types / named.py View on Github external
import enum

import zigpy.types as ztypes

from . import basic

EmberEUI64 = ztypes.EUI64


class NcpResetCode(basic.uint8_t, enum.Enum):
    # Reset and Error Codes for NCP
    RESET_UNKNOWN_REASON = 0x00
    RESET_EXTERNAL = 0x01
    RESET_POWER_ON = 0x02
    RESET_WATCHDOG = 0x03
    RESET_ASSERT = 0x06
    RESET_BOOTLOADER = 0x09
    RESET_SOFTWARE = 0x0B
    ERROR_EXCEEDED_MAXIMUM_ACK_TIMEOUT_COUNT = 0x51
    ERROR_UNKNOWN_EM3XX_ERROR = 0x80


class EmberRf4ceTxOption(basic.uint8_t):