Skip to content

Commit

Permalink
Updated com port logging. Update Ember library to fix synchronisation…
Browse files Browse the repository at this point in the history
… issue. (#23)

Signed-off-by: Chris Jackson <chris@cd-jackson.com>
  • Loading branch information
cdjackson committed Aug 15, 2017
1 parent efe126d commit 974c26b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 6 deletions.
Binary file modified lib/com.zsmartsystems.zigbee-1.0.0-SNAPSHOT-sources.jar
Binary file not shown.
Binary file modified lib/com.zsmartsystems.zigbee-1.0.0-SNAPSHOT.jar
Binary file not shown.
Binary file not shown.
Binary file modified lib/com.zsmartsystems.zigbee.dongle.cc2531-1.0.0-SNAPSHOT.jar
Binary file not shown.
Binary file not shown.
Binary file modified lib/com.zsmartsystems.zigbee.dongle.ember-1.0.0-SNAPSHOT.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import org.eclipse.smarthome.core.thing.Bridge;
import org.eclipse.smarthome.core.thing.ChannelUID;
import org.eclipse.smarthome.core.thing.Thing;
import org.eclipse.smarthome.core.thing.ThingStatus;
import org.eclipse.smarthome.core.thing.ThingStatusDetail;
import org.eclipse.smarthome.core.types.Command;
import org.openhab.binding.zigbee.ZigBeeBindingConstants;
import org.slf4j.Logger;
Expand Down Expand Up @@ -104,7 +106,7 @@ public void thingUpdated(Thing thing) {
}

private void openSerialPort(final String serialPortName, int baudRate) {
logger.info("Connecting to serial port [{}]", serialPortName);
logger.info("Connecting to serial port [{}] at {}", serialPortName, baudRate);
try {
CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(serialPortName);
CommPort commPort = portIdentifier.open("org.openhab.binding.zigbee", 2000);
Expand All @@ -123,17 +125,20 @@ private void openSerialPort(final String serialPortName, int baudRate) {

logger.info("Serial port [{}] is initialized.", portId);
} catch (NoSuchPortException e) {
logger.error("Serial Error: Port {} does not exist", serialPortName);
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
"Serial Error: Port" + serialPortName + " does not exist");
return;
} catch (PortInUseException e) {
logger.error("Serial Error: Port {} in use.", serialPortName);
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
"Serial Error: Port" + serialPortName + " is in use");
return;
} catch (UnsupportedCommOperationException e) {
logger.error("Serial Error: Unsupported comm operation on Port {}.", serialPortName);
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
"Serial Error: Unsupported comm operation on Port " + serialPortName);
return;
} catch (TooManyListenersException e) {
// TODO Auto-generated catch block
e.printStackTrace();
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.OFFLINE.COMMUNICATION_ERROR,
"Serial Error: Too many listeners on Port " + serialPortName);
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import com.zsmartsystems.zigbee.ZigBeeNetworkNodeListener;
import com.zsmartsystems.zigbee.ZigBeeNetworkStateListener;
import com.zsmartsystems.zigbee.ZigBeeNode;
import com.zsmartsystems.zigbee.internal.ZigBeeNetworkMeshMonitor;
import com.zsmartsystems.zigbee.serialization.ZigBeeDeserializer;
import com.zsmartsystems.zigbee.serialization.ZigBeeSerializer;
import com.zsmartsystems.zigbee.transport.ZigBeeTransportState;
Expand Down Expand Up @@ -95,6 +96,7 @@ public abstract class ZigBeeCoordinatorHandler extends BaseBridgeHandler

private ScheduledFuture<?> restartJob = null;

private ZigBeeNetworkMeshMonitor meshMonitor;
private ZigBeeDiscoveryService discoveryService;
private ServiceRegistration discoveryRegistration;

Expand Down Expand Up @@ -363,6 +365,10 @@ private void initialiseZigBee() {
} catch (IllegalStateException e) {
logger.debug("Error updating configuration", e);
}

// Start the mesh monitor
meshMonitor = new ZigBeeNetworkMeshMonitor(networkManager);
meshMonitor.startup(86400);
}

// Create random network key
Expand Down

1 comment on commit 974c26b

@openhab-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/zigbee-binding/15763/383

Please sign in to comment.