Giter Site home page Giter Site logo

zsmartsystems / com.zsmartsystems.zigbee Goto Github PK

View Code? Open in Web Editor NEW
134.0 18.0 87.0 29.82 MB

ZigBee Cluster Library Java framework supporting multiple dongles

License: Eclipse Public License 1.0

Java 100.00%
zigbee ezsp-protocol telegesis dongle silabs zigbee-dongles xbee android osgi ember ezsp zcl zigbee-framework ncp zigbee-cluster-library java zigbee4java

com.zsmartsystems.zigbee's Introduction

Travis Build Status Maven Central CLA Assistant Badge Total alerts

Overview

This project aims to provide a ZigBee compatible framework written in Java and compatible with Android. It provides a ZigBee Cluster Library implementation, and network management functions, aiming to provide a full featured ZigBee framework that can be implemented within end systems. This repository aims to provide a high quality framework, with quality documentation and a thorough set of test cases to ensure against regression.

Packages are broken down to provide the main ZigBee framework, separate packages for dongles, and a console application that allows full use of the framework. The bundles include OSGi headers for use within an OSGi framework.

Minimum Android support is currently API19, Android 4.4 (KitKat). It is highly recommended to move to Android 8 as this may become the minimum requirement in the future to allow the framework to use the newer classes available from API26. Note that more modern language features are incorporated into the library and this may require Android users to use a modern version of Android Studio.

Features

Features include -:

  • ZigBee Cluster Library
  • Over-The-Air firmware upgrade
  • Device information data store

ZigBee Cluster Library

The framework includes a ZigBee Cluster Library that is auto-generated from an XML definition file.

The following clusters are currently supported -:

ID Cluster Description
0000 BASIC This cluster supports an interface to the node or physical device. It provides attributes and commands for determining basic information, setting user information such as location, and resetting to factory defaults.
0001 POWER_CONFIGURATION Attributes for determining detailed information about a device’s power source(s), and for configuring under/over voltage alarms.
0003 IDENTIFY Attributes and commands to put a device into an Identification mode (e.g. flashing a light), that indicates to an observer – e.g. an installer - which of several devices it is, also to request any device that is identifying itself to respond to the initiator.
0004 GROUPS The ZigBee specification provides the capability for group addressing. That is, any endpoint on any device may be assigned to one or more groups, each labeled with a 16-bit identifier (0x0001 – 0xfff7), which acts for all intents and purposes like a network address. Once a group is established, frames, sent using the APSDE-DATA.request primitive and having a DstAddrMode of 0x01, denoting group addressing, will be delivered to every endpoint assigned to the group address named in the DstAddr parameter of the outgoing APSDE-DATA.request primitive on every device in the network for which there are such endpoints.
0005 SCENES The scenes cluster provides attributes and commands for setting up and recalling scenes. Each scene corresponds to a set of stored values of specified attributes for one or more clusters on the same end point as the scenes cluster.
0006 ON_OFF Attributes and commands for switching devices between ‘On’ and ‘Off’ states.
0007 ON_OFF_SWITCH_CONFIGURATION Attributes and commands for configuring On/Off switching devices
0008 LEVEL_CONTROL This cluster provides an interface for controlling a characteristic of a device that can be set to a level, for example the brightness of a light, the degree of closure of a door, or the power output of a heater.
0009 ALARMS Attributes and commands for sending alarm notifications and configuring alarm functionality.
000A TIME This cluster provides a basic interface to a real-time clock. The clock time MAY be read and also written, in order to synchronize the clock (as close as practical) to a time standard. This time standard is the number of seconds since 0 hrs 0 mins 0 sec on 1st January 2000 UTC (Universal Coordinated Time).
000B RSSI_LOCATION This cluster provides a means for exchanging Received Signal Strength Indication (RSSI) information among one hop devices as well as messages to report RSSI data to a centralized device that collects all the RSSI data in the network.
000C ANALOG_INPUT_BASIC The Analog Input (Basic) cluster provides an interface for reading the value of an analog measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures an analog physical quantity.
000F BINARY_INPUT_BASIC The Binary Input (Basic) cluster provides an interface for reading the value of a binary measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures a two-state physical quantity.
0012 MULTISTATE_INPUT_BASIC The Multistate Input (Basic) cluster provides an interface for reading the value of a multistate measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures a physical quantity that can take on one of a number of discrete states.
0013 MULTISTATE_OUTPUT_BASIC The Multistate Output (Basic) cluster provides an interface for setting the value of an output that can take one of a number of discrete values, and accessing characteristics of that value.
0014 MULTISTATE_VALUE_BASIC The Multistate Value (Basic) cluster provides an interface for setting a multistate value, typically used as a control system parameter, and accessing characteristics of that value.
0015 COMMISSIONING This cluster provides attributes and commands pertaining to the commissioning and management of ZigBee devices operating in a network.
0019 OTA_UPGRADE The cluster provides a standard way to upgrade devices in the network via OTA messages. Thus the upgrade process MAY be performed between two devices from different manufacturers. Devices are required to have application bootloader and additional memory space in order to successfully implement the cluster.
0020 POLL_CONTROL This cluster provides a mechanism for the management of an end device’s MAC Data Request rate. For the purposes of this cluster, the term “poll” always refers to the sending of a MAC Data Request from the end device to the end device’s parent. This cluster can be used for instance by a configuration device to make an end device responsive for a certain period of time so that the device can be managed by the controller. This cluster is composed of a client and server. The end device implements the server side of this cluster. The server side contains several attributes related to the MAC Data Request rate for the device. The client side implements commands used to manage the poll rate for the device. The end device which implements the server side of this cluster sends a query to the client on a predetermined interval to see if the client would like to manage the poll period of the end device in question. When the client side of the cluster hears from the server it has the opportunity to respond with configuration data to either put the end device in a short poll mode or let the end device continue to function normally.
0021 GREEN_POWER The Green Power cluster defines the format of the commands exchanged when handling GPDs.
0101 DOOR_LOCK The door lock cluster provides an interface to a generic way to secure a door. The physical object that provides the locking functionality is abstracted from the cluster. The cluster has a small list of mandatory attributes and functions and a list of optional features.
0102 WINDOW_COVERING Provides an interface for controlling and adjusting automatic window coverings.
0201 THERMOSTAT This cluster provides an interface to the functionality of a thermostat.
0202 FAN_CONTROL This cluster specifies an interface to control the speed of a fan as part of a heating / cooling system.
0203 DEHUMIDIFICATION_CONTROL This cluster provides an interface to dehumidification functionality.
0204 THERMOSTAT_USER_INTERFACE_CONFIGURATION This cluster provides an interface to allow configuration of the user interface for a thermostat, or a thermostat controller device, that supports a keypad and LCD screen.
0300 COLOR_CONTROL This cluster provides an interface for changing the color of a light. Color is specified according to the Commission Internationale de l'Éclairage (CIE) specification CIE 1931 Color Space. Color control is carried out in terms of x,y values, as defined by this specification.
0400 ILLUMINANCE_MEASUREMENT The cluster provides an interface to illuminance measurement functionality, including configuration and provision of notifications of illuminance measurements.
0401 ILLUMINANCE_LEVEL_SENSING The cluster provides an interface to illuminance level sensing functionality, including configuration and provision of notifications of whether the illuminance is within, above or below a target band.
0402 TEMPERATURE_MEASUREMENT The server cluster provides an interface to temperature measurement functionality, including configuration and provision of notifications of temperature measurements.
0403 PRESSURE_MEASUREMENT The cluster provides an interface to pressure measurement functionality, including configuration and provision of notifications of pressure measurements.
0404 FLOW_MEASUREMENT The server cluster provides an interface to flow measurement functionality, including configuration and provision of notifications of flow measurements.
0405 RELATIVE_HUMIDITY_MEASUREMENT The server cluster provides an interface to relative humidity measurement functionality, including configuration and provision of notifications of relative humidity measurements.
0406 OCCUPANCY_SENSING The cluster provides an interface to occupancy sensing functionality, including configuration and provision of notifications of occupancy status.
0407 LEAF_WETNESS_MEASUREMENT The server cluster provides an interface to read the percentage of water on the leaves of plants.
0408 SOIL_MOISTURE_MEASUREMENT The server cluster provides an interface to soil moisture measurement functionality, including configuration and provision of notifications of soil moisture measurements.
0500 IAS_ZONE The IAS Zone cluster defines an interface to the functionality of an IAS security zone device. IAS Zone supports up to two alarm types per zone, low battery reports and supervision of the IAS network.
0501 IAS_ACE The IAS ACE cluster defines an interface to the functionality of any Ancillary Control Equipment of the IAS system. Using this cluster, a ZigBee enabled ACE device can access a IAS CIE device and manipulate the IAS system, on behalf of a level-2 user.
0502 IAS_WD The IAS WD cluster provides an interface to the functionality of any Warning Device equipment of the IAS system. Using this cluster, a ZigBee enabled CIE device can access a ZigBee enabled IAS WD device and issue alarm warning indications (siren, strobe lighting, etc.) when a system alarm condition is detected.
0700 PRICE The Price Cluster provides the mechanism for communicating Gas, Energy, or Water pricing information within the premises. This pricing information is distributed to the ESI from either the utilities or from regional energy providers. The ESI conveys the information (via the Price Cluster mechanisms) to other Smart Energy devices.
0701 DEMAND_RESPONSE_AND_LOAD_CONTROL This cluster provides an interface to the functionality of Smart Energy Demand Response and Load Control. Devices targeted by this cluster include thermostats and devices that support load control.
0702 METERING The Metering Cluster provides a mechanism to retrieve usage information from Electric, Gas, Water, and potentially Thermal metering devices. These devices can operate on either battery or mains power, and can have a wide variety of sophistication. The Metering Cluster is designed to provide flexibility while limiting capabilities to a set number of metered information types. More advanced forms or data sets from metering devices will be supported in the Smart Energy Tunneling Cluster
0703 MESSAGING This cluster provides an interface for passing text messages between ZigBee devices. Messages are expected to be delivered via the ESI and then unicast to all individually registered devices implementing the Messaging Cluster on the ZigBee network, or just made available to all devices for later pickup. Nested and overlapping messages are not allowed. The current active message will be replaced if a new message is received by the ESI.
0704 SMART_ENERGY_TUNNELING The tunneling cluster provides an interface for tunneling protocols. It is comprised of commands and attributes required to transport any existing metering communication protocol within the payload of standard ZigBee frames (including the handling of issues such as addressing, fragmentation and flow control). Examples for such protocols are DLMS/COSEM, IEC61107, ANSI C12, M-Bus, ClimateTalk etc.
0705 PREPAYMENT The Prepayment Cluster provides the facility to pass messages relating to the accounting functionality of a meter between devices on the HAN. It allows for the implementation of a system conforming to the set of standards relating to Payment Electricity Meters (IEC 62055) and also for the case where the accounting function is remote from the meter. Prepayment is used in situations where the supply of a service may be interrupted or enabled under the control of the meter or system in relation to a payment tariff. The accounting process may be within the meter or elsewhere in the system. The amount of available credit is decremented as the service is consumed and is incremented through payments made by the consumer. Such a system allows the consumer to better manage their energy consumption and reduces the risk of bad debt owing to the supplier.
0800 KEY_ESTABLISHMENT This cluster provides attributes and commands to perform mutual authentication and establish keys between two ZigBee devices.
0B01 METER_IDENTIFICATION This cluster provides attributes and commands for determining advanced information about utility metering device.
0B04 ELECTRICAL_MEASUREMENT This cluster provides a mechanism for querying data about the electrical properties as measured by the device. This cluster may be implemented on any device type and be implemented on a per-endpoint basis. For example, a power strip device could represent each outlet on a different endpoint and report electrical information for each individual outlet. The only caveat is that if you implement an attribute that has an associated multiplier and divisor, then you must implement the associated multiplier and divisor attributes. For example if you implement DCVoltage, you must also implement DCVoltageMultiplier and DCVoltageDivisor.
0B05 DIAGNOSTICS The diagnostics cluster provides access to information regarding the operation of the ZigBee stack over time. This information is useful to installers and other network administrators who wish to know how a particular device is functioning on the network.

Packages

The framework implements a package structure that allows efficient use of re-usable components in a number of different applications.

Package Description
com.zsmartsystems.zigbee The main framework and cluster library implementation
com.zsmartsystems.zigbee.autocode Code generator for the ZigBee cluster library classes
com.zsmartsystems.zigbee.dongle.cc2531 Dongle driver for the Texas Instruments ZNP CC2531
com.zsmartsystems.zigbee.dongle.conbee Dongle driver for the Dresden Electronics Conbee
com.zsmartsystems.zigbee.dongle.ember Dongle driver for the Silabs EZSP Network Co-Processor
com.zsmartsystems.zigbee.dongle.ember.autocode Code generator for the Ember NCP dongle commands
com.zsmartsystems.zigbee.dongle.telegesis Dongle driver for the Telegesis dongle
com.zsmartsystems.zigbee.dongle.telegesis.autocode Code generator for the Telegesis dongle commands
com.zsmartsystems.zigbee.dongle.xbee Dongle driver for the Digi XBee dongle
com.zsmartsystems.zigbee.dongle.xbee.autocode Code generator for the XBee dongle commands
com.zsmartsystems.zigbee.console Console commands for the general framework
com.zsmartsystems.zigbee.console.ember Console commands for the Silabs Ember NCP
com.zsmartsystems.zigbee.console.main Main CLI console application
com.zsmartsystems.zigbee.serial Serial driver implementation
com.zsmartsystems.zigbee.test Overall tests and code coverage

Testing

The framework incorporates a lot of unit testing, ensuring real data received from devices can be correctly decoded. When an error is detected following operation with real devices, a test case is normally added to reproduce the error and then it is fixed.

Logging

A log viewer to decode the logs and present them in a usable format is available here. This provides filtering of data at different levels and filtering by node address.

ZigBee Stack

The framework implements a ZigBee stack, currently employing a single endpoint. The default profile, device type and supported clusters can all be configured.

The supported clusters must be configured or the framework will not process any received frames. Likewise, the framework will not respond to messages sent to any endpoints other than endpoint 1.

To add support for local clusters, use the ZigBeeNetworkManager methods addSupportedClientCluster and addSupportedServerCluster. Note that any configuration required in the transport layer (dongle dependant) will also need to be configured consistently.

Dongles

Silicon Labs Ember EM35x / EFR32

The library supports the Silicon Labs EZSP (EmberZNet Serial Protocol) APIs for EM35x and EFR32 SoCs using ASH or SPI protocols over a serial interface. The implementation of the SPI protocol assumes that the SPI provides a TTY-like software interface to the application, or is otherwise abstracted via the ZigBeePort interface.

It is worth noting that EM3588 devices that have an embedded USB core will likely work with any baud rate, where dongles using external USB interface (eg CP2102 used with an EM3581) will likely require a specific baud rate.

Silabs did use to provide two main NCP images pre-build with firmware for EM35x, one image supported hardware flow control with a baud rate of 115200 and the other image supported software flow control with a rate of 57600.

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.

Ember NCP configuration

The library provide a standard set of configuration constants to configure the NCP for use as a coordinator. There are two methods available in the Ember driver to manipulate the configuration maps updateDefaultConfiguration and updateDefaultPolicy. The configuration is sent to the NCP during the initialisation sequence which is performed when calling the ZigBeeNetworkManager.initialize() method, so any changes to configuration must be performed prior to this.

The Ember dongle driver includes a public method getEmberNcp() which returns a EmberNcp class. This class provides high level methods for interacting directly with the NCP.

Ember Reset

By default the library uses the ASH Reset command to reset the NCP when the framework starts. Silabs have stated that this is not reliable due to possible communication problems between the NCP and the host. Where possible the user should implement a hardware reset to reset the NCP. Since this is application specific, the framework provides an interface for the application to implement this reset. The user should implement the EmberNcpResetProvider interface, and set this during NCP initialisation with the ZigBeeDongleEzsp.setEmberNcpResetProvider() method.

Ember MfgLib use

The library provides access to the mfglib functions in the NCP to facilitate device testing. To use this function, create the ZigBeeDongleEzsp and then call the getEmberMfglib(EmberMfglibListener) method to get the EmberMfglib class and also set the callback listener. The EmberMfglib class provides access to the mfglib functions.

Note that this can only be used if the dongle is not configured for use in the network (ie initialize has not been called).

The com.zsmartsystems.zigbee.sniffer project is an example of the use of these features to provide a network sniffer to route frames to Wireshark.

Texas Instruments CC2531

The library supports the Texas Instruments ZNP protocol over a serial interface.

Telegesis ETRX3

The library supports the Telegesis AT protocol over a serial interface. Currently implemented against R309C. Note that some dongles such as the Qivicon Funkstick may use PID/VID codes that require special drivers or they will not be detected as a serial port.

Under Linux you can add the Qivicon dongle without a custom made kernel with the following command -:

echo 10c4 89fb > /sys/bus/usb-serial/drivers/cp210x/new_id

ConBee / RaspBee

The library supports the Dresden Electronics RaspBee and ConBee dongles. Note that this requires some further work.

XBee

The XBee S2C XStick is supported.

Tested Hardware

The framework has been tested against many different devices - many lights, motion sensors, temperature/humidity/light sensors, plug sockets...

ZigBee Dongles and Chipsets

The following table provides a summary of some of the dongles / chipsets that are available on the market and their support within the library. Receive sensitivity and transmit power are the main parameters affecting RF performance - it should be noted that regulations may reduce transmit power in some areas of the world and other factors can also impact performance.

Model Support Receive Transmit Antenna
Xbee XU-Z11 Yes -90dBm +4.5dBm Internal
EM358 Yes (EZSP) -100dBm +8.0dBm Internal
EFR32 Yes (EZSP)
EM358LR Yes (EZSP) -103dBm +20.0dBm Internal
MGM111 Yes (EZSP) -99dBm +10.0dBm Internal
RaspBee Yes (CONBEE) -105dBm +8.7dBm Internal
ConBee Yes (CONBEE) -105dBm +8.7dBm Internal
CC2530 Yes (ZNP) -97dBm +4.5dBm
CC2531 Yes (ZNP) -97dBm +4.5dBm
CC2538 Yes (ZNP) -97dBm +7.0dBm
CC2650 Yes (ZNP) -100dBm +5.0dBm
ATSAMR21 No -99dBm +4.0dBm
JN5169 No -96dBm +10.0dBm
HUSBZB-1 Yes (EZSP) Internal
Telegesis ETRX3 Yes (Telegesis) Internal
Qivicon Funkstick Yes (Telegesis) Internal
  • Receive: Defines the typical receive performance. A lower number is best.
  • Transmit: Defines the maximum output power. A higher number is best.

Device Data-Store

The framework implements a data store to serialise device information to and from disk to ensure network information is persisted across restarts. This is implemented via the ZigBeeNetworkDataStore interface, and the implementation of this interface is set in the ZigBeeNetworkManager with the setNetworkDataStore(ZigBeeNetworkDataStore) method.

While optional, it is highly recommended that this data store be implemented as it will greatly enhance performance across system restarts.

Application Extensions

The framework includes optional functional applications to support higher layer functionality. Extensions implement the ZigBeeNetworkExtension interface and are registered with the network manager with the ZigBeeNetworkManager.addExtension() method. Extensions provide the top level network manager functionality and are normally augmented with lower level client/server functions associated with specific clusters. These client/server applications implement the ZigBeeApplication interface and are registered with the endpoint with the ZigBeeEndpoint.addApplication() method.

Currently implemented extensions include -:

  • Discovery Extension (ZigBeeDiscoveryExtension)
  • Network Mesh Monitor Extension (ZigBeeDiscoveryExtension)
  • IAS CIE client (ZigBeeIasCieExtension)
  • OTA Upgrade Server (ZigBeeOtaUpgradeExtension)
  • Basic Cluster Server (ZigBeeBasicServerExtension)

These provide basic functionality and can be extended as required to meet the application needs.

It should be noted that extensions to the framework should be performed by linking to the ZclCluster through the ZclCommandListener notifications. This ensures that processing of DefaultResponse commands is handled correctly as the framework will automatically handle sending of these responses if there is no response sent. Calls to the handleCommand method must return true if the method has sent a response, or false if no response is sent to ensure that the framework correctly handles the DefaultResponse notifications. If all handlers return a false response, then the framework will send a DefaultResponse with UNSUP_CLUSTER_COMMAND, UNSUP_GENERAL_COMMAND, UNSUP_MANUF_CLUSTER_COMMAND or UNSUP_MANUF_GENERAL_COMMAND, as appropriate.

Overview

Extensions may provide different levels of functionality - an extension may be as simple as configuring the framework to work with a specific feature, or could provide a detailed application.

An example of a simple extension is the ZigBeeOtaUpgradeExtension which simply listens for new devices on the network, and adds the ZclOtaUpgradeServer to the endpoint.

A more complex extension could for example handle the CIE IAS zones, providing a cross device implementation to coordinate the allocation of zones and handling of alarms.

The lifecycle of an extension is as follows -:

  • extensionInitialize is called when the extension is first registered
  • extensionStartup is called when the network is online and the extension may run operationally.
  • extensionShutdown is called when the extension is closed. The framework will do this when it is shutting down.

Extensions should normally register as a ZigBeeNetworkNodeListener to get notified when a node is discovered or removed from the network so that they can add support to the node. The extension will then register a client or server application with the endpoint. The client/server application may register for callbacks with the endpoint (or node).

Extension may want to register a supported cluster with the ZigBeeNetworkManager.addSupportedServerCluster() and ZigBeeNetworkManager.addSupportedClientCluster() methods so that the services provided are discoverable.

Client/Server implementations will normally be linked to a specific cluster and provide the application logic for the cluster. The client/server implementation class should be named with the same name as the cluster, but exchanging Cluster for Client or Server (eg a server supporting the ZclOtaUpgradeCluster would be named ZclOtaUpgradeServer).

Console Application

A console application is provided as part of the package. This application allows full use and testing of the framework. It can be used to test any new functionality without the added complexity of application level integration, or may be used as a stand-alone ZigBee configuration tool.

All commands implement the ZigBeeConsoleCommand interface, providing an easily extendible command system.

The command handlers used in the console application are in the package com.zsmartsystems.zigbee.console. This is separate from the main console application, and this allows the command handlers to be incorporated into other frameworks.

Command handlers for commands specific to each dongle implementation are in the package com.zsmartsystems.zigbee.console.abc (where abc is the name of the dongle). These commands allow access to non standard API relating solely to each dongle.

Command handlers take a set of arguments as provided by the user and will throw IllegalArgumentException if there are any errors with arguments, or IllegalStateException if there are any issues with the network state that prevent the command execution.

Starting the Console

The console application takes the following parameters -:

| Option | Description | | ---------------------------- | -------------------------------------------------------- | -------- | --------- | ------ | ----- | | -?,--help | Print usage information | | -a,--pan | Set the ZigBee PAN ID | | -b,--baud | Set the port baud rate | | -c,--channel | Set the ZigBee channel ID | | -d,--dongle | Set the dongle type to use (EMBER | CC2531 | TELEGESIS | CONBEE | XBEE) | | -e,--epan | Set the ZigBee EPAN ID | | -f,--flow | Set the flow control (NONE | HARDWARE | SOFTWARE) | | -h,--profile | Set the default profile ID | | -l,--linkkey | Set the ZigBee Link key (defaults to well known ZHA key) | | -n,--nwkkey | Set the ZigBee Network key (defaults to randon value) | | -o,--nwkkeyoutcnt | Set the ZigBee Network key outgoing frame counter | | -p,--port | Set the port | | -t,--linkkeyoutcnt | Set the ZigBee Link key outgoing frame counter | | -r,--reset | Reset the ZigBee dongle |

The -dongle and -port options are always required. Most dongles will also require -baud, and may require -flow, although this may be hard coded for dongles that do not have this option.

If -reset is used, you should normally also set the -channel, -pan, -epan and -nwkkey options. If not set, defaults will be used to allow the system to start, however these may be random and may not allow you to use a network sniffer or other tools where some of this information may be required. The -linkkey may also be set, but will default to the well known ZHA ZigBeeAlliance09 key if not set.

Decimal configuration values such as pan may be specified in decimal, or hexadecimal by prepending 0x to the value (eg 0x2000).

Example -:

-dongle EMBER -port /dev/tty.usbserial-FTD6C0AF -baud 115200 -flow software -channel 11 -pan 0x2000 -epan 987654321 -nwkkey AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -reset

Console Commands

Where an address is required, endpoints can use the format 123/1 (destination/endpoint), or in hexadecimal (0xed1/1). Group addresses can be subsituted by preceding the address with a # - eg #123 or #0xed1.

General Commands

Note that the console is currently being refactored and this readme only documents the commands that have been migrated. For a full list of commands, use the help command in the console.

Command Description
join Enable or disable network join
leave Remove a node from the network
nodelist Lists the known nodes in the network
node Provides detailed information about a node
endpoint Provides detailed information about an endpoint
info Get basic info about a device
identify Sends the identify command to an endpoint
fingerprint Get detailed information about a device
read Read an attribute
write Write an attribute
bind Binds a device to another device
unbind Unbinds a device from another device
bindtable Reads and displays the binding table from a node
attsupported Check what attributes are supported within a cluster
cmdsupported Check what commanda are supported within a cluster
subscribe Subscribe to attribute reports
unsubscribe Unsubscribe from attribute reports
reportcfg Read the reporting configuration of an attribute
otaupgrade Provides information about device Over The Air upgrade server status
installkey Adds an install key to the dongle
linkkey Sets the link key int the dongle, optionally computing the MMO Hash from the join code
netstart Join or Form a network as a router or coordinator
netbackup Backup or restores the state of the dongle
discovery Gets information on the network discovery tasks
routingtable Gets the routing table from a node
neighbours Gets the neighbour table from a node
on Turns a device on
off Turns a device off
level Sets the level on a level control device
color Sets the color on a color control device
covering Sets the level on a window covering device
group Configures multicast groups
scene Configures scenes
factoryreset Resets a node to factory defaults

Ember NCP Commands

The following commands are available if the transport layer is using the Silabs Ember NCP.

Command Description
ncpchildren Gets the NCP child information
ncpaddrtable Manages the NCP address table
ncpconfig Read or write an NCP configuration value
ncpscan Performs a scan, looking for other networks, or energy levels on each channel
ncpcounters Gets the NCP debug counters
ncpstate Gets the NCP network state and optionally brings the network up or down
ncpvalue Read or write an NCP memory value
ncpversion Gets the NCP firmware version
ncpsecuritystate Gets the current NCP security state and configuration
ncptransientkey Adds a transient link key to the NCP
ncpmmohash Uses the NCP to perform the MMO hash
ncprouting Prints the NCP routing tables and information
ncpmcast Read and configure NCP multicast group table
ncppolicy REad and write NCP policies
ncptoken Reads and writes manufacturing tokens in the NCP

Telegesis Commands

The following commands are available if the transport layer is using the Telegesis dongle.

Command Description
ncpsecuritystate Gets the current NCP security state and configuration

Contributing

  • Code style should use standard naming conventions
  • Codacy static testing should pass.
  • Run the findBugs goal and check that you have not introduced any bugs into your code. FindBugs reports are generated with the mvn site goal, and reports are located in the target/site/findbugs.html file.
  • Please consider raising issues before working on an enhancement to provide some coordination with other contributors.
  • Keep PRs short - try and keep a single PR per enhancement. This makes tracking and reviewing easier.
  • Contributions must be supported with tests. Ideally, you should aim to acheive full coverage of the code changes. Code coverage reports are located in the com.zsmartsystems.zigbee.test/target/site/jacoco-aggregate folder and opening the index.html file.
  • Code must be formatted using the Eclipse code formatter provided in the project.
  • Contributions must be your own and you must agree with the license.
  • You must sign the PR and commits and must agree to the Contributor License Agreement.

Maven

The library is published directly to the maven central repository, and the following dependency can be specified -:

<dependency>
    <groupId>com.zsmartsystems.zigbee</groupId>
    <artifactId>com.zsmartsystems.zigbee</artifactId>
    <version>1.x.x</version>
    <type>pom</type>
</dependency>

Maven Goals

  • To build: mvn clean install
  • To prepeare a new release: mvn release:prepare
  • To perform a new release: mvn release:perform
  • To bump the version: mvn release:update-versions
  • To format the license header: mvn license:format
  • To produce the findbugs (etc) reports: mvn site

Gradle

Gradle build dependencies:

dependencies
{
    compile 'com.zsmartsystems.zigbee:com.zsmartsystems.zigbee:1.x.x'
}

Note:

Change 1.x.x to desired/latest version (24.12.2018 1.x.x -> 1.1.7)

License

The code is licensed under Eclipse Public License. Refer to the license file for further information.

Some parts of this code are from zigbee4java which in turn is derived from ZB4O projects which are licensed under the Apache-2 license. These are being refactored out to ensure the contributions to this reportisory are understood.

ZigBee Documentation

Some documentation used to create parts of this framework is copyright © ZigBee Alliance, Inc. All rights Reserved. The following copyright notice is copied from the ZigBee documentation.

Elements of ZigBee Alliance specifications may be subject to third party intellectual property rights, including without limitation, patent, copyright or trademark rights (such a third party may or may not be a member of ZigBee). ZigBee is not responsible and shall not be held responsible in any manner for identifying or failing to identify any or all such third party intellectual property rights.

No right to use any ZigBee name, logo or trademark is conferred herein. Use of any ZigBee name, logo or trademark requires membership in the ZigBee Alliance and compliance with the ZigBee Logo and Trademark Policy and related ZigBee policies.

This document and the information contained herein are provided on an “AS IS” basis and ZigBee DISCLAIMS ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT OR TRADEMARK RIGHTS) OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NONINFRINGEMENT. IN NO EVENT WILL ZIGBEE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTIAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.

All Company, brand and product names may be trademarks that are the sole property of their respective owners.

Dongle Documentation

Some documentation used to implement dongle drivers is copywrite to the respective holders, including Silicon Labs, Texas Instruments, Dresden Electronics, Digi International.

com.zsmartsystems.zigbee's People

Contributors

amitjoy avatar bluelinexy avatar cdjackson avatar claell avatar cschwer avatar darrencocco avatar dependabot[bot] avatar dschall avatar dtodor avatar hanneshofmann avatar hedda avatar hsudbrock avatar joerg1985 avatar lacinoire avatar lgtm-com[bot] avatar mikomarrache avatar milansamardzic avatar otaviojr avatar pdecat avatar puzzle-star avatar sesuncedu avatar t-8ch avatar t2000 avatar tejas-n avatar tomtravaglino avatar triller-telekom avatar tunjid avatar vitoni avatar wsowa avatar ziver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

com.zsmartsystems.zigbee's Issues

Add network layer incoming packet interface

It would be good to implement a standard network layer interface to allow notifications from dongles into the framework.

Specific notifications I want to see implemented -:

  • Ack/Nak responses - these should cut short the internal timeout on transactions if the stick has already given up on a transaction (I've started to implement this, but want a standard interface if possible).
  • Incoming route notifications.
  • Trust centre notifications.
  • ...

Comments/thoughts appreciated...

Ember cannot be initialized

For our project we're using com.zsmartsystems.zigbee in combination with org.openhab.binding.zigbee and trying to create a bridge for the Ember-Controller. The bridge itself is created but it's never set in status ONLINE. We stepped with a debugger through the code and the summary of our investigation is that the ZigBee initialization apparently gets stuck because the AshFrameHandler never receives a com.zsmartsystems.zigbee.dongle.ember.ash.AshFrame.FrameType.RSTACK an therefore can't be completed. So the bridge stays in status Status=INITIALIZING.

Below you see the key points which describe how the ZigBee initialization gets stuck and does therefore not complete. The description starts in com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp.initialize(). Since the process is thread-driven some things can happen in a slightly different order or simultaneously. But finally it ends up in the same situation.

In com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp.initialize()

  • The statement if (!serialPort.open()) returns true.
  • The statement ashHandler.start(serialPort) starts the thread to read packets from a stream. Initially there is no data available and the thread goes into wait state at org.openhab.binding.zigbee.internal.ZigBeeSerialPort.read(int)
  • The statement ashHandler.connect() sends a reset frame. See below what happens in com.zsmartsystems.zigbee.dongle.ember.ash.AshFrameHandler.outputFrame(AshFrame).

In com.zsmartsystems.zigbee.dongle.ember.ash.AshFrameHandler.outputFrame(AshFrame)

  • the for-loop
    • com.zsmartsystems.zigbee.dongle.ember.ash.AshFrameRst.getOutputBuffer() returns [26, 192, 56, 188, 126]. So these values represent the reset frame, right? Is 126 <=> ASH_FLAG_BYTE (end of a frame)?
    • port.write writes the content of the buffer byte by byte into the output stream gnu.io.RXTXPort$SerialOutputStream
    • the invocation of port.write leads to at least one invocation of org.openhab.binding.zigbee.internal.ZigBeeSerialPort.serialEvent(SerialPortEvent) depending on whether it is already in execution. It can happen up to five times since port.write is invoked five times.

In org.openhab.binding.zigbee.internal.ZigBeeSerialPort.serialEvent(SerialPortEvent)

  • When serialEvent(SerialPortEvent) is called gnu.io.RXTXPort$SerialInputStream.read() delivers the values 3, 0, 167 five times in total.
  • All the occurrences of 3, 0, 167 are stored in a buffer of type int[]. This results in buffer = [3, 0, 167, 3, 0, 167, 3, 0, 167, 3, 0, 167, 3, 0, 167, 0...]
  • When all the available data is processed this.notify() is invoked which wakes up the thread that is waiting in org.openhab.binding.zigbee.internal.ZigBeeSerialPort.read(int). Each a byte will be read out there and returned to com.zsmartsystems.zigbee.dongle.ember.ash.AshFrameHandler.getPacket()

In com.zsmartsystems.zigbee.dongle.ember.ash.AshFrameHandler.getPacket()

  • port.read() returns a byte from the buffer populated in org.openhab.binding.zigbee.internal.ZigBeeSerialPort.serialEvent(SerialPortEvent) and waits for ASH_FLAG_BYTE in order to return the collected data.
  • Since buffer doesn't contain ASH_FLAG_BYTE the thread gets stuck in the loop and will never return to the caller.
  • So the caller (thread "AshFrameHandler") will never receive com.zsmartsystems.zigbee.dongle.ember.ash.AshFrame.FrameType.RSTACK and consequently not proceed with the initialization process and set "stateConnected" to true. So no further communication is possible since it depends on this variable being set to true.

java.lang.IllegalArgumentException: Invalid type '{com.zsmartsystems.zigbee.ZigBeeChannel}' of configuration value!

OH 1348
Zigbee snapshot 2.4.0.201809041558
Zigbee libraries 1.1.1

I'm seeing this on startup, but everything appears to be functioning...

2018-09-04 18:50:49.702 [WARN ] [org.eclipse.smarthome.core.internal.common.WrappedScheduledExecutorService] - Scheduled runnable ended with an exception
java.lang.IllegalArgumentException: Invalid type '{com.zsmartsystems.zigbee.ZigBeeChannel}' of configuration value!
        at org.eclipse.smarthome.config.core.ConfigUtil.normalizeType(ConfigUtil.java:80) ~[?:?]
        at org.eclipse.smarthome.config.core.Configuration.put(Configuration.java:86) ~[?:?]
        at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.initialiseZigBee(ZigBeeCoordinatorHandler.java:412) ~[?:?]
        at org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler.lambda$1(ZigBeeCoordinatorHandler.java:437) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]


2018-09-04 18:50:49.702 [DEBUG] [com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp] - EZSP dongle startup done.
2018-09-04 18:50:49.702 [DEBUG] [org.openhab.binding.zigbee.handler.ZigBeeCoordinatorHandler] - ZigBee Initialise done. channel=CHANNEL_25, PanId=19740  EPanId=3DAB5D4A2336BFDE

Provide timeout handling for Ember dongle

The current implementation for the Ember dongle doesn't recognize when the controller has stopped communicating. The implementation of such a feature is under progress for the Telegesis dongle. Please, provided it also for the Ember dongle.

Maven Clean Install failed on com.zsmartsystems.zigbee.test

Using Maven 3.5.3 on Debian Stretch.
[ERROR] Failed to execute goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage (codacy-upload-coverage) on project com.zsmartsystems.zigbee.test: The parameters 'apiToken', 'projectToken' for goal com.gavinmogan:codacy-maven-plugin:1.0.3:coverage are missing or invalid

Implement Green Power Commissioning Tool capability

Goal
Implement green power device : GP Commissioning Tool (0x0064)

Need

  • Implement missing ezsp frame
  • Open a discussion of the best way to do this and support with other dongle

Request

  • create a new branch to develop this functionalities
  • add on this branch ezsp frame (information from UG100: EZSP Reference Guide Rev. 3.2) :
    -- gpProxyTableProcessGpPairing (0xC9)
    -- dGpSend (0xC6)
    -- dGpSentHandler (0xC7)
    -- gpepIncomingMessageHandler (0xC5)
    -- gpProxyTableGetEntry (0xC8)
    -- gpProxyTableLookup (0xC0)

Test in SpiFrameHandlerTest failing

Version 1.0.13

The test mentioned above fails very often during the build.

12:44:33 testSendEzspFrame(com.zsmartsystems.zigbee.dongle.ember.internal.spi.SpiFrameHandlerTest) Time elapsed: 0.024 sec <<< FAILURE! 12:44:33 java.lang.AssertionError: expected:<7> but was:<9> 12:44:33 at org.junit.Assert.fail(Assert.java:88) 12:44:33 at org.junit.Assert.failNotEquals(Assert.java:743) 12:44:33 at org.junit.Assert.assertEquals(Assert.java:118) 12:44:33 at org.junit.Assert.assertEquals(Assert.java:555) 12:44:33 at org.junit.Assert.assertEquals(Assert.java:542) 12:44:33 at com.zsmartsystems.zigbee.dongle.ember.internal.spi.SpiFrameHandlerTest.testSendEzspFrame(SpiFrameHandlerTest.java:279) 12:44:33 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 12:44:33 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 12:44:33 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 12:44:33 at java.lang.reflect.Method.invoke(Method.java:498)

Node concurrency issues

ZigBeeNode (and maybe Endpoint?) lists (Neighbours, Routes...) should use concurrent maps.

Example code

Is there any example code available associated with this repository? I'm looking at getting into the ZigBee market (mainly for Philips HUE at the moment) and I'm looking for a decent Java library that I can utilize.

This looks promising (commits in the last few days) but I would like to see some example code before actually buying any products.

Handling of attributes that may not be of ZCL defined type

As seen in this issue some devices may report an incorrect data type.

Below the device is reporting an unsigned 8 bit int which is inconsistent with the ZCL definition which is boolean...

09:50:12.811 [DEBUG] [rtsystems.zigbee.ZigBeeNetworkManager] - RX CMD: ReadAttributesResponse [On/Off: 7287/1 -> 0/1, cluster=0006, TID=FC, records=[Read Attribute Status Record: attributeDataType=UNSIGNED_8_BIT_INTEGER, attributeIdentifier=0, status=0, attributeValue=1]]

image

Maybe we should ignore the device reported type and just use the ZCL defined type.

Philips Hue Dimmer Off command not working

I've been testing the On/Off switch functionality with a Philips Hue Dimmer. The device pairs and is discovered in OH.

Pressing the 'on' button on the Dimmer works and the OH channel updates to ON correctly but when pressing the 'off' button the library does not translate the zigbee packet into an off command,

From what I've gathered purely from reading the src it looks like there is a mismatch between what the dimmer sends for the commandId (64) and what is expected for an off command (0).

Here's the 'on' button press log:

2018-02-21 22:41:09.981 [DEBUG] [gesis.internal.TelegesisFrameHandler] - TELEGESIS RX: Data 52 58 3A 33 44 33 45 2C 30 31 30 34 2C 30 31 2C 30 31 2C 30 30 30 36 2C 30 33 3A 01 14 01 2C 2D 35 31 2C 46 46
2018-02-21 22:41:09.986 [DEBUG] [gesis.internal.TelegesisFrameHandler] - Telegesis event received: TelegesisReceiveMessageEvent [ieeeAddress=null, networkAddress=15678, profileId=260, destinationEp=1, sourceEp=1, clusterId=6, messageData=01 14 01, rssi=-81, lqi=255]
2018-02-21 22:41:09.991 [DEBUG] [ngle.telegesis.ZigBeeDongleTelegesis] - Telegesis RX: TelegesisReceiveMessageEvent [ieeeAddress=null, networkAddress=15678, profileId=260, destinationEp=1, sourceEp=1, clusterId=6, messageData=01 14 01, rssi=-81, lqi=255]
2018-02-21 22:41:09.995 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX APS: ZigBeeApsFrame [sourceAddress=15678/1, destinationAddress=0/1, profile=0104, cluster=6, addressMode=null, radius=0, sequence=0, payload=01 14 01]
2018-02-21 22:41:10.000 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX ZCL: ZclHeader [frameType=CLUSTER_SPECIFIC_COMMAND, manufacturerSpecific=false, direction=CLIENT_TO_SERVER, disableDefaultResponse=false, manufacturerCode=0, sequenceNumber=20, commandId=1]
2018-02-21 22:41:10.005 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX CMD: OnCommand [On/Off: 15678/1 -> 0/1, cluster=0006, TID=14]
2018-02-21 22:41:10.009 [DEBUG] [converter.ZigBeeConverterSwitchOnoff] - 0017880103E47DAF: ZigBee command receiveds OnCommand [On/Off: 15678/1 -> 0/1, cluster=0006, TID=14]
2018-02-21 22:41:10.014 [DEBUG] [converter.ZigBeeBaseChannelConverter] - 0017880103E47DAF: Channel zigbee:device:zigbee:0017880103e47daf:0017880103E47DAF_1_switch_onoff updated to ON

Here's the 'off' button press log:

2018-02-21 22:39:42.435 [DEBUG] [gesis.internal.TelegesisFrameHandler] - TELEGESIS RX: Data 52 58 3A 33 44 33 45 2C 30 31 30 34 2C 30 31 2C 30 31 2C 30 30 30 36 2C 30 35 3A 01 12 40 00 00 2C 2D 35 31 2C 46 46
2018-02-21 22:39:42.441 [DEBUG] [gesis.internal.TelegesisFrameHandler] - Telegesis event received: TelegesisReceiveMessageEvent [ieeeAddress=null, networkAddress=15678, profileId=260, destinationEp=1, sourceEp=1, clusterId=6, messageData=01 12 40 00 00, rssi=-81, lqi=255]
2018-02-21 22:39:42.448 [DEBUG] [ngle.telegesis.ZigBeeDongleTelegesis] - Telegesis RX: TelegesisReceiveMessageEvent [ieeeAddress=null, networkAddress=15678, profileId=260, destinationEp=1, sourceEp=1, clusterId=6, messageData=01 12 40 00 00, rssi=-81, lqi=255]
2018-02-21 22:39:42.469 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX APS: ZigBeeApsFrame [sourceAddress=15678/1, destinationAddress=0/1, profile=0104, cluster=6, addressMode=null, radius=0, sequence=0, payload=01 12 40 00 00]
2018-02-21 22:39:42.478 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - RX ZCL: ZclHeader [frameType=CLUSTER_SPECIFIC_COMMAND, manufacturerSpecific=false, direction=CLIENT_TO_SERVER, disableDefaultResponse=false, manufacturerCode=0, sequenceNumber=18, commandId=64]
2018-02-21 22:39:42.488 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - No command type found for CLUSTER_SPECIFIC_COMMAND, cluster=6, command=64, direction=CLIENT_TO_SERVER
2018-02-21 22:39:42.491 [DEBUG] [tsystems.zigbee.ZigBeeNetworkManager] - Incoming message did not translate to command.

License goal not working

@hsudbrock the change you made to the pom seems to complete stop the license formatter...

Any thoughts on how to resolve this so it works in both scenarios?

EMBER - reinitialize fails

networkManager.startup(true) is failing because of supplying invalid network key. Following is the log:-

08-13 18:01:03.511 5963-6033/ D/c.z.z.d.e.i.a.AshFrameHandler: [pool-6-thread-1     ] TX EZSP: EzspSetInitialSecurityStateRequest [state=EmberInitialSecurityState [bitmask=[EMBER_HAVE_NETWORK_KEY, EMBER_TRUST_CENTER_GLOBAL_LINK_KEY, EMBER_REQUIRE_ENCRYPTED_KEY, EMBER_NO_FRAME_COUNTER_RESET, EMBER_HAVE_PRECONFIGURED_KEY], preconfiguredKey=EmberKeyData [contents={00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00}], networkKey=EmberKeyData [contents={3E 11 25 BC 43 FC 14 31 48 D1 3C 00 CA 3D 00 FF}], networkKeySequenceNumber=0, preconfiguredTrustCenterEui64=0000000000000000]]
08-13 18:01:03.516 5963-6033/ D/c.z.z.d.e.i.a.AshFrameHandler: [pool-6-thread-1     ] --> TX ASH frame: AshFrameData [frmNum=2, ackNum=3, reTx=false, data=4B 00 FF 00 68 04 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 11 25 BC 43 FC 14 31 48 D1 3C 00 CA 3D 00 FF 00 00 00 00 00 00 00 00 00]
08-13 18:01:03.532 5963-6032/ D/c.z.z.d.e.i.a.AshFrameHandler: [AshFrameHandler     ] <-- RX ASH frame: AshFrameData [frmNum=3, ackNum=3, reTx=false, data=4B 80 FF 00 68 B2]
08-13 18:01:03.536 5963-6032/ D/c.z.z.d.e.i.a.AshFrameHandler: [AshFrameHandler     ] ASH: Frame acked and removed AshFrameData [frmNum=2, ackNum=3, reTx=false, data=4B 00 FF 00 68 04 1B 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3E 11 25 BC 43 FC 14 31 48 D1 3C 00 CA 3D 00 FF 00 00 00 00 00 00 00 00 00]
08-13 18:01:03.538 5963-6032/ D/c.z.z.d.e.i.a.AshFrameHandler: [AshFrameHandler     ] RX EZSP: EzspSetInitialSecurityStateResponse [status=EMBER_KEY_INVALID]
08-13 18:01:03.539 5963-6032/ D/c.z.z.d.e.i.a.AshFrameHandler: [AshFrameHandler     ] --> TX ASH frame: AshFrameAck [ackNum=4, notRdy=false]
08-13 18:01:03.540 5963-6015/ D/c.z.z.d.e.i.EmberNetworkInitialisation: [pool-1-thread-1     ] EzspSetInitialSecurityStateResponse [status=EMBER_KEY_INVALID]

We have tried:-

  1. networkKey = ZigBeeKey.createRandom();
  2. networkKey = zigBeeDongleEzsp.getZigBeeNetworkKey();
    In both the above cases, we are getting EMBER_KEY_INVALID.

It worked in 1.0.12. This error is in 1.0.15-SNAPSHOT.

[EMBER] Frequent drop offs of devices

Since updating to 1.0.14, all of my GE Link bulbs have been frequently jumping off the network. Sometimes jump back onto it too. After a restart, things usually look good, but within a day there will be a handful that are not responding. The bulbs were much better about staying on the network with 1.0.13. I know when they fall off the network, because they will turn themselves on. But I have also frequently seen lights turning on through automation, like walking into a room, but them some of the bulbs not turning off or dimming properly. By rolling back just the zsmartsystems libraries to 1.0.13, the bulbs stop dropping off as frequently.

The response from the bulbs during pairing looks different too, in that the bulbs flash differently. They usually flash three times. Now, they flash once and then flicker for a while and either drop off the network or start behaving. When I see one flicker out of the blue, I start discovery and this will usually get it back on the network. I left debug on for a day, so I have nearly 1GB of logs(!). I haven't spotted anything that stood out to me, but I do have a lot of these...

zigbee.log.20180801143036:2018-08-01 14:22:35.268 [DEBUG] [s.zigbee.dongle.ember.internal.ash.AshFrameHandler] - RX EZSP: EzspIncomingRouteErrorHandler [status=EMBER_SOURCE_ROUTE_FAILURE, target=46220]
zigbee.log.20180801143036:2018-08-01 14:22:35.268 [DEBUG] [zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp] - RX: EzspIncomingRouteErrorHandler [status=EMBER_SOURCE_ROUTE_FAILURE, target=46220]
zigbee.log.20180801143036:2018-08-01 14:22:35.268 [DEBUG] [zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp] - Unhandled EZSP Frame: EzspIncomingRouteErrorHandler [status=EMBER_SOURCE_ROUTE_FAILURE, target=46220]
zigbee.log.20180801143036:2018-08-01 14:22:46.220 [DEBUG] [com.zsmartsystems.zigbee.zcl.ZclCluster           ] - 15077/1: Error reading attribute 772 in cluster 2820 - UNSUPPORTED_ATTRIBUTE

Let me know if you want more logs... I got plenty of 'em...
zigbee.log.zip

ConBee/RaspBee Support

Hi Chris,

The README says more work is required for ConBee and RaspBee. Would you mind creating a list/issue here with details?

I'd like to help!

Thanks
S

Karaf NPE: ZigBeeCommandNotifier.java

Zigbee binding 2.3.0.201801042145

In case it is related, I had a bulb that refused to come online, so I reset it and rediscovered. I also had recently updated the binding before I noticed this. I have some debug logs, if you want them.

Exception in thread "pool-3555-thread-2" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.zcl.ZclAttributeNormalizer.normalizeZclData(ZclAttributeNormalizer.java:24)
        at com.zsmartsystems.zigbee.zcl.ZclCluster.handleAttributeStatus(ZclCluster.java:843)
        at com.zsmartsystems.zigbee.ZigBeeEndpoint.commandReceived(ZigBeeEndpoint.java:410)
        at com.zsmartsystems.zigbee.ZigBeeNode.commandReceived(ZigBeeNode.java:680)
        at com.zsmartsystems.zigbee.ZigBeeCommandNotifier$1.run(ZigBeeCommandNotifier.java:65)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)

Removed nodes are not removed from list of discovered nodes

The class ZigBeeNetworkManager puts all nodes for which discovery has completed into the set nodeDiscoveryComplete. This set is used to select between doing a nodeAdded and a nodeUpdated callback in the updateNode method.

When a node is removed, it is not removed from the nodeDiscoveryComplete set, resulting in a different callback behavior when a node is added for the first time (where nodeAdded is called twice, once when the node is added, and once when node discovery is complete), and when a node is added again after it has been removed before (where nodeAdded is called once, and after complete discovery nodeUpdated is called).

add ezsp command setConcentrator

Please add network frame "setConcentrator" to the ezsp command list. frame id: 0x10

From the EZSP Reference Guide:

Name: setConcentrator
ID: 0x10
Description: Enable/disable concentrator support.

add a public method to send EzspFrameRequest?

Thoughts on adding a new public method to the ZigBeeDongleEzsp class to allow sending of raw EzspFrameRequest messages? I'm currently re implementing the entire class in order to send some basic commands to the stick.. ie, getting the local ieee and network address of the stick. If this method were added I would be able to use the built in class.

public EzspFrameResponse sendFrameRequest(EzspFrameRequest request, Class responseType) {
EzspSingleResponseTransaction transaction = new EzspSingleResponseTransaction(request, responseType);
ashHandler.sendEzspTransaction(transaction);
return transaction.getResponse();
}

Ember console uses classes from internal Ember dongle packages

Classes from the module com.zsmartsystems.zigbee.console.ember use classes from internal packages from the module com.zsmartsystems.zigbee.dongle.ember (viz. the package com.zsmartsystems.zigbee.dongle.ember.internal.ezsp and sub-packages).

This leads to problems (in particular in the context of this issue) when using these modules as OSGi bundles, because the internal packages are not declared as exported in the manifest file that is generated by the maven build (as the maven build adds export statements for all bundles, unless bundles that contain internal or impl - cf. the maven plugin docs).

The simplest approach for solving this would be to simply configure the maven build to make the generated manifest export all bundles for the ember dongle module. This could by done by adding the following to the pom file of that module:

<build>
   <plugins>
    <plugin>
        <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
             <Export-Package>com.zsmartsystems.zigbee.dongle.ember.*</Export-Package>
           </instructions>
         </configuration>
    </plugin>
   </plugins>
 </build>

Exporting only packages without internal/impl except the affected packages appears to be more difficult to me.

Another option would be to rewrite the ember console / the ember dongle modules such that imports of internal classes are no longer needed - this option also seems not so easy.

Raspbee + deConz + OpenHAB-Binding

Hello,

right now we are trying to get the Raspbee-Gateway working. We set up DeConz on the Raspbee and the Openhab-Server but we ran into an issue using the Zigbee-Binding.
If we go to the OpenHab-Site and go to "Choose Binding" there are only three options and Raspbee/Conbee is not included.
Now we are trying to use the console to get the Zigbee Module working.
To us it just isnt clear how to use the console.
As stated in the "console application" paragraph there is a command to start the console so the framework is ready to go. Do we have to copy it to the shell? To us its also not rly clear how the syntax of the command has to look like. Can someone give an example?

Your help would be greatly appreciated.
Tim

Attribute reporting class cast exception

java.lang.ClassCastException: com.zsmartsystems.zigbee.zcl.clusters.general.ReportAttributesCommand cannot be cast to com.zsmartsystems.zigbee.zcl.clusters.general.ReadAttributesResponse
        at com.zsmartsystems.zigbee.zcl.ZclCluster.readSync(ZclCluster.java:214) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at com.zsmartsystems.zigbee.zcl.clusters.ZclOnOffCluster.getOnOff(ZclOnOffCluster.java:113) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at org.openhab.binding.zigbee.converter.ZigBeeConverterSwitchLevel.initializeConverter(ZigBeeConverterSwitchLevel.java:93) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler.doNodeInitialisation(ZigBeeThingHandler.java:229) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler.access$0(ZigBeeThingHandler.java:171) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler$1.call(ZigBeeThingHandler.java:165) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler$1.call(ZigBeeThingHandler.java:1) [16:org.openhab.binding.zigbee:2.3.0.201801032157]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

closes openhab/org.openhab.binding.zigbee#72

Mesh update node changed check not working

When the mesh update completes, it copies the new data into the node. It then does a check to see if the node has changed, and if so, it then sends the notification to listeners. Since the node is updated already, the check always fails and notifications are not sent.

The update of the node in the mesh update code should be looked at to improve this.

#183

send reset when EmberZNet sends error

According to the docs:

When the NCP enters the FAILED state, the NCP sends an ERROR frame containing a reset or error code and will reply to all subsequent frames received, except RST, with an ERROR frame. To reinitialize the ASH protocol, the Host must reset the NCP by either asserting the nRESET pin or sending the RST frame.

Dedicated loggers for transmit/receive logs

Currently, the framework logs information about what commands are transmitted to / received from the ZigBee chips using the logger of the class that handles the transmission / reception. The log level is TRACE for the single RX/TX bytes in the SpiFrameHandler as well as for the RX bytes in the AshFrameHandler; it is DEBUG for the other logs (e.g., the complete RX/TX frames in the SpiFrameHandler and the AshFrameHandler, and for the logging of more high-level frame information like in the ZigBeeDongleEZSP, ZigBeeDongleXBee, and the like).

I propose to use dedicated loggers for the transmit/receive log statements, instead of using the logger of the class that handles transmission/reception, for the following reason: While these log messages are sometimes really useful, it is sometimes helpful to disable those log messages, so that they do not flood the log. Of course, one can disable them by setting the log level to INFO - but this will also suppress the other DEBUG-level log messages of the classes (which are a lot rarer, and do not flood the log easily). With dedicates loggers for transmit/receive log statements, one can disable those without disabling the logging for the complete class.

I would like to introduce such loggers for different protocol layers; at the example of Ember chips, there could be one logger for SPI frames (used in the SpiFrameHandler), one for ASH frames (use in the AshFrameHandler), and one for EZSP commands (used in the ZigBeeDongleEzsp). (One could also think about using two loggers for each, one for RX and one for TX, but I think that the simpler solution with one logger for RX and TX is sufficient.)

Regarding the naming of these loggers, my suggestion would be to use the namespace of the module producing the log statements, plus protocol name, plus wire, as these loggers log the data that actually goes over the wire to the ZigBee chip. Example: com.zsmartsystems.zigbee.dongle.ember.ash.wire.

I'd be happy to add a PR for such loggers, but would first like to discuss here about if and how this could be added to the library, and whether this would entail other changes (e.g., in the ZigBee Log Viewer).

Network state serialisation should be managed in the network manager

The coordinator should always be the first node added to the network to ensure that it exists when notifications are sent to users when other nodes are added.

Possibly modify the serialisation to ensure this is controlled - but this could be difficult since serialisation is managed outside of the framework. An alternative could be for the serialisation to return the list of deserialised nodes rather than it adding the nodes itself.

Another option is not to send notifications if the coordinator is not known, and then when the coordinator is added, send notifications for all nodes at that time.

Unable to join Phillips Hue dimmer switch

I'm attempting to get a Phillips Hue dimmer switch to talk to a HUSBZB-1. Obviously a pretty untested setup, but I'd love to get this working, as there are just so few battery-powered switches/dimmers out there. This is less an 'issue' and more just opening a discussion. TLDR on this: It doesn't seem, out of the box, the switch is replying to discovery with it's own sender network ID, but with 0 as the sender. So the stack doesn't see the replies.

Where we seem to be stuck is, we send out an IeeeAddressRequest:
02:51:29.704 DEBUG TX CMD: IeeeAddressRequest [0/0 -> 2858/0, cluster=0001, TID=5C, nwkAddrOfInterest=2858, requestType=1, startIndex=0]

And we do get a response -- with a sender of 0, not 2858. So it never 'sees' the response (as it expects the sender of the response to match the destination of the request).

02:51:29.740 TRACE <-- RX ASH frame: AshFrameData [frmNum=0, ackNum=0, reTx=false, data=5C 90 45 00 00 00 01 80 00 00 40 01 00 00 2C FF 00 00 00 FF FF 0D 00 00 32 6F 19 02 01 88 17 00 2A 0B 00]
02:51:29.742 DEBUG RX CMD: IeeeAddressResponse [0/0 -> 0/0, cluster=8001, TID=NULL, status=SUCCESS, ieeeAddrRemoteDev=0017880102196F32, nwkAddrRemoteDev=2858, numAssocDev=0, startIndex=null, nwkAddrAssocDevList=[]]
02:51:39.707 DEBUG Ieee Address for 2858 returned null

I'm unclear as to why the sender isn't set -- I think it might be possible that the dongle may be intercepting the request (since it knows the 'right answer'? AFAIK it should treat this as any other unicast command, but... it is not) At any rate, I changed this in zdo/command/IeeeAddressRequest.java (I'm not sure this is a good idea for everybody, but for my setup, it doesn't matter for the time being, as it should be correct on anything but a router I think):

// return (((IeeeAddressRequest) request).getDestinationAddress()
// .equals(((IeeeAddressResponse) response).getSourceAddress()));
return (((IeeeAddressRequest) request).getNwkAddrOfInterest()
.equals(((IeeeAddressResponse) response).getNwkAddrRemoteDev()));

Things continued well after that and other messages have the correct response (including sender). I can use the console to query stuff on the device, but the buttons on the switch don't seem to do anything. With that said, the extent of my testing there was pushing a button, seeing nothing in the logs, and deciding it is time for bed.

Perhaps a better solution is when:

RX EZSP: EzspChildJoinHandler [index=0, joining=true, childId=25851, childEui64=0017880102196F32, childType=EMBER_SLEEPY_END_DEVICE]

Is received, start the discovery process on the second step and skip the IEEE address discovery, since we were already told. Unfortunately, the childType is not passed up into the discovery stack, and I think the ieee address discovery step needs to happen for routers.

Mesh update exception and Readsync exception at shutdown

2.3.0.201801052345

When stopping the zigbee binding, the "Mesh update exception' occurs every time, but always only five times. Five of my devices are currently powered off (one battery and 4 GE Link bulbs). The 'Readsync exception' occurs right before these, but not every time. After starting again, everything looks good.

010618 readsync exception.zip

Correction... six devices are powered off (one battery and five bulbs).

Migrate console commands into reusable package

Migrate the console command processors into a separate package - ie separate from the console main application. This would allow the command processors to be used within another console application.

NPE in Karaf console (ZigBeeNetworkMeshMonitor.java)

Originally posted here

This NPE comes up in the Karaf console running OH2.1 release and the Zigbee binding (2.2.0.201707042200). I am using an HUSBZB-1 (EmberZNet Pro 5.4).

openhab> Exception in thread "pool-35-thread-1" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-2" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-4" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-3" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-6" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-5" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-7" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-8" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-10" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-11" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-12" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-13" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-9" java.lang.NullPointerException
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.getAssociatedNodes(ZigBeeNetworkMeshMonitor.java:305)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor.access$500(ZigBeeNetworkMeshMonitor.java:59)
        at com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor$2.run(ZigBeeNetworkMeshMonitor.java:233)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Exception in thread "pool-35-thread-15" java.lang.NullPointerException
Exception in thread "pool-35-thread-16" java.lang.NullPointerException
Exception in thread "pool-35-thread-14" java.lang.NullPointerException
Exception in thread "pool-35-thread-18" java.lang.NullPointerException
Exception in thread "pool-35-thread-17" java.lang.NullPointerException
Exception in thread "pool-35-thread-19" java.lang.NullPointerException
Exception in thread "pool-35-thread-21" java.lang.NullPointerException
Exception in thread "pool-35-thread-20" java.lang.NullPointerException
Exception in thread "pool-35-thread-22" java.lang.NullPointerException
Exception in thread "pool-35-thread-24" java.lang.NullPointerException
Exception in thread "pool-35-thread-25" java.lang.NullPointerException
Exception in thread "pool-35-thread-26" java.lang.NullPointerException
Exception in thread "pool-35-thread-27" java.lang.NullPointerException
Exception in thread "pool-35-thread-28" java.lang.NullPointerException
Exception in thread "pool-35-thread-29" java.lang.NullPointerException
Exception in thread "pool-35-thread-23" java.lang.NullPointerException
Exception in thread "pool-35-thread-31" java.lang.NullPointerException
Exception in thread "pool-35-thread-30" java.lang.NullPointerException
Exception in thread "pool-35-thread-32" java.lang.NullPointerException
Exception in thread "pool-35-thread-34" java.lang.NullPointerException
Exception in thread "pool-35-thread-35" java.lang.NullPointerException
Exception in thread "pool-35-thread-33" java.lang.NullPointerException

AshFrameHandlerTest#testAshFrameData fails continuously

With the latest version (1.0.14), the AshFrameHandlerTest#testAshFrameData continuously fails as follows:

testAshFrameData(com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandlerTest) Time elapsed: 0.008 sec <<< FAILURE!

Similar to #333, the test case works locally stable but continuously fails on slow CI machines.

Discovery optimisation

Thoughts to improve discovery -:

  • Send a notification when the node is first discovered, so that even if the discovery fails, the application knows that the device was found.
  • Don't perform discovery steps if data already known - eg don't ask for IEEE address if we already have it, don't ask for node descriptor if we know it...

Failed to update firmware for EMBER EFR32MG

I am receiving 'Received CAN' message while trying to update the firmware of the dongle.

Opening port /dev/ttyS2 at 115200 baud with FLOWCONTROL_OUT_NONE.
Ember bootloader: Serial port opened.
Ember bootloader: Got bootloader prompt.
Dongle firmware status: FIRMWARE_TRANSFER_STARTED.
Ember bootloader: Clearing input stream...
Ember bootloader: Starting transfer.
Ember bootloader: Transfer frame 1, attempt 0.
Ember bootloader: Received CAN.
Ember bootloader: Transfer failed.

Provide default values for cluster if Values are not properly formated

I'm getting the following exception every few seconds,

        at com.zsmartsystems.zigbee.zcl.clusters.ZclBasicCluster.getHwVersion(ZclBasicCluster.java:327) [193:com.zsmartsystems.zigbee:1.0.11]
        at org.openhab.binding.zigbee.discovery.ZigBeeNodePropertyDiscoverer.getProperties(ZigBeeNodePropertyDiscoverer.java:138) [247:org.openhab.binding.zigbee:2.4.0.201807010828]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler.doNodeInitialisation(ZigBeeThingHandler.java:254) [247:org.openhab.binding.zigbee:2.4.0.201807010828]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler.access$0(ZigBeeThingHandler.java:158) [247:org.openhab.binding.zigbee:2.4.0.201807010828]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler$1.call(ZigBeeThingHandler.java:152) [247:org.openhab.binding.zigbee:2.4.0.201807010828]
        at org.openhab.binding.zigbee.handler.ZigBeeThingHandler$1.call(ZigBeeThingHandler.java:1) [247:org.openhab.binding.zigbee:2.4.0.201807010828]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

looks like its expecting an Integer for the hardware version, but the device returns a string, since the hardware version is not critical for device operation how about we surround querying those parameters in a try/catch and provide default values in case there is an exception?

Adding direct access to ezsp dongle

Goal :

  • be able to use mfglib frame :
    -- to create a 802.15.4 sniffer
    -- to pass radio certification process of a final product

Need :

  • split initialization function in individual function (mfglib start shall be done just after a protocl version request)
  • add a function to call ezsp frame
  • add ezspFrameHandler listener
  • managed a null zigbeeTransportReceive handler

Request :
create a new branch to develop this new functionnalities

XBee getPanID returns error

This XBee returns a command not supported error when requesting the PAN ID.

2018-03-29 15:07:19.310 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE: XBeeGetPanIdCommand [frameId=16]
2018-03-29 15:07:19.310 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - TX XBEE Data: 00 04 08 10 4F 49 4F
2018-03-29 15:07:19.432 [DEBUG] [ongle.xbee.internal.XBeeFrameHandler] - RX XBEE Data: 00 05 88 10 4F 49 02 CD
2018-03-29 15:07:19.433 [DEBUG] [ongle.xbee.internal.XBeeEventFactory] - Error creating instance of XBeeResponse
java.lang.ArrayIndexOutOfBoundsException: 8
	at com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeeFrame.deserializeInt16(XBeeFrame.java:93) [367:com.zsmartsystems.zigbee.dongle.xbee:1.0.8.SNAPSHOT]
	at com.zsmartsystems.zigbee.dongle.xbee.internal.protocol.XBeePanIdResponse.deserialize(XBeePanIdResponse.java:79) [367:com.zsmartsystems.zigbee.dongle.xbee:1.0.8.SNAPSHOT]
	at com.zsmartsystems.zigbee.dongle.xbee.internal.XBeeResponseFactory.getXBeeFrame(XBeeResponseFactory.java:111) [367:com.zsmartsystems.zigbee.dongle.xbee:1.0.8.SNAPSHOT]
	at com.zsmartsystems.zigbee.dongle.xbee.internal.XBeeFrameHandler$1.run(XBeeFrameHandler.java:184) [367:com.zsmartsystems.zigbee.dongle.xbee:1.0.8.SNAPSHOT]

First question is why, second is to avoid the exception.

Maven build fails when run in submodules

The maven build fails when run in a submodule (e.g., when running mvn clean install in the subfolder com.zsmartsystems.zigbee.console). The problem is that the license-maven-plugin cannot read the file /src/main/header.txt, which is defined in the parent module.

I don't think that this is a severe issue, but it can be a little annoying when one has to build all modules all the time.

There are several ways to resolve this (cf. mathieucarbou/license-maven-plugin#36 (comment)).

My suggestion is to disable the license-maven-plugin in the submodules as suggested in the discussion linked above, i.e., by setting the inherited property of the plugin configuration to false, and setting its configuration property aggregate to true (so that the plugin will check the source files in all submodules). I will add this small change as a PR, so one can see this written down.

Ember chip is sending XON and AshFrameHandler is not handling it.

On first startup, often the ember chip will send back a couple XON bytes (0x11) AshFrameHandler does not exclude these and adds them to the input buffer, resulting in a bad packet. ie:

ERROR com.zsmartsystems.zigbee.dongle.ember.ash.AshFrameHandler - <-- RX ASH frame: BAD PACKET 11 11 52 7B A1 E9 54 26 20

From the ASH protocol documentation, it specifies that certain bytes are reserved. Including:
0x11 XON: Resume transmission
Used in XON/XOFF flow control. Always ignored if received by the NCP.
0x13 XOFF: Stop transmission
Used in XON/XOFF flow control. Always ignored if received by the NCP.

Missing content of ember autocode module

I stumbled upon the module com.zsmartsystems.zigbee.dongle.ember.autocode not containing any code, when looking for how the autogenerated classes in com.zsmartsystems.zigbee.dongle.ember are actually generated.

Do you already know then this code will be added to the project?

Telegesis: waiting for TelegesisNetworkLeftEvent results in timeout

The default timeout is 500ms, but this transaction takes longer - just over 1 second in the case below, but maybe longer?

19:28:24.806 [DEBUG] [egesis.internal.TelegesisFrameHandler] - TX Telegesis: TelegesisLeaveNetworkCommand []
19:28:24.807 [DEBUG] [egesis.internal.TelegesisFrameHandler] - TELEGESIS TX: Data 41 54 2B 44 41 53 53 4C 0D 0A
19:28:24.929 [DEBUG] [egesis.internal.TelegesisFrameHandler] - TELEGESIS RX: Data 4F 4B
19:28:25.436 [DEBUG] [ongle.telegesis.ZigBeeDongleTelegesis] - Error leaving network: No event received

19:28:25.832 [DEBUG] [ongle.telegesis.ZigBeeDongleTelegesis] - Telegesis RX: TelegesisNetworkLeftEvent []

openhab/org.openhab.binding.zigbee#125

Supported attributes list error

Currently we add the number of table entries to each subsequent request when building the supported attributes list (and maybe also the commands list). This is probably wrong - it should simply start from the last attribute received.

Ember no longer controlling devices after 30-50 minutes

I have reported this previously in the forum. My Ember stick (nortel) will no longer control any devices after running for less than an hour. It will still register changes on the network. The following log shows me commanding brightness on a lamp to zero at 11:13:33. In Paper UI, the brightness updates to 0, however, the lamp itself does not react. Meanwhile, you can see a motion sensor updating, which is acted upon correctly by openhab.

Properties of the zigbee thing I tried to control:

zigbee_logicaltype ROUTER
zigbee_powerlevel FULL
modelId LCT010
zigbee_networkaddress 27819
zigbee_powersource MAINS
zigbee_stkversion 1
zigbee_datecode 20160906
zigbee_zclversion 1
zigbee_routes []
zigbee_lastupdate
vendor Philips
zigbee_appversion 2
zigbee_permitjoining false
zigbee_powermode RECEIVER_ON_IDLE
zigbee_powersources [MAINS, RECHARGABLE_BATTERY, DISPOSABLE_BATTERY]
hardwareVersion 1
zigbee_neighbors []
firmwareVersion 01000B0E
zigbee_devices []

Log when things don't work:
New Text Document.txt
Next is how a functioning command turns up in the log. All the TX commands seem to missing from above posted log.
Neues Textdokument.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.