Skip to content

Commit

Permalink
version 1.2.1
Browse files Browse the repository at this point in the history
test with timeout
  • Loading branch information
vosmont committed May 29, 2018
1 parent 53c7cd2 commit 61260fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions luup files/J_ZiBlueGateway1.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ var ZiBlueGateway = ( function( api, $ ) {
var _uuid = "51d7cd82-355e-4dad-b5c9-100a74133220";
var PLUGIN_SID = "urn:upnp-org:serviceId:ZiBlueGateway1";
var PLUGIN_CHILD_SID = "urn:upnp-org:serviceId:ZiBlueDevice1";
var PLUGIN_REFRESH_INTERVAL = 5000;
var PLUGIN_REFRESH_TIMEOUT = 30;
var PLUGIN_REFRESH_INTERVAL = 5;
var _deviceId = null;
var _lastUpdate = 0;
var _indexMappings = {};
Expand Down Expand Up @@ -412,7 +413,7 @@ var ZiBlueGateway = ( function( api, $ ) {
$.ajax( {
url: Utils.getDataRequestURL() + "id=lr_" + _pluginName + "&command=getEquipmentsInfos&output_format=json#",
dataType: "json",
timeout: PLUGIN_REFRESH_INTERVAL
timeout: PLUGIN_REFRESH_TIMEOUT * 1000
} )
.done( function( infos ) {
if ( $.isPlainObject( infos ) ) {
Expand All @@ -437,7 +438,7 @@ var ZiBlueGateway = ( function( api, $ ) {
}
function _resumeEquipmentsRefresh() {
if ( _equipmentsTimeout == null ) {
var timeout = PLUGIN_REFRESH_INTERVAL - ( Date.now() - _equipmentsLastRefresh );
var timeout = PLUGIN_REFRESH_INTERVAL * 1000 - ( Date.now() - _equipmentsLastRefresh );
if ( timeout < 0 ) {
timeout = 0;
}
Expand Down Expand Up @@ -1375,7 +1376,7 @@ var ZiBlueGateway = ( function( api, $ ) {
}
function _resumeDiscoveredEquipmentsRefresh() {
if ( _discoveredEquipmentsTimeout == null ) {
var timeout = PLUGIN_REFRESH_INTERVAL - ( Date.now() - _discoveredEquipmentsLastRefresh );
var timeout = PLUGIN_REFRESH_INTERVAL * 1000 - ( Date.now() - _discoveredEquipmentsLastRefresh );
if ( timeout < 0 ) {
timeout = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions luup files/L_ZiBlueGateway1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ local hasJson, json = pcall( require, "dkjson" )

_NAME = "ZiBlueGateway"
_DESCRIPTION = "ZiBlue gateway for the Vera"
_VERSION = "1.2"
_VERSION = "1.2.1"
_AUTHOR = "vosmont"

-- **************************************************
Expand Down Expand Up @@ -2467,7 +2467,7 @@ setmetatable( _handlerCommands, {

local function _handleCommand( lul_request, lul_parameters, lul_outputformat )
local command = lul_parameters["command"] or "default"
log( "Get handler for command '" .. tostring(command) .."'", "handleCommand" )
debug( "Get handler for command '" .. tostring(command) .."'", "handleCommand" )
return _handlerCommands[command]( lul_parameters, lul_outputformat )
end

Expand Down

0 comments on commit 61260fd

Please sign in to comment.