openLuup : iphone detector

Hi @akbooer i have tried to install iPhone Detector Plugin on a clean openluup system from here iPhoneLocator in trunk – iPhone Detector Plugin but it does not work for me.

I created the device called “iphone1” with AltUI then restarted openluup. I then get a never-ending series of “device 4 ‘iphone1’ requesting reload” messages in terminal.

After creating the device, AltUi http://localhost:3480/data_request?id=lr_ALTUI_Handler&command=home# gives me a “ERR_CONNECTION_REFUSED” error (I think because it is constantly reloading)

Here is my log (it looks like it is being rewritten at each reload caused by iphone detector plugin.)

HA-MacBook:cmh-ludl mda$ more LuaUPnP.log 2015-11-15 23:17:08.346 :: openLuup STARTUP :: 2015-11-15 23:17:08.347 openLuup.init:: version 2015.11.01 @akbooer 2015-11-15 23:17:08.357 openLuup.scheduler:: version 2015.11.03 @akbooer 2015-11-15 23:17:08.357 openLuup.server:: version 2015.11.01 @akbooer 2015-11-15 23:17:08.378 openLuup.plugins:: version 2015.11.06 @akbooer 2015-11-15 23:17:08.379 openLuup.scenes:: version 2015.10.26 @akbooer 2015-11-15 23:17:08.381 openLuup.chdev:: version 2015.11.01 @akbooer 2015-11-15 23:17:08.382 openLuup.io:: version 2015.10.15 @akbooer 2015-11-15 23:17:08.382 openLuup.luup:: version 2015.11.03 @akbooer 2015-11-15 23:17:08.385 openLuup.rooms:: version 2015.10.15 @akbooer 2015-11-15 23:17:08.385 openLuup.requests:: version 2015.10.30 @akbooer 2015-11-15 23:17:08.390 luup.create_device:: [1] urn:schemas-micasaverde-com:device:ZWaveNetwork:1 / I_ZWave.xml 2015-11-15 23:17:08.392 luup.create_device:: [2] urn:schemas-micasaverde-com:device:SceneController:1 / no-implementation-file 2015-11-15 23:17:08.392 openLuup.init:: loading configuration user_data.json 2015-11-15 23:17:08.392 openLuup.init:: loading user_data json... 2015-11-15 23:17:08.397 openLuup.init:: loading rooms... 2015-11-15 23:17:08.397 openLuup.init:: ...room loading completed 2015-11-15 23:17:08.397 openLuup.init:: loading devices... 2015-11-15 23:17:08.397 openLuup.init:: [1] 'ZWave', urn:schemas-micasaverde-com:device:ZWaveNetwork:1 2015-11-15 23:17:08.399 openLuup.init:: [2] '_SceneController', urn:schemas-micasaverde-com:device:SceneController:1 2015-11-15 23:17:08.399 openLuup.init:: [3] 'ALTUI', urn:schemas-upnp-org:device:altui:1 2015-11-15 23:17:08.423 openLuup.init:: [4] 'iphone1', urn:schemas-upnp-org:device:IPhoneLocator:1 2015-11-15 23:17:08.439 luup.register_handler:: unknown global function name: myIPhone_Handler 2015-11-15 23:17:08.439 openLuup.init:: loading scenes... 2015-11-15 23:17:08.439 openLuup.init:: number of scenes = 0 2015-11-15 23:17:08.439 openLuup.init:: ...scene loading completed 2015-11-15 23:17:08.439 openLuup.init:: loading installed plugin info... 2015-11-15 23:17:08.439 openLuup.init:: ...user_data loading completed 2015-11-15 23:17:08.439 openLuup.init:: running _openLuup_STARTUP_ 2015-11-15 23:17:08.439 luup_log:: Hello from my very own startup code 2015-11-15 23:17:08.439 openLuup.init:: startup completed 2015-11-15 23:17:08.439 openLuup.server:: starting HTTP server on 0.0.0.0:3480 tcp{server}: 0x7fd11382c828 2015-11-15 23:17:08.440 openLuup.scheduler:: starting 2015-11-15 23:17:08.440 openLuup.scheduler:3: device startup 2015-11-15 23:17:08.440 luup_log:3: ALTUI: initstatus(3) starting version: v0.96 2015-11-15 23:17:08.455 openLuup.scheduler:3: device startup completed: status=nil, msg=nil, name=nil 2015-11-15 23:17:08.455 openLuup.scheduler:4: device startup 2015-11-15 23:17:08.456 luup_log:4: IPhoneLocator: starting version v2.32 lul_device:4 2015-11-15 23:17:08.456 luup.task:4: status=2 IPhoneLocator : starting version v2.32 lul_device:4 2015-11-15 23:17:08.456 luup.variable_get:4: NO SUCH DEVICE: nil 2015-11-15 23:17:08.456 luup.variable_set:4: No such device ?.urn:upnp-org:serviceId:IPhoneLocator1.UI7Check 2015-11-15 23:17:08.456 luup.variable_set:4: No such device ?.urn:upnp-org:serviceId:IPhoneLocator1.UI7Check 2015-11-15 23:17:08.456 openLuup.luup:4: device 4 'iphone1' requesting reload 2015-11-15 23:17:08.456 luup.reload:4: saving user_data 2015-11-15 23:17:08.464 openLuup.luup:4: exiting with code 42 - after 0.0 hours

I notice these lines but i don’t know what to do about it…

2015-11-15 23:17:08.439 luup.register_handler:: unknown global function name: myIPhone_Handler ... 2015-11-15 23:17:08.456 luup_log:4: IPhoneLocator: starting version v2.32 lul_device:4 2015-11-15 23:17:08.456 luup.task:4: status=2 IPhoneLocator : starting version v2.32 lul_device:4 2015-11-15 23:17:08.456 luup.variable_get:4: NO SUCH DEVICE: nil 2015-11-15 23:17:08.456 luup.variable_set:4: No such device ?.urn:upnp-org:serviceId:IPhoneLocator1.UI7Check 2015-11-15 23:17:08.456 luup.variable_set:4: No such device ?.urn:upnp-org:serviceId:IPhoneLocator1.UI7Check 2015-11-15 23:17:08.456 openLuup.luup:4: device 4 'iphone1' requesting reload

Thanks as always for any help.

-mda

I’ve seen this error in another plugin (IOS_Push, I think) and I believe that the NO SUCH DEVICE error is due to an undocumented ‘feature’ in Vera.

I’ve patched the development branch on GitHub to include this, and the file is here:

https://raw.githubusercontent.com/akbooer/openLuup/development/openLuup/devices.lua

Simply replace your existing openLuup/devices.lua with this and give it another go.

I’ve looked at the code and it’s a typo and also ANOTHER undocumented feature of luup. I know how to fix it, but in the meantime, a single line added to the source code will do.

From this, line 150 in L_IPhone.lua

------------------------------------------------
-- Check UI7
------------------------------------------------
local function checkVersion()
	local ui7Check = luup.variable_get(service, "UI7Check", lug_device) or ""
	if ui7Check == "" then
		luup.variable_set(service, "UI7Check", "false", lug_device)
		ui7Check = "false"
	end
	if( luup.version_branch == 1 and luup.version_major == 7 and ui7Check == "false") then
		luup.variable_set(service, "UI7Check", "true", lug_device)
		luup.attr_set("device_json", UI7_JSON_FILE, lug_device)
		luup.reload()
	end
end

to this:

------------------------------------------------
-- Check UI7
------------------------------------------------
local function checkVersion()
        local lug_device = lul_device    -- < -- ADD THIS LINE
	local ui7Check = luup.variable_get(service, "UI7Check", lug_device) or ""
	if ui7Check == "" then
		luup.variable_set(service, "UI7Check", "false", lug_device)
		ui7Check = "false"
	end
	if( luup.version_branch == 1 and luup.version_major == 7 and ui7Check == "false") then
		luup.variable_set(service, "UI7Check", "true", lug_device)
		luup.attr_set("device_json", UI7_JSON_FILE, lug_device)
		luup.reload()
	end
end

You WILL also need the patch I pointed to in GitHub previously.

The continuous reload is actually because the published version of openLuup does not retain a change to the device json property between reloads (my Release 6 version, does.)

However, IPhoneLocator also uses and encrypted module (to encrypt passwords), and, at least in my copy, seems to have some illegal string escape sequences and undefined references to the ltn12 module.

It looks like we will need @amg0’s help with this (he did, after all, write it!)

One of the challenges of openLuup seems to be that I have to become an expert in every plugin there is!

Thanks. I will standby…