I've actually copied the code from the API that's available online at http://razberry.z-wave.me/docs/Z-WayAPI.pdf.[2014-07-08 15:30:55.406] Scheduling execution of file: automation/update.js
...4-07-08 15:30:55.419] Executing script: function getDataUpdate(sync){
[2014-07-08 15:30:55.443] JavaScript compilation error: SyntaxError: Unexpected
end of input
at automation/modules/CustomUserCodeLoader/index.js:39:13
at Array.forEach (native)
at CustomUserCodeLoader.init (automation/modules/CustomUserCodeLoader/index.
js:34:33)
at AutomationController.reconfigureInstance (automation/classes/AutomationCo
ntroller.js:341:22)
at ZAutomationAPIWebRequest.<anonymous> (automation/webserver.js:542:44)
at ZAutomationAPIWebRequest.ZAutomationWebRequest.handleRequest (automation/
request.js:241:30)
at automation/request.js:31:35
at HTTP request:1:1
Code: Select all
function getDataUpdate(sync) {
$.postJSON('/ZWaveAPI/Data/'+D.updateTime,handlerDataUpdate,sync);
}
$.postJSON = function(url, data, callback, sync) {
if (jQuery.isFunction(data)){
sync = sync || callback;
callback = data;
data = {};
};
$.ajax({
type: 'POST',
url: url,
data: data,
dataType: 'json',
success: callback,
error: callback,
async: (sync!=true)
});
};
function handlerDataUpdate(data) {
try {
$.each(data, function (path, obj) {
var pobj = D;
var pe_arr = path.split('.');
for (var pe in pe_arr.slice(0, -1)) {
pobj = pobj[pe_arr[pe]];
};
pobj[pe_arr.slice(-1)] = obj;