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

Commit

Permalink
feat(Bindings): Add list of thing types supported by binding
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <chris@cd-jackson.com>
  • Loading branch information
cdjackson committed Jun 19, 2016
1 parent 09b0be5 commit c878517
Show file tree
Hide file tree
Showing 24 changed files with 289 additions and 26 deletions.
38 changes: 34 additions & 4 deletions src/app/configuration/bindingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ angular.module('Config.Bindings', [
'HABmin.configModel',
'HABmin.userModel',
'HABmin.bindingModel',
'HABmin.thingModel',
'Config.parameter',
'angular-growl',
'ngVis',
Expand All @@ -32,18 +33,24 @@ angular.module('Config.Bindings', [
data: {pageTitle: 'Bindings'},
resolve: {
// Make sure the localisation files are resolved before the controller runs
localisations: function (locale) {
return locale.ready('habmin');
localisations: function ($q, locale) {
return $q.all([
locale.ready('habmin'),
locale.ready('binding')
]);
}
}
});
})

.controller('BindingConfigCtrl',
function BindingConfigCtrl($scope, locale, growl, $timeout, $window, $http, $interval, UserService, BindingModel, ConfigModel) {
function BindingConfigCtrl($scope, locale, growl, $timeout, $window, $http, $interval, UserService, BindingModel, ConfigModel, ThingModel) {
$scope.panelDisplayed = 'DESCRIPTION';
$scope.bindings = null;
$scope.bindings = [];
$scope.bindingsCnt = -1;
$scope.thingTypes = [];
$scope.thingTypesCnt = -1;

BindingModel.getList().then(
function (bindings) {
$scope.bindings = bindings;
Expand All @@ -55,6 +62,17 @@ angular.module('Config.Bindings', [
}
);

ThingModel.getThingTypes().then(
function (list) {
$scope.thingTypes = list;
$scope.thingTypesCnt = list.length;
},
function (reason) {
// Handle failure
growl.warning(locale.getString("habmin.ErrorGettingThings"));
}
);

$scope.selectBinding = function (binding) {
$scope.setPanelDisplayed("DESCRIPTION");
$scope.bindingConfig = null;
Expand All @@ -77,6 +95,18 @@ angular.module('Config.Bindings', [
$scope.panelDisplayed = panel;
};

$scope.bindingThingType = function (thingType) {
if ($scope.selectedBinding == null) {
return false;
}

var bindingId = thingType.UID.split(":")[0];
if (bindingId == $scope.selectedBinding.id) {
return true;
}
return false;
};

$scope.bindingHasUngroupedParams = function () {
if ($scope.bindingConfig == null || $scope.bindingConfig.parameters == null) {
return false;
Expand Down
32 changes: 27 additions & 5 deletions src/app/configuration/bindingConfig.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ <h3 class="panel-title pull-left">
class="btn btn-default dropdown-toggle"
data-toggle="dropdown">
<span class="fa fa-cog"></span>
<span i18n="thing.Tools"></span>
<span i18n="habmin.Tools"></span>
<span class="caret"></span>
<span class="sr-only">Dropdown</span>
</button>
Expand All @@ -76,7 +76,7 @@ <h3 class="panel-title pull-left">
<a ng-click="showAdvancedSettings=!showAdvancedSettings">
<span class="fa fa-fw" ng-class="{'fa-check-square-o': showAdvancedSettings}"></span>
<span class="fa fa-fw fa-user-plus"></span>
<span i18n="thing.AdvancedMode"></span>
<span i18n="habmin.AdvancedMode"></span>
</a>
</li>
</ul>
Expand All @@ -93,12 +93,12 @@ <h3 class="panel-title pull-left">
ng-class="{'list-group-item config-panel-title':true, 'active': panelDisplayed=='DESCRIPTION'}"
ng-click="setPanelDisplayed('DESCRIPTION')">
<span class="fa fa-fw fa-book"></span>
<span i18n="thing.Description"></span>
<span i18n="habmin.Description"></span>
</a>
</div>
<div collapse="panelDisplayed!='DESCRIPTION'" class="panel-form">
<div class="habmin-info">
<label i18n="binding.Description"></label>
<label i18n="habmin.Description"></label>

<div class="well well-sm" ng-bind-html="selectedBinding.description">
</div>
Expand All @@ -113,6 +113,28 @@ <h3 class="panel-title pull-left">
</div>
</div>

<!-- THING TYPES -->
<div>
<a role="presentation"
ng-class="{'list-group-item config-panel-title':true, 'active': panelDisplayed=='THINGS'}"
ng-click="setPanelDisplayed('THINGS')">
<span class="fa fa-fw fa-plug"></span>
<span i18n="binding.ThingTypes"></span>
</a>
</div>
<div collapse="panelDisplayed!='THINGS'" class="panel-form">
<table class="table table-striped">
<tr ng-repeat="thingType in thingTypes | orderBy: 'label'" class="row"
ng-if="bindingThingType(thingType)">
<td>
<div>{{thingType.label}}</div>
<div class="small">{{thingType.properties.vendor}} {{thingType.properties.modelId}}</div>
<div class="small single-line" ng-bind-html="thingType.description"></div>
</td>
</tr>
</table>
</div>

<!-- CONFIGURATION GROUPS -->
<div ng-repeat="group in bindingConfig.parameterGroups">
<div>
Expand Down Expand Up @@ -142,7 +164,7 @@ <h3 class="panel-title pull-left">
ng-class="{'list-group-item list-group-item-heading':true, 'active': panelDisplayed=='CONFIG-ungrouped'}"
ng-click="setPanelDisplayed('CONFIG-ungrouped')">
<span class="fa fa-fw fa-wrench"></span>
<span i18n="thing.Configuration"></span>
<span i18n="habmin.Configuration"></span>
</a>
</div>
<div collapse="$parent.panelDisplayed!='CONFIG-ungrouped'"
Expand Down
4 changes: 4 additions & 0 deletions src/app/configuration/thingConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ angular.module('Config.Things', [
ThingModel.getList().then(
function (list) {
$scope.things = list;
},
function (reason) {
// Handle failure
growl.warning(locale.getString("habmin.ErrorGettingThings"));
}
);

Expand Down
10 changes: 5 additions & 5 deletions src/app/configuration/thingConfig.tpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
class="btn btn-default dropdown-toggle"
data-toggle="dropdown">
<span class="fa fa-cog"></span>
<span i18n="thing.Tools"></span>
<span i18n="habmin.Tools"></span>
<span class="caret"></span>
<span class="sr-only">Dropdown</span>
</button>
Expand All @@ -182,7 +182,7 @@
<a ng-click="showAdvancedSettings=!showAdvancedSettings">
<span class="fa fa-fw" ng-class="{'fa-check-square-o': showAdvancedSettings}"></span>
<span class="fa fa-fw fa-mortar-board"></span>
<span i18n="thing.AdvancedMode"></span>
<span i18n="habmin.AdvancedMode"></span>
</a>
</li>
</ul>
Expand All @@ -198,15 +198,15 @@
ng-class="{'list-group-item config-panel-title':true, 'active': panelDisplayed=='OVERVIEW'}"
ng-click="setPanelDisplayed('OVERVIEW')">
<span class="fa fa-fw fa-book"></span>
<span i18n="thing.Description"></span>
<span i18n="habmin.Description"></span>
</a>
</div>
<div collapse="panelDisplayed!='OVERVIEW'" class="panel-form">
<div i18n="thing.Label"></div>
<div class="well well-sm" ng-bind-html="selectedThingType.label">
</div>

<div i18n="thing.Description"></div>
<div i18n="habmin.Description"></div>
<div class="well well-sm" ng-bind-html="selectedThingType.description">
</div>

Expand Down Expand Up @@ -373,7 +373,7 @@
ng-class="{'list-group-item list-group-item-heading':true, 'active': panelDisplayed=='CONFIG-ungrouped'}"
ng-click="setPanelDisplayed('CONFIG-ungrouped')">
<span class="fa fa-fw fa-wrench"></span>
<span i18n="thing.Configuration"></span>
<span i18n="habmin.Configuration"></span>
</a>
</div>
<div collapse="$parent.panelDisplayed!='CONFIG-ungrouped'"
Expand Down
69 changes: 67 additions & 2 deletions src/app/tools/zwave/logService.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,11 @@ function ZWaveLogReader() {
var commandClasses = {
0: {
name: "NO_OPERATION",
processor: null
commands: {
1: {
name: "NO_OPERATION_PING"
}
}
},
32: {
name: "BASIC",
Expand Down Expand Up @@ -926,7 +930,34 @@ function ZWaveLogReader() {
}
},
102: {
name: "BARRIER_OPERATOR"
name: "BARRIER_OPERATOR",
commands: {
1: {
name: "BARRIER_OPERATOR_SET"
},
2: {
name: "BARRIER_OPERATOR_GET"
},
3: {
name: "BARRIER_OPERATOR_REPORT"
},
4: {
name: "BARRIER_OPERATOR_SIGNAL_SUPPORTED_GET"
},
5: {
name: "BARRIER_OPERATOR_SIGNAL_SUPPORTED_REPORT"
},
6: {
name: "BARRIER_OPERATOR_SIGNAL_SET"
},
7: {
name: "BARRIER_OPERATOR_SIGNAL_GET"
},
8: {
name: "BARRIER_OPERATOR_SIGNAL_REPORT"
}
},
processor: processBarrier
},
112: {
name: "CONFIGURATION",
Expand Down Expand Up @@ -1958,6 +1989,40 @@ function ZWaveLogReader() {
return data;
}

function processBarrier(node, endpoint, bytes) {
var data = {result: SUCCESS};

var cmdCls = HEX2DEC(bytes[0]);
var cmdCmd = HEX2DEC(bytes[1]);
data.content = getCommandClassName(cmdCls, cmdCmd);
switch (cmdCmd) {
case 3: // BARRIER_REPORT
var state = HEX2DEC(bytes[2]);
data.content += " <span class='label'>";
switch(state) {
case 0:
data.content += "CLOSED";
break;
case 252:
data.content += "CLOSING";
break;
case 253:
data.content += "STOPPED";
break;
case 254:
data.content += "OPENING";
break;
case 255:
data.content += "OPEN";
break;
}
data.content += "</span>";
break;
}

return data;
}

function processClock(node, endpoint, bytes) {
var data = {result: SUCCESS};

Expand Down
4 changes: 2 additions & 2 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,8 @@ <h4>
</a>
</li>

<li ui-sref="chart">
<a>
<li>
<a ui-sref="chart">
<i class="fa fa-fw fa-area-chart"></i>
<span i18n="habmin.ChartEditor"></span>
</a>
Expand Down
2 changes: 2 additions & 0 deletions src/languages/de-DE/common.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"Edit": "Bearbeiten",
"GroupSelectName": "Auswahl der Gruppe",
"add": "Hinzufügen",
"addAll": "Alle hinzufügen",
"appName": "HABmin",
"areYouSure": "Sind Sie sicher?",
"cancel": "Abbrechen",
Expand All @@ -16,6 +17,7 @@
"new": "Neu",
"no": "Nein",
"noResponse": "Keine Rückmeldung",
"none": "Keine",
"ok": "OK",
"open": "Öffnen",
"period10Minutes": "10 Minuten",
Expand Down
2 changes: 2 additions & 0 deletions src/languages/de-DE/discovery.lang.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
"ApproveAllConfirmMsg": "Sind Sie sich sicher, dass Sie alle Einträge aus der Eingangsbox als neue Things hinzufügen möchten?",
"ApproveAllConfirmTitle": "Genehmige alle Einträge in der Eingangsbox",
"ClearConfirmMsg": "Sind Sie sich sicher, dass Sie die Eingangsbox löschen möchten. Alle Things werden entfernt und müssen erneut gesucht werden.",
"ClearConfirmTitle": "Eingangsbox gelöscht",
"ClearFail": "Löschen der Eingangsbox für ein oder mehrere Elemente fehlgeschlagen.",
Expand Down
10 changes: 10 additions & 0 deletions src/languages/de-DE/extensions.lang.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"CommandFailed": "Fehler bei der Ausführung eines Kommandos: {message}",
"ErrorGettingExtensions": "Fehler beim Abrufen der Erweiterungsliste",
"ExtensionTypes": "Typ der Erweiterung",
"Extensions": "Erweiterung",
"Install": "Installieren",
"InstallOk": "Die Erweiterung {extension} wurde erfolgreich installiert",
"Uninstall": "Deinstallieren",
"UninstallOk": "Die Erweiterung {extension} wurde erfolgreich deinstalliert"
}
2 changes: 2 additions & 0 deletions src/languages/de-DE/habmin.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"ErrorLoadingDashboards": "Fehler beim Laden der Dashboard-Lste",
"ErrorLoadingInbox": "Fehler beim Laden des Posteingangs!",
"ErrorLoadingSitemaps": "Fehler beim Laden der Sitemapliste",
"Extensions": "Erweiterungen",
"GeneralPreferences": "Allgemeine Einstellungen",
"Items": "Elemente",
"Login": "Anmelden",
Expand All @@ -25,6 +26,7 @@
"OpenHABOffline": "OpenHAB ist offline!",
"Rules": "Regeln",
"Scheduler": "Zeitplan",
"Services": "Dienste",
"Sitemaps": "Sitemaps",
"StatusOffline": "Der Server it offline",
"StatusOnline": "Der Server it online",
Expand Down
2 changes: 2 additions & 0 deletions src/languages/de-DE/item.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"EditName": "Name",
"EditTitle": "Element bearbeiten",
"EditType": "Element-Typ",
"LinkOk": "Element ist mit dem Channel verknüpft",
"LinkTitle": "Verknüpfe das Element mit dem Channel",
"NameCopiedOk": "Name des Elements <b><i>{name}</i></b> in die Zwischenablage kopiert",
"SaveFailed": "Fehler beim Speichern des Elements <b><i>{name}</i></b>.<br />{message}",
"SaveLinkFailed": "Fehler beim Verknüpfen des Elements mit dem Channel <b><i>{name}</i></b>.<br />{message}",
Expand Down
3 changes: 3 additions & 0 deletions src/languages/de-DE/services.lang.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ErrorGettingServices": "Fehler beim Abrufen der Dienste"
}
4 changes: 3 additions & 1 deletion src/languages/de-DE/thing.lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
"ActionSentError": "Fehler beim senden der Aktion",
"ActionSentOk": "Aktion erfolgreich gesendet",
"AdvancedMode": "Erweiterte Einstellungen anzeigen",
"Attributes": "Eigenschaften",
"ChannelConfiguration": "Kanal Konfiguration",
"ChannelItems": "Verknüpfte Elemente",
"ChannelNoItems": "Kanal hat keine zugehörigen Elemente",
"Channels": "Kanäle",
"Configuration": "Konfiguration",
"Delete": "Löschen",
"DeleteCheck": "Soll dieser Gebäudeplan wirklich gelöscht werden?",
"DeleteItemFailed": "Fehler beim löschen des Elements vom Kanal",
"DeleteItemFailed": "Fehler beim Löschen des Elements vom Kanal: {message}",
"DeleteItemOk": "Element erfolgreich vom Kanal entfernt",
"Description": "Beschreibung",
"EditBridge": "Bridge",
Expand All @@ -20,6 +21,7 @@
"Label": "Kennzeichnung",
"New": "Neu",
"NoneFound": "Nichts gefunden",
"Pending": "in Arbeit ...",
"Properties": "Eigenschaften",
"Search": "Suche starten",
"SelectBridge": "Bridge auswählen",
Expand Down
Loading

0 comments on commit c878517

Please sign in to comment.