Author Topic: Odd behavior with luup.inet.wget()  (Read 2244 times)

Offline neilios

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +0/-0
  • Vacation Rental Automation
Odd behavior with luup.inet.wget()
« on: November 02, 2009, 12:09:05 am »
I've been using v 1.0.862 for quite some time as it has been fairly stable for me and as I am remote from my boxes I can't keep upgrading without risk of the whole thing going wrong. Anyway, I've just noticed something odd and wondered if anyone here had seen this before/knows if it's a bug:

My code:
Called from: mvrz_doUpdateReservations()
Code: [Select]
function mvrz_updateReservations()
mvrz_debug ("mvrz_updateReservations()")
local emailId = MVRZ_USER_EMAILID
local token = MVRZ_USER_TOKEN
local propertyId = MVRZ_USER_PROPERTYID
local url

local urlBase = 'http://www.myvrzone.com/Data/XML/hadata.php?'
url = urlBase .. 'emailID=' .. emailId .. string.char(38) .. "token=" .. token .. string.char(38) .. "propertyID=" .. propertyId
local status, data = luup.inet.wget(url, 20)
mvrz_debug ("URL loaded")
end


When thisis called from a scene button in the UI then all is good:
Code: [Select]
08      11/01/09 23:28:12.288   JobHandler_LuaUPnP::HandleActionRequest device: 0 service: urn:micasaverde-com:serviceId:HomeAutomationGateway1 action: ^[[36;1mRunScene^[[0m <0x2c0c>                           
08      11/01/09 23:28:12.289   JobHandler_LuaUPnP::HandleActionRequest argument SceneNum=1 <0x2c0c>                                                                                                             
08      11/01/09 23:28:12.291   Scene::RunScene running 1 Download from MyVRZone <0x2c0c>                                                                                                                       
08      11/01/09 23:28:12.292   JobHandler_LuaUPnP::HandleActionRequest device: 4 service: urn:myvrzone-com:serviceId:UpdateReservations1 action: ^[[36;1mUpdateReservations^[[0m <0x2c0c>                       
50      11/01/09 23:28:12.294   luup_log:4: MVRZ_DEBUG:I UpdateReservations Action <0x2c0c>                                                                                                                     
50      11/01/09 23:28:12.295   luup_log:4: MVRZ_DEBUG:mvrz_doUpdateReservations() <0x2c0c>                                                                                                                     
50      11/01/09 23:28:12.296   luup_log:4: MVRZ_DEBUG:mvrz_updateReservations() <0x2c0c>                                                                                                                       
02      11/01/09 23:28:12.297   ^[[33;1mFileUtils::ReadURL going to download http://www.myvrzone.com/Data/XML/hadata.php?emailID=neilandkay@robinson-rentals.com&token=XXX&propertyID=2 to /tmp/Pluto
02      11/01/09 23:28:13.286   ^[[33;1mFileUtils::ReadURL going to download http://www.myvrzone.com/Data/XML/hadata.php?emailID=neilandkay@robinson-rentals.com&token=XXX&propertyID=2 to /tmp/Pluto
50      11/01/09 23:28:13.288   luup_log:4: [b]MVRZ_DEBUG:URL loaded [/b]<0x2c0c>   

However, when called from a timer on the same scene (7 mins later) it looks like I get an error within the wget function as my "URL Loaded" message doesn't get printed:
Code: [Select]
08      11/01/09 23:35:56.122   JobHandler_LuaUPnP::AlarmCallback Running timer: Check MyVRZone <0x402>                                                                                                         
08      11/01/09 23:35:56.123   Scene::RunScene running 1 Download from MyVRZone <0x402>                                                                                                                         
08      11/01/09 23:35:56.124   JobHandler_LuaUPnP::HandleActionRequest device: 4 service: urn:myvrzone-com:serviceId:UpdateReservations1 action: ^[[36;1mUpdateReservations^[[0m <0x402>                       
50      11/01/09 23:35:56.126   luup_log:4: MVRZ_DEBUG:I UpdateReservations Action <0x402>                                                                                                                       
50      11/01/09 23:35:56.127   luup_log:4: MVRZ_DEBUG:mvrz_doUpdateReservations() <0x402>                                                                                                                       
50      11/01/09 23:35:56.128   luup_log:4: MVRZ_DEBUG:mvrz_updateReservations() <0x402>                                                                                                                         
02      11/01/09 23:35:56.129   ^[[33;1mFileUtils::ReadURL going to download http://www.myvrzone.com/Data/XML/hadata.php?emailID=neilandkay@robinson-rentals.com&token=XXX&propertyID=2 to /tmp/Pluto
01      11/01/09 23:35:56.193   ^[[31;1m[b]LuaInterface::CallFunction-1 device 4 function UpdateReservations_run failed attempt to index a nil value[/b]^[[0m <0x402>                                                   
03      11/01/09 23:35:58.362   LuaUPNP: starting bLogUPnP 0 <0x400>                                                                                                                                             
02      11/01/09 23:35:58.369   ^[[33;1mJobHandler_LuaUPnP::Run: pid 13369 didn't exit^[[0m <0x400>
...causes a reset here...

Anything look odd with my code?
Anything I should know about the difference between something initiated from a timer vs a button?
Why does the working version show a call to ReadURL twice?

Neilios.
My Network: [Vacation Home #1 - Vera v862, 1x Wayne Dalton], [Vacation Home #2 - Vera v862, 2x Wayne Dalton], Custom device & LUA code on each for remote thermostat operation for occupied/unoccupied and history upload to myvrzone.com DB.