Skip to content

Commit

Permalink
Merge branch 'master' into rules
Browse files Browse the repository at this point in the history
* master:
  ZWave update (polling, include/exclude, Reitz products, battery class) #125, #123
  Fix naming of exclude button
  Chart period must be string (#129)
  Add zwave exclusion handler
  Add timeout to zwave update requests (#124)
  Add include call
  Updated zwave polling - uses converter refresh interval
  Convert include to use new form
  Updated polling in zwave
  Add small gear icon
  Update README.md
  Update README.md
  Update README.md
  Update grunt file to move addons folder to correct location
  Updates to fix toolbar with multiple actions
  Add toolbar delimiter
  Add INCLUDE button to zwave toolbar
  • Loading branch information
cdjackson committed May 4, 2014
2 parents 76a7b3d + a9eda6b commit 596ad72
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 40 deletions.
7 changes: 1 addition & 6 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
Binary file modified addons/org.openhab.binding.zwave-1.5.0-SNAPSHOT.jar
Binary file not shown.
113 changes: 80 additions & 33 deletions app/config/zwaveDeviceList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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,
Expand All @@ -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);
}
});
}
},
'-'
]
});

Expand Down Expand Up @@ -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;
}

Expand All @@ -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);
}
});
}
Expand Down Expand Up @@ -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!
Expand Down Expand Up @@ -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);
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
132 changes: 132 additions & 0 deletions app/config/zwaveInclude.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/**
* HABmin - the openHAB admin interface
*
* openHAB, the open Home Automation Bus.
* Copyright (C) 2010-2013, openHAB.org <[email protected]>
*
* 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 <http://www.gnu.org/licenses>.
*
* 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);
}
});
}
}
]
})
;

2 changes: 1 addition & 1 deletion app/graph/itemList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
7 changes: 7 additions & 0 deletions app/language/language.js
Original file line number Diff line number Diff line change
Expand Up @@ -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!",
Expand All @@ -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",
Expand Down
Binary file added images/gear-small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/wrench--minus.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 596ad72

Please sign in to comment.