Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Commit

Permalink
feat(Things): Add thing property/attribute display
Browse files Browse the repository at this point in the history
  • Loading branch information
cdjackson committed May 21, 2016
1 parent 5474924 commit 85173b9
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 6 deletions.
Empty file.
12 changes: 11 additions & 1 deletion src/app/configuration/thingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ angular.module('Config.Things', [
return true;
};

$scope.dec2hex = function(value, places) {
var template = "";
for(var c = 0; c < places; c++) {
template += "0";
}
return (template + Number(value).toString(16)).substr(-places);
};

$scope.checkActions = function () {
return function (config) {
if (config.groupName != 'actions') {
Expand Down Expand Up @@ -649,6 +657,7 @@ angular.module('Config.Things', [

// Check if anything at thing level needs updating
var thingUpdated = false;
var updatedThing = {};
if ($scope.thingConfigForm.modifiedChildFormsCount !== 0) {
angular.forEach($scope.thingConfigForm.modifiedChildForms, function (childForm) {
var channel = $scope.getChannel(childForm.$name);
Expand Down Expand Up @@ -683,10 +692,11 @@ angular.module('Config.Things', [
});
}

// Check if the linked item information has changed
// Check if the name has changed
if ($scope.thingConfigForm.thingLabel.$dirty === true) {
//|| $scope.thingConfigForm.itemCategory.$dirty === true || $scope.thingConfigForm.itemGroups.$dirty) {
thingUpdated = true;
updatedThing['label'] = $scope.thingConfigForm.thingLabel;
}

if (thingUpdated === true) {
Expand Down
26 changes: 24 additions & 2 deletions src/app/configuration/thingConfig.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@
</div>
<div class="pull-right">
<ng-include bs-modifiable="false"
ng-init="cfgType='CFG';"
src="'configuration/itemWidget.tpl.html'">
ng-init="cfgType='CFG';"
src="'configuration/itemWidget.tpl.html'">
</ng-include>
</div>
</div>
Expand Down Expand Up @@ -560,6 +560,28 @@
</div>
</div>

<!-- ATTRIBUTES -->
<div>
<a role="presentation"
ng-class="{'list-group-item config-panel-title':true, 'active': panelDisplayed=='ATTRIBUTES'}"
ng-click="setPanelDisplayed('ATTRIBUTES')">
<span class="fa fa-fw fa-pencil-square"></span>
<span i18n="thing.Attributes"></span>
</a>
</div>
<div collapse="panelDisplayed!='ATTRIBUTES'" class="panel-form">
<div ng-switch="selectedThing.thingTypeUID.split(':')[0]">
<div ng-switch-when="zwave">
<ng-include src="'configuration/thingAttributesZWave.tpl.html'"></ng-include>
</div>

<div ng-switch-default>
<div class="row" ng-repeat="(attName, attValue) in selectedThing.properties">
<div class="col-md-4">{{attName}}</div>
<div class="col-md-8">{{attValue}}</div>
</div>
</div>
</div>
</form>
</div>

Expand Down
28 changes: 26 additions & 2 deletions src/app/tools/zwave/logService.js
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ function ZWaveLogReader() {
}
},
102: {
name: "BARRIER_OPERATOR",
name: "BARRIER_OPERATOR"
},
112: {
name: "CONFIGURATION",
Expand Down Expand Up @@ -1410,6 +1410,11 @@ function ZWaveLogReader() {
processor: processSecureError,
ref: "Security"
},
{
string: "SECURITY_SENT",
processor: processSecureDataTx,
ref: "Security"
},
{
string: "SECURITY_RECEIVED",
processor: processSecureDataRx,
Expand Down Expand Up @@ -1713,14 +1718,33 @@ function ZWaveLogReader() {
var bytes = clearData.split(' ');

// First byte is sequence field
HEX2DEC(bytes[0]);
// HEX2DEC(bytes[0]);

data.endClassPacket = processCommandClass(node, 0, bytes.slice(1));

data.content = content + data.endClassPacket.content;
return data
}

function processSecureDataTx(node, process, message) {
var data = {
node: node
};

var content = "<span class='badge badge-info'><span class='text-error icon-lock'></span>SECURE TXD</span> ";

var clearData = message.substr(message.indexOf("SECURITY_SENT ") + 14).trim();
var bytes = clearData.split(' ');

// First byte is sequence field
// HEX2DEC(bytes[0]);

data.endClassPacket = processCommandClass(node, 0, bytes);

data.content = content + data.endClassPacket.content;
return data
}

function processSecureInitialize(node, process, message) {
var pos;

Expand Down
3 changes: 2 additions & 1 deletion src/languages/en-GB/thing.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
"ChannelUnlinkTitle": "Unlink Item from Channel",
"ChannelUnlinkConfirm": "Are you sure you wish to unlink the item from the channel?<br>This will not delete the item, and you will be able to relink it later if you wish.",
"ChannelDeleteTitle": "Delete Item from Channel",
"ChannelDeleteConfirm": "Are you sure you wish to delete the item and unlink it from the channel?<br>This will completely delete the item!"
"ChannelDeleteConfirm": "Are you sure you wish to delete the item and unlink it from the channel?<br>This will completely delete the item!",
"Attributes": "Attributes"
}
11 changes: 11 additions & 0 deletions src/languages/en-GB/zwave.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,19 @@
"RemoveFailedText": "Are you sure you wish to delete node '{nodenumber}' from the network?",
"Unknown": "Unknown",
"ThingName": "Thing Name",
"BasicClass": "Basic Class",
"GenericClass": "Generic Class",
"SpecificClass": "Specific Class",
"Neighbors": "Neighbours",
"Manufacturer": "Manufacturer",
"TypeId": "Type / ID",
"FirmwareVersion": "Firmware Version",
"Routing": "Routing",
"Beaming": "Beaming",
"Listening": "Listening",
"FrequentlyListening": "Frequently Listening",
"WakeupTime": "Last Wakeup Time",
"ZWavePlusDeviceType": "Z-Wave Plus Type",
"ZWPlus_UNKNOWN_TYPE": "Unknown",
"ZWPlus_CENTRAL_CONTROLLER": "Central Controller",
"ZWPlus_DISPLAY_SIMPLE": "Display Simple",
Expand Down

0 comments on commit 85173b9

Please sign in to comment.