diff --git a/Gruntfile.js b/Gruntfile.js index df0db268..3ce0b04c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -102,12 +102,7 @@ module.exports = function (grunt) { addons: { expand: true, src: ['addons/**'], - dest: 'build/addons/' - }, - images: { - expand: true, - src: ['images/**'], - dest: 'build/webapps/habmin/' + dest: 'build/' }, xml: { expand: true, diff --git a/README.md b/README.md index 91fa7050..9cf84daf 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ Updates ------- +* 30-04-2014: Initial graphical rule designer ready for testing (see the [rules branch](https://github.com/cdjackson/HABmin/tree/rules) for code, or [the overview here](https://github.com/cdjackson/HABmin/wiki/Rule-Designer:-Overview)) * 18-04-2014: Add ability to view _HABmin_ charts wihin openHAB sitemap. * 22-03-2014: Add a 'data pending' indicator in zwave to show when a configuration has not been confirmed. * 02-02-2014: Updated item editing to extend toolbar across all tabs. Added a filter option to filter listed items. diff --git a/addons/org.openhab.binding.zwave-1.5.0-SNAPSHOT.jar b/addons/org.openhab.binding.zwave-1.5.0-SNAPSHOT.jar index a4f2f211..9cff1e95 100644 Binary files a/addons/org.openhab.binding.zwave-1.5.0-SNAPSHOT.jar and b/addons/org.openhab.binding.zwave-1.5.0-SNAPSHOT.jar differ diff --git a/app/config/zwaveDeviceList.js b/app/config/zwaveDeviceList.js index d30cd5dd..7f34198c 100644 --- a/app/config/zwaveDeviceList.js +++ b/app/config/zwaveDeviceList.js @@ -54,7 +54,7 @@ Ext.define('openHAB.config.zwaveDeviceList', { if (!node.hasChildNodes()) { return []; - } else if(node.isVisible()) { + } else if (node.isVisible()) { allNodes.push(node.get("domain")); node.eachChild(function (Mynode) { allNodes = allNodes.concat(getChildLeafNodes(Mynode)); @@ -83,7 +83,7 @@ Ext.define('openHAB.config.zwaveDeviceList', { }, { icon: 'images/bandaid--arrow.png', - itemId: 'heal', + itemId: 'heal-all', text: language.zwave_DevicesHealButton, cls: 'x-btn-icon', disabled: false, @@ -101,7 +101,50 @@ Ext.define('openHAB.config.zwaveDeviceList', { } }); } - } + }, + { + icon: 'images/wrench--plus.png', + itemId: 'include', + text: language.zwave_DevicesIncludeButton, + cls: 'x-btn-icon', + disabled: false, + tooltip: language.zwave_DevicesIncludeButtonTip, + handler: function () { + Ext.Ajax.request({ + url: HABminBaseURL + '/zwave/action/binding/network/', + method: 'PUT', + jsonData: 'Include', + headers: {'Accept': 'application/json'}, + success: function (response, opts) { + }, + failure: function () { + handleStatusNotification(NOTIFICATION_ERROR, language.zwave_DevicesActionError); + } + }); + } + }, + { + icon: 'images/wrench--minus.png', + itemId: 'exclude', + text: language.zwave_DevicesExcludeButton, + cls: 'x-btn-icon', + disabled: false, + tooltip: language.zwave_DevicesExcludeButtonTip, + handler: function () { + Ext.Ajax.request({ + url: HABminBaseURL + '/zwave/action/binding/network/', + method: 'PUT', + jsonData: 'Exclude', + headers: {'Accept': 'application/json'}, + success: function (response, opts) { + }, + failure: function () { + handleStatusNotification(NOTIFICATION_ERROR, language.zwave_DevicesActionError); + } + }); + } + }, + '-' ] }); @@ -204,7 +247,9 @@ Ext.define('openHAB.config.zwaveDeviceList', { // Check that the value is within limits var limitError = false; if (limitError == true) { - handleStatusNotification(NOTIFICATION_WARNING, sprintf(language.zwave_DevicesValueUpdateRangeError, e.record.get('minimum'), e.record.get('maximum'))); + handleStatusNotification(NOTIFICATION_WARNING, + sprintf(language.zwave_DevicesValueUpdateRangeError, e.record.get('minimum'), + e.record.get('maximum'))); return; } @@ -218,7 +263,8 @@ Ext.define('openHAB.config.zwaveDeviceList', { success: function (response, opts) { }, failure: function () { - handleStatusNotification(NOTIFICATION_ERROR, language.zwave_DevicesValueUpdateError); + handleStatusNotification(NOTIFICATION_ERROR, + language.zwave_DevicesValueUpdateError); } }); } @@ -268,7 +314,7 @@ Ext.define('openHAB.config.zwaveDeviceList', { return ""; // If the status is PENDING, then mark it so... - if(record.get('state') == "PENDING") + if (record.get('state') == "PENDING") meta.style = 'background-color: #FDFD96;border-radius: 8px;'; // If this is a list, then we want to display the value, not the number! @@ -333,7 +379,7 @@ Ext.define('openHAB.config.zwaveDeviceList', { listeners: { select: function (grid, record, index, eOpts) { // Remove all current action buttons - for (var cnt = 2; cnt < toolbar.items.length; cnt++) { + for (var cnt = toolbar.items.length; cnt >= 5; cnt--) { toolbar.remove(toolbar.items.get(cnt), true); } @@ -352,35 +398,35 @@ Ext.define('openHAB.config.zwaveDeviceList', { var name = record.get("name"); // Add any actions for the selected item -// for (var cnt = 0; cnt < actions.length; cnt++) { - var x = { -// itemId:"action" + 0, - icon: 'images/gear.png', - cls: 'x-btn-icon', - text: actions[0].value, - handler: function () { - var data = {}; - data.action = actions[0].key; -// data.name = name; - Ext.Ajax.request({ - url: HABminBaseURL + '/zwave/action/' + domain, - method: 'PUT', - jsonData: actions[0].key, - headers: {'Accept': 'application/json'}, - success: function (response, opts) { - }, - failure: function () { - handleStatusNotification(NOTIFICATION_ERROR, language.zwave_DevicesActionError); - } - }); - } - }; + for (var cnt = 0; cnt < actions.length; cnt++) { + var x = { + itemId: "action" + cnt, + icon: 'images/gear-small.png', + cls: 'x-btn-icon', + text: actions[cnt].value, + handler: function () { + var data = {}; + data.action = actions[cnt].key; + data.name = name; + Ext.Ajax.request({ + url: HABminBaseURL + '/zwave/action/' + domain, + method: 'PUT', + jsonData: actions[cnt].key, + headers: {'Accept': 'application/json'}, + success: function (response, opts) { + }, + failure: function () { + handleStatusNotification(NOTIFICATION_ERROR, language.zwave_DevicesActionError); + } + }); + } + }; - toolbar.add(x); -// } + toolbar.add(x); + } // Get the node ID - var nodeName; + // var nodeName; }, afteritemexpand: function (node, index, item, eOpts) { // Get a list of all children nodes @@ -417,6 +463,7 @@ Ext.define('openHAB.config.zwaveDeviceList', { type: 'rest', url: HABminBaseURL + '/zwave/' + this.nodePollingTable[cnt], method: 'GET', + timeout: 3500, success: function (response, opts) { var res = Ext.decode(response.responseText); if (res == null || res.records == null) diff --git a/app/config/zwaveInclude.js b/app/config/zwaveInclude.js new file mode 100644 index 00000000..0c12939c --- /dev/null +++ b/app/config/zwaveInclude.js @@ -0,0 +1,132 @@ +/** + * HABmin - the openHAB admin interface + * + * openHAB, the open Home Automation Bus. + * Copyright (C) 2010-2013, openHAB.org + * + * See the contributors.txt file in the distribution for a + * full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + * + * Additional permission under GNU GPL version 3 section 7 + * + * If you modify this Program, or any covered work, by linking or + * combining it with Eclipse (or a modified version of that library), + * containing parts covered by the terms of the Eclipse Public License + * (EPL), the licensors of this Program grant you additional permission + * to convey the resulting work. + */ + +/** + * OpenHAB Admin Console HABmin + * + * @author Chris Jackson + */ + + +Ext.define('openHAB.config.zwaveInclud', { + extend: 'Ext.window.Window', + closeAction: 'destroy', + width: 750, + resizable: false, + draggable: false, + modal: true, + itemId: 'zwaveInclude', + layout: { + type: 'vbox', + align: 'stretch' + }, + chartId: null, + initComponent: function () { + this.title = language.zwave_IncludeTitle; + + var me = this; + + var deviceTypeStore = Ext.create('Ext.data.Store', { + fields: ['name'], + data: [ + {name: 'any', label: 'Any Device'}, + {name: 'controller', label: 'Controller'}, + {name: 'slave', label: 'Slave'} + ] + }); + + var includeForm = Ext.create('Ext.form.Panel', { + xtype: 'form', + cls: 'save-chart-form', + title: language.graph_SaveGraphChartConfig, + border: true, + bodyPadding: 10, + fieldDefaults: { + labelAlign: 'left', + labelWidth: 60, + labelStyle: 'font-weight:bold', + anchor: '100%' + }, + items: [ + { + xtype: 'combobox', + name: 'type', + fieldLabel: language.zwave_IncludeDeviceType, + store: deviceTypeStore, + allowBlank: false, + valueField: 'name', + displayField: 'label', + forceSelection: true, + editable: false, + queryMode: 'local' + }, + { + xtype: 'checkboxfield', + name: 'power', + fieldLabel: language.zwave_IncludeHighPower + } + ] + }); + + this.items = [includeForm];//, chanList]; + this.callParent(); + }, + buttons: [ + { + text: language.cancel, + handler: function () { + this.up('window').destroy(); + } + }, + { + text: language.save, + handler: function () { + if (me.chartForm.isValid() == false) { + return; + } + + Ext.Ajax.request({ + url: HABminBaseURL + '/zwave/action/binding/network/', + method: 'PUT', + jsonData: 'Include', + headers: {'Accept': 'application/json'}, + success: function (response, opts) { + }, + failure: function () { + handleStatusNotification(NOTIFICATION_ERROR, language.zwave_DevicesActionError); + } + }); + } + } + ] +}) +; + diff --git a/app/graph/itemList.js b/app/graph/itemList.js index 0f7003db..1f5d83e4 100644 --- a/app/graph/itemList.js +++ b/app/graph/itemList.js @@ -76,7 +76,7 @@ Ext.define('openHAB.graph.itemList', { var saveGraph = Ext.create('openHAB.graph.saveGraph'); var config = createConfig(); - config.period = 86400; + config.period = "86400"; saveGraph.setData(config); saveGraph.show(); } diff --git a/app/language/language.js b/app/language/language.js index f1b8e0ad..a3bc9149 100644 --- a/app/language/language.js +++ b/app/language/language.js @@ -288,6 +288,8 @@ var language = { zwave_DevicesHealButtonTip: "Start a network heal process", zwave_DevicesIncludeButton: "Include", zwave_DevicesIncludeButtonTip: "Put the controller into network INCLUDE mode for 30 seconds", + zwave_DevicesExcludeButton: "Exclude", + zwave_DevicesExcludeButtonTip: "Put the controller into network EXCLUDE mode for 30 seconds", zwave_DevicesValueUpdateError: "Error sending updated value to the server!", zwave_DevicesValueUpdateRangeError: "Value is out of specified range. Please limit the value to between %s and %d.", zwave_DevicesActionError: "Error sending action to the server!", @@ -300,6 +302,11 @@ var language = { zwave_NetworkPower: "Power", zwave_NetworkNeighbors: "Neighbors", + // config/zwaveInclude.js + zwave_IncludeTitle: "ZWave Device Inclusion", + zwave_IncludeDeviceType: "Device Type", + zwave_IncludeHighPower: "User High Power", + // config/bindingList.js config_BindingListTitle: "Bindings", config_BindingListTitleTip: "Binding list", diff --git a/images/gear-small.png b/images/gear-small.png new file mode 100755 index 00000000..9f58d4fa Binary files /dev/null and b/images/gear-small.png differ diff --git a/images/wrench--minus.png b/images/wrench--minus.png new file mode 100755 index 00000000..4ae458cf Binary files /dev/null and b/images/wrench--minus.png differ