diff --git a/plugins/hal-zigbee/README.md b/plugins/hal-zigbee/README.md index 71b93d7b..5b97a6b0 100644 --- a/plugins/hal-zigbee/README.md +++ b/plugins/hal-zigbee/README.md @@ -21,15 +21,16 @@ Instructions are originally from: https://www.zigbee2mqtt.io/information/flashin ### Windows 1. Download and install the "SmartRF Flash Programmer" **(Not v2)** application from https://www.ti.com/tool/FLASH-PROGRAMMER +2. Download Z-STACK software (We do not actually need the software just the firmware binary that is included in the installation) from https://www.ti.com/tool/Z-STACK (You will need to create an account to download) -2. Connect CC debugger to the CC2531 USB sniffer. -3. Connect **BOTH** the CC2531 USB sniffer and the CC debugger to your PC using USB. +3. Connect CC debugger to the CC2531 USB sniffer. +4. Connect **BOTH** the CC2531 USB sniffer and the CC debugger to your PC using USB. * If the light on the CC debugger is RED press set reset button on the CC debugger. The light on the CC debugger should now turn GREEN. If not use [CC debugger user guide](http://www.ti.com/lit/ug/swru197h/swru197h.pdf) to troubleshoot your problem. -4. Download the firmware [CC2531_DEFAULT_20190608.zip](https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_Home_1.2/bin/default/CC2531_DEFAULT_20190608.zip) -4. Start SmartRF Flash Programmer, with the properties below: - * Flash image: Make sure to select the .hex file and not the .bin file. - * Uncheck "Retain IEEE address when reprogramming the chip. +6. Start SmartRF Flash Programmer, with the properties below: + * Flash image: Locate the binary at \Projects\zstack\ZNP\CC253x\dev\ (Make sure to select the .hex file and not the .bin file). + * Uncheck "Retain IEEE address when reprogramming the chip". +7. Press "Perform Action" to start flashing. ### Linux or MacOS @@ -50,8 +51,11 @@ Instructions are originally from: https://www.zigbee2mqtt.io/information/flashin 3. Connect **BOTH** the CC2531 USB sniffer and the CC debugger to your PC using USB. * If the light on the CC debugger is RED press set reset button on the CC debugger. The light on the CC debugger should now turn GREEN. If not use [CC debugger user guide](http://www.ti.com/lit/ug/swru197h/swru197h.pdf) to troubleshoot your problem. -4. Download the firmware [CC2531_DEFAULT_20190608.zip](https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_Home_1.2/bin/default/CC2531_DEFAULT_20190608.zip) +4. Download the firmware [CC2531_DEFAULT_xxxxxxx.zip](https://github.com/Koenkk/Z-Stack-firmware/raw/master/coordinator/Z-Stack_Home_1.2/bin/default/CC2531_DEFAULT_20201127.zip) (If link is dead try latest version [here](https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/Z-Stack_Home_1.2/bin/default)) 5. Flash your firmware: sudo ./cc-tool -e -w CC2531ZNP-Prod.hex +## References + +* CCDEBUGGER user guide: http://www.ti.com/lit/ug/swru197h/swru197h.pdf \ No newline at end of file diff --git a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java index 4fe90f3f..a35f1002 100644 --- a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java +++ b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java @@ -105,11 +105,11 @@ public class HalZigbeeController implements HalSensorController, HalEventControl // Other stuff // ----------- - if (dongle instanceof ZigBeeDongleTiCc2531) { + /*if (dongle instanceof ZigBeeDongleTiCc2531) { ZigBeeDongleTiCc2531 tiDongle = (ZigBeeDongleTiCc2531) dongle; tiDongle.setLedMode(1, false); tiDongle.setLedMode(2, false); - } + }*/ } private static ZigBeeTransportTransmit getDongle(String name, ZigBeePort serialPort, TransportConfig transportOptions) { diff --git a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeDataStore.java b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeDataStore.java index e682915b..48b40f50 100644 --- a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeDataStore.java +++ b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/ZigBeeDataStore.java @@ -30,13 +30,13 @@ import com.zsmartsystems.zigbee.database.ZigBeeNodeDao; import zutil.log.LogUtil; import java.util.HashMap; -import java.util.HashSet; import java.util.Set; import java.util.logging.Logger; public class ZigBeeDataStore implements ZigBeeNetworkDataStore { private static final Logger logger = LogUtil.getLogger(); + private HashMap devices = new HashMap<>(); @@ -54,7 +54,14 @@ public class ZigBeeDataStore implements ZigBeeNetworkDataStore { @Override public void writeNode(ZigBeeNodeDao node) { - System.out.println("ZigBeeDataStore.writeNode(" + node + ")"); + System.out.println("ZigBeeDataStore.writeNode(" + + "IeeAddr: " + node.getIeeeAddress() + ", " + + "binding: "+node.getBindingTable()+", " + + "description: "+node.getNodeDescriptor()+", " + + "endpoints: "+node.getEndpoints()+", " + + "NetAddr: "+node.getNetworkAddress()+", " + + "Power: "+node.getPowerDescriptor()+", " + + ")"); devices.put(node.getIeeeAddress(), node); } diff --git a/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java b/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java index 2b3534d1..c7fb5148 100644 --- a/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java +++ b/plugins/hal-zigbee/test/se/hal/plugin/zigbee/HalZigbeeControllerTest.java @@ -24,6 +24,7 @@ package se.hal.plugin.zigbee; +import com.zsmartsystems.zigbee.ZigBeeEndpoint; import com.zsmartsystems.zigbee.ZigBeeNetworkManager; import com.zsmartsystems.zigbee.ZigBeeNode; import zutil.log.CompactLogFormatter; @@ -35,17 +36,13 @@ import java.util.logging.Level; public class HalZigbeeControllerTest { - public static void main(String[] args) throws IOException, InterruptedException { + public static void main(String[] args) throws IOException { LogUtil.readConfiguration("logging.properties"); LogUtil.setGlobalFormatter(new CompactLogFormatter()); LogUtil.setGlobalLevel(Level.ALL); HalZigbeeController controller = new HalZigbeeController(); - controller.initialize("COM4", HalZigbeeController.ZIGBEE_DONGLE_CONBEE); - - System.out.println("PAN ID = " + controller.networkManager.getZigBeePanId()); - System.out.println("Extended PAN ID = " + controller.networkManager.getZigBeeExtendedPanId()); - System.out.println("Channel = " + controller.networkManager.getZigBeeChannel()); + controller.initialize("COM5", HalZigbeeController.ZIGBEE_DONGLE_CC2531); handleConsoleInput('h', controller.networkManager); @@ -62,9 +59,21 @@ public class HalZigbeeControllerTest { private static void handleConsoleInput(char input, ZigBeeNetworkManager networkManager) { switch (input) { + case 'i': + System.out.println("PAN ID = " + networkManager.getZigBeePanId()); + System.out.println("Extended PAN ID = " + networkManager.getZigBeeExtendedPanId()); + System.out.println("Channel = " + networkManager.getZigBeeChannel()); + break; + case 'l': for (ZigBeeNode node : networkManager.getNodes()) { System.out.println(node); + + for (ZigBeeEndpoint endpoint : node.getEndpoints()) { + System.out.println(" - " + endpoint); + } + + System.out.println(" Number of Endpoints: " + node.getEndpoints().size()); } System.out.println("Number of ZigBee Nodes: " + networkManager.getNodes().size()); break; @@ -81,6 +90,7 @@ public class HalZigbeeControllerTest { case 'h': default: System.out.println("Available commands:"); + System.out.println(" i: List network info"); System.out.println(" l: List available ZigBee Nodes"); System.out.println(" p: Enable pairing of ZigBee devices"); System.out.println(" q: Quit");