Code Monkey home page Code Monkey logo

zbpy's Introduction

Gecko Zigbee Python interface

This is a pure Python implementation of a IEEE802.15.4 and ZigBee network stack that works with MicroPython.

It was developed for the Silicon Labs Gecko boards used in Ikea Tradfri devices. The firmware port of MicroPython lives in osresearch/micropython/ports/efm32. The underlying ZigBee radio interface also lives in the machine specific port for that board; this is the hardware agnostic software stack that processes the packets.

For more information on the project, see Ikea+Micropython lightning talk.

Installing

Ikea Tradfri remote with header attached

See the README in the MicroPython port for details on building and installing using OpenOCD + SWD.

Using ampy.py you can install all of the code from the ZbPy directory into the flash on the device.

ZigBee network layers

  • Phyiscal layer (handled by the radio, supported via import Radio)
  • IEEE802.15.4: import ZbPy.IEEE802154
  • NWK - Network Layer: import ZbPy.ZigbeeNetwork
  • Security Layer (not really a layer, an optional part of the NWK header)
  • APS - Application Support Layer: import ZbPy.ZigbeeApplication
  • ZCL - ZigBee Cluster Library: import ZbPy.ZigbeeCluster

Most of the layers are sufficiently implemented to join an existing Zigbee network, receive a 16-bit short network address, decrypt+validate and encrypt+mac messages encrypted with the AES-CCM mode.

The Application and Cluster layers are only partially implemented right now; the messages are decoded but not mapped to functionality. Perhaps parts of ZigPy can be ported to MicroPython to provide these mappings.

Debugging Zigbee

It is easiest to use zbsniff in this tree, talking to an Ikea device on /dev/ttyACM0, which will output a PCAP file on stdout. You can pipe this to wireshark to trace what is going on:

zbsniff | wireshark -k -i -

However, there is lots of "noise" in the Zigbee protocol with repeat messages, acks, etc that make the wireshark display messy.

Don't display acks: !(wpan.frame_type == 0x2) Don't display repeats: (!(wpan.frame_type == 0x1) || wpan.src16 == zbee_nwk.src)

zbpy's People

Contributors

osresearch avatar

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.