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

Commit

Permalink
Merge branch 'binding-events'
Browse files Browse the repository at this point in the history
* binding-events:
  feat(UI): Add support for binding notifications
  fix(Chart): Fix error message when chart data can't be loaded Fixes #179
  chore(ZWave): Update log viewer
  feat(Mobile): Add server configuration to user preferences

Signed-off-by: Chris Jackson <chris@cd-jackson.com>

# Conflicts:
#	Gruntfile.js
#	package.json
#	src/app/user/userConfig.js
#	src/app/user/userConfig.tpl.html
  • Loading branch information
cdjackson committed Jul 31, 2016
2 parents 5758fbf + 6f21b50 commit d0e5413
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@ angular.module('HABmin', [
}, 100);

EventModel.listen();
BindingModel.listen();
})

.filter('orderObjectBy', function () {
Expand Down
27 changes: 25 additions & 2 deletions src/app/models/bindingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
*/
angular.module('HABmin.bindingModel', [
'HABmin.userModel',
'HABmin.restModel'
'HABmin.restModel',
'angular-growl',
])

.service('BindingModel', function ($http, $q, UserService, RestService) {
.service('BindingModel', function ($http, $q, UserService, RestService, growl) {
var svcBind = "bindings";
var svcDisc = "discovery";
var iconList = {
Expand All @@ -22,6 +23,28 @@ angular.module('HABmin.bindingModel', [
zwave: {icon: "zwave"}
};
var bindingList = [];
var eventSrc;

var me = this;

this.listen = function () {
eventSrc = new EventSource("/rest/events?topics=smarthome/binding/*");

eventSrc.addEventListener('message', function (event) {
console.log(event.data);

var evt = angular.fromJson(event.data);
var payload = angular.fromJson(evt.payload);
var topic = evt.topic.split("/");

switch (evt.type) {
case 'BindingEvent':
growl.warning(payload.message);
break;
}
});
};


this.getList = function () {
var tStart = new Date().getTime();
Expand Down
10 changes: 5 additions & 5 deletions src/app/tools/zwave/logService.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,9 @@ function ZWaveLogReader() {
}
},
0x07: {
name: "GARAGE_DOOR",
name: "SENSOR_NOTIFICATION",
specific: {
1: "SIMPLE_GARAGE_DOOR"
1: "NOTIFICATION_SENSOR"
}
},
0x08: {
Expand Down Expand Up @@ -3453,20 +3453,20 @@ function ZWaveLogReader() {
if (sendData.responseTime != "Unknown") {
updateNodeResponse(node, sendData.responseTime);
}
sendData.content += "ACK'd by device in " + sendData.responseTime +
sendData.content += "<span class='badge badge-success'>ACK RECEIVED</span> from device in " + sendData.responseTime +
"ms";
break;
case 1: // COMPLETE_NO_ACK
updateNodeResponse(node, -1);
setStatus(sendData, WARNING);
sendData.content += "No ACK after " + sendData.responseTime + "ms";
sendData.content += "<span class='badge badge-warning'>NO ACK</span> after " + sendData.responseTime + "ms";
sendData.warnFlag = true;
sendData.warnMessage = "No ack received from device";
break;
case 2: // COMPLETE_FAIL
updateNodeResponse(node, -1);
setStatus(sendData, ERROR);
sendData.content += "Failed in " + sendData.responseTime + "ms";
sendData.content += "<span class='badge badge-important'>FAILED</span> after " + sendData.responseTime + "ms";
break;
case 3: // COMPLETE_NOT_IDLE
updateNodeResponse(node, -1);
Expand Down
4 changes: 2 additions & 2 deletions src/app/user/userConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ angular.module('User.Config', [

$scope.model = {
currentLanguage: UserService.getLanguage(),
currentPersistence: "",
currentPersistence: UserService.getPersistence(),
serverAddress: UserService.getServer()
};
$scope.languages = [];
Expand Down Expand Up @@ -107,4 +107,4 @@ angular.module('User.Config', [
});

}
);
);
3 changes: 1 addition & 2 deletions src/languages/en-GB/services.lang.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"ErrorGettingServices": "Error getting service list",
"Services": "Services"
"ErrorGettingServices": "Error getting service list"
}

0 comments on commit d0e5413

Please # to comment.