diff --git a/hal.conf.example b/hal.conf.example index d543e99b..6fe74ed4 100755 --- a/hal.conf.example +++ b/hal.conf.example @@ -26,6 +26,7 @@ hal.http_port=8080 ## Zigbee plugin #zigbee.com_port=COM4 +#zigbee.pan_id=-6480 ## ZWave plugin #zwave.com_port=COM4 diff --git a/plugins/hal-zigbee/README.md b/plugins/hal-zigbee/README.md index 11df18bb..71b93d7b 100644 --- a/plugins/hal-zigbee/README.md +++ b/plugins/hal-zigbee/README.md @@ -3,6 +3,7 @@ |Config Parameter |Value |Description | |-----------------|-----------------------------|------------| |zwave.com_port |Name or location of com port |The port where radio dongle is connected| +|zigbee.pan_id |Integer |The PAN ID for the radio module| # Hardware 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 54bbdf95..8320a40a 100644 --- a/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java +++ b/plugins/hal-zigbee/src/se/hal/plugin/zigbee/HalZigbeeController.java @@ -19,6 +19,7 @@ public class HalZigbeeController implements HalSensorController, HalEventControl private static final Logger logger = LogUtil.getLogger(); private static final String CONFIG_ZIGBEE_PORT = "zigbee.com_port"; + private static final String CONFIG_ZIGBEE_PANID = "zigbee.pan_id"; private SerialPort port; private ZigBeeApiDongleImpl zigbeeApi; @@ -33,13 +34,16 @@ public class HalZigbeeController implements HalSensorController, HalEventControl @Override public boolean isAvailable() { - return HalContext.containsProperty(CONFIG_ZIGBEE_PORT); + return HalContext.containsProperty(CONFIG_ZIGBEE_PORT) && + HalContext.containsProperty(CONFIG_ZIGBEE_PANID); } @Override public void initialize() { - initialize(HalContext.getStringProperty(CONFIG_ZIGBEE_PORT)); + initialize( + HalContext.getStringProperty(CONFIG_ZIGBEE_PORT), + HalContext.getIntegerProperty(CONFIG_ZIGBEE_PANID)); } - public void initialize(String comPort) { + public void initialize(String comPort, int panId) { byte[] networkKey = null; // Default network key port = new SerialPortJSC(comPort); zigbeeApi = new ZigBeeApiDongleImpl( @@ -102,6 +106,4 @@ public class HalZigbeeController implements HalSensorController, HalEventControl public void setListener(HalSensorReportListener listener) { sensorListener = listener; } - - }