Added overview Zigbee Node page for troubleshooting
This commit is contained in:
parent
81dc81a1ae
commit
902d87a9c5
5 changed files with 191 additions and 6 deletions
|
|
@ -0,0 +1,129 @@
|
|||
<h1 class="page-header">Zigbee Node Overview</h1>
|
||||
|
||||
{{#nodes}}
|
||||
<div class="col-md-12">
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Node: {{.getIeeeAddress()}}</div>
|
||||
<div class="panel-body">
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Node Description</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-right">Manufacturer Code:</th>
|
||||
<td>{{.getNodeDescriptor().getManufacturerCode()}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right">Logical Type:</th>
|
||||
<td>{{.getNodeDescriptor().getLogicalType()}}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th class="text-right">Frequency Bands:</th>
|
||||
<td>{{.getNodeDescriptor().getFrequencyBands()}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right">Mac Capabilities:</th>
|
||||
<td>{{.getNodeDescriptor().getMacCapabilities()}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Power Descriptor</div>
|
||||
<div class="panel-body">
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-right">Current Power Mode:</th>
|
||||
<td>{{.getPowerDescriptor().getCurrentPowerMode()}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right">Available Power Sources:</th>
|
||||
<td>{{.getPowerDescriptor().getAvailablePowerSources()}}</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th class="text-right">Current Power Source:</th>
|
||||
<td>{{.getPowerDescriptor().getCurrentPowerSource()}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="text-right">Power Level:</th>
|
||||
<td>{{.getPowerDescriptor().getPowerLevel()}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
{{#.getEndpoints()}}
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Endpoint: {{.getDeviceId()}}</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<p>Input Clusters:</p>
|
||||
|
||||
{{#.inputClusters.values()}}
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Cluster: {{.getClusterId()}}</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Last Value</th>
|
||||
<th>Last Report Time</th>
|
||||
</thead>
|
||||
{{#.getAttributes()}}
|
||||
<tr>
|
||||
<td>{{.getId()}}</td>
|
||||
<td>{{.getName()}}</td>
|
||||
<td>{{.getLastValue()}}</td>
|
||||
<td><span class="timestamp">{{.getLastReportTime().getTimeInMillis()}}</span></td>
|
||||
</tr>
|
||||
{{/.getAttributes()}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{/.inputClusters.values()}}
|
||||
|
||||
<p>Output Clusters:</p>
|
||||
|
||||
{{#.outputClusters.values()}}
|
||||
<div class="panel panel-default drop-shadow">
|
||||
<div class="panel-heading">Cluster: {{.getClusterId()}}</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<table class="table table-hover table-condensed">
|
||||
<thead>
|
||||
<th>ID</th>
|
||||
<th>Name</th>
|
||||
<th>Last Value</th>
|
||||
<th>Last Report Time</th>
|
||||
</thead>
|
||||
{{#.getAttributes()}}
|
||||
<tr>
|
||||
<td>{{.getId()}}</td>
|
||||
<td>{{.getName()}}</td>
|
||||
<td>{{.getLastValue()}}</td>
|
||||
<td><span class="timestamp">{{.getLastReportTime().getTimeInMillis()}}</span></td>
|
||||
</tr>
|
||||
{{/.getAttributes()}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{{/.outputClusters.values()}}
|
||||
</div>
|
||||
</div>
|
||||
{{/.getEndpoints()}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/nodes}}
|
||||
|
|
@ -26,12 +26,11 @@ import se.hal.plugin.zigbee.device.*;
|
|||
import zutil.Timer;
|
||||
import zutil.log.LogUtil;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
|
|
@ -55,7 +54,6 @@ public class HalZigbeeController implements HalSensorController,
|
|||
private static final String CONFIG_ZIGBEE_DONGLE = "zigbee.dongle";
|
||||
|
||||
private ZigBeePort serialPort;
|
||||
private ZigBeeDataStore dataStore;
|
||||
protected ZigBeeNetworkManager networkManager;
|
||||
|
||||
private Timer permitJoinTimer;
|
||||
|
|
@ -80,7 +78,6 @@ public class HalZigbeeController implements HalSensorController,
|
|||
}
|
||||
public void initialize(String comPort, String dongleName) {
|
||||
serialPort = new ZigBeeJSerialCommPort(comPort, ZigBeeJSerialCommPort.DEFAULT_BAUD_RATE, ZigBeePort.FlowControl.FLOWCONTROL_OUT_RTSCTS);
|
||||
dataStore = new ZigBeeDataStore();
|
||||
TransportConfig transportOptions = new TransportConfig();
|
||||
|
||||
// ----------------------------
|
||||
|
|
@ -89,7 +86,7 @@ public class HalZigbeeController implements HalSensorController,
|
|||
|
||||
ZigBeeTransportTransmit dongle = getDongle(dongleName, serialPort, transportOptions);
|
||||
networkManager = new ZigBeeNetworkManager(dongle);
|
||||
networkManager.setNetworkDataStore(dataStore);
|
||||
networkManager.setNetworkDataStore(ZigBeeDataStore.getInstance());
|
||||
networkManager.setSerializer(DefaultSerializer.class, DefaultDeserializer.class);
|
||||
networkManager.addAnnounceListener(this);
|
||||
networkManager.addNetworkNodeListener(this);
|
||||
|
|
@ -235,6 +232,10 @@ public class HalZigbeeController implements HalSensorController,
|
|||
logger.fine("[Node: " + node.getIeeeAddress() + "]: Node registration has been removed.");
|
||||
}
|
||||
|
||||
public Set<ZigBeeNode> getNodes() {
|
||||
return networkManager.getNodes();
|
||||
}
|
||||
|
||||
// ------------------------------------------
|
||||
// Zigbee Endpoint Methods
|
||||
// ------------------------------------------
|
||||
|
|
|
|||
|
|
@ -36,10 +36,14 @@ import java.util.logging.Logger;
|
|||
|
||||
public class ZigBeeDataStore implements ZigBeeNetworkDataStore {
|
||||
private static final Logger logger = LogUtil.getLogger();
|
||||
private static ZigBeeDataStore instance;
|
||||
|
||||
private HashMap<IeeeAddress,ZigBeeNodeDao> devices = new HashMap<>();
|
||||
|
||||
|
||||
private ZigBeeDataStore() {}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<IeeeAddress> readNetworkNodes() {
|
||||
return devices.keySet();
|
||||
|
|
@ -69,4 +73,11 @@ public class ZigBeeDataStore implements ZigBeeNetworkDataStore {
|
|||
|
||||
devices.remove(address);
|
||||
}
|
||||
|
||||
|
||||
public static ZigBeeDataStore getInstance() {
|
||||
if (instance == null)
|
||||
instance = new ZigBeeDataStore();
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
package se.hal.plugin.zigbee.page;
|
||||
|
||||
import com.zsmartsystems.zigbee.ZigBeeNode;
|
||||
import se.hal.HalContext;
|
||||
import se.hal.intf.HalAbstractController;
|
||||
import se.hal.intf.HalAbstractControllerManager;
|
||||
import se.hal.intf.HalWebPage;
|
||||
import se.hal.plugin.zigbee.HalZigbeeController;
|
||||
import zutil.io.file.FileUtil;
|
||||
import zutil.parser.Templator;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class ZigbeeNodeOverviewPage extends HalWebPage {
|
||||
private static final String TEMPLATE = HalContext.RESOURCE_WEB_ROOT + "/zigbee_node_overview.tmpl";
|
||||
|
||||
public ZigbeeNodeOverviewPage() {
|
||||
super("zigbee_overview");
|
||||
super.getRootNav().createSubNav("Settings").createSubNav(this.getId(), "Zigbee Overview").setWeight(10_000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Templator httpRespond(
|
||||
Map<String, Object> session,
|
||||
Map<String, String> cookie,
|
||||
Map<String, String> request)
|
||||
throws Exception {
|
||||
|
||||
Set<ZigBeeNode> nodes = null;
|
||||
for (HalAbstractController controller : HalAbstractControllerManager.getControllers()) {
|
||||
if (controller instanceof HalZigbeeController) {
|
||||
nodes = ((HalZigbeeController) controller).getNodes();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Templator tmpl = new Templator(FileUtil.find(TEMPLATE));
|
||||
tmpl.set("nodes", nodes);
|
||||
return tmpl;
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@
|
|||
"name": "Hal-Zigbee",
|
||||
"description": "A Zigbee plugin for directly connecting to a CC2531 device over serial port.",
|
||||
"interfaces": [
|
||||
{"se.hal.intf.HalAutostartController": "se.hal.plugin.zigbee.HalZigbeeController"}
|
||||
{"se.hal.intf.HalAutostartController": "se.hal.plugin.zigbee.HalZigbeeController"},
|
||||
|
||||
{"se.hal.intf.HalWebPage": "se.hal.plugin.zigbee.page.ZigbeeNodeOverviewPage"}
|
||||
]
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue