Page 11 of 14

Re: Find My iPhone implementation in LUA script

Posted: Friday 07 April 2017 9:14
by htilburgs
Ok, I thought so. Thnx for the reply

Re: Find My iPhone implementation in LUA script

Posted: Sunday 23 April 2017 3:54
by numanx
Hello I'm having some problems with the following error.
I am using Dummy Switch and Dummy Text and have two phones registered in the script, any ideas?


2017-04-23 04:31:02.277 Error: EventSystem: Warning!, lua script script_time_checkphones. has been running for more than 10 seconds

Re: Find My iPhone implementation in LUA script

Posted: Thursday 27 April 2017 18:22
by poudenes
Does someone have changed the script so it work with APP specific passwords when you have 2way verification on in Apple ID?

App Specific passwords are created when the app or tool don't support 2way verification

Re: Find My iPhone implementation in LUA script

Posted: Thursday 04 May 2017 21:30
by lukev
For people who are struggling with the 'nil value' as a response to this line:

Code: Select all

table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['Position ' .. user] .. '|0|' .. position_text})
My errors were all gone when I made a seperate hardware dummy for every device needed. So one hardware dummy named 'iPhone xxxx' with a virtual switch namede 'iPhone xxxx' and so on.

Eventually I added this line, to have a seperate sensor for the charging percentage. I use this to receive a prowl message on my iWatch when my phone is fully charged :-)

Code: Select all

table.insert(commandArray,{['UpdateDevice'] = otherdevices_idx['PowerState ' .. user] .. '|0|' .. powerstateval})

Re: Find My iPhone implementation in LUA script

Posted: Tuesday 30 May 2017 20:44
by poudenes
Does someone have changed the script so it work with APP specific passwords when you have 2way verification on in Apple ID?

App Specific passwords are created when the app or tool don't support 2way verification

Re: Find My iPhone implementation in LUA script

Posted: Thursday 22 June 2017 23:59
by DJBenson
It appears the script stops working once 2FA is enabled, and 2FA will be mandatory soon - anybody who is testing the iOS 11 beta's will have already had 2FA enforced upon them.

Re: Find My iPhone implementation in LUA script

Posted: Friday 23 June 2017 0:43
by ben53252642
DJBenson wrote:It appears the script stops working once 2FA is enabled, and 2FA will be mandatory soon - anybody who is testing the iOS 11 beta's will have already had 2FA enforced upon them.
This is correct, the script does not currently work with 2FA, I turned it off just so I could use Find My iPhone with Domoticz.

Hopefully someone finds a solution.

Re: Find My iPhone implementation in LUA script

Posted: Wednesday 20 September 2017 8:07
by Nautilus
Now that iOS 11 is out I wonder what is the status of this script, has anyone been able to verify it works (is 2FA mandatory in the official release)?

Re: Find My iPhone implementation in LUA script

Posted: Friday 22 September 2017 6:22
by htilburgs
2FA is NOT mandatory (yet). IOS11 will ask for it after the upgrade, but you’re still able to say no.

Re: Find My iPhone implementation in LUA script

Posted: Friday 22 September 2017 14:33
by Nautilus
htilburgs wrote: Friday 22 September 2017 6:22 2FA is NOT mandatory (yet). IOS11 will ask for it after the upgrade, but you’re still able to say no.
Thanks, good to hear. From earlier posts I thought it might be mandatory already on iOS 11 (maybe in the beta it was)...

Re: Find My iPhone implementation in LUA script

Posted: Friday 22 September 2017 15:40
by htilburgs
Nautilus wrote: Friday 22 September 2017 14:33
htilburgs wrote: Friday 22 September 2017 6:22 2FA is NOT mandatory (yet). IOS11 will ask for it after the upgrade, but you’re still able to say no.
Thanks, good to hear. From earlier posts I thought it might be mandatory already on iOS 11 (maybe in the beta it was)...
This will not mean it stays that way. I'm currently using this script for:

- Presence
- Location
- Battery level

I'm hoping that there is found a solution to keep it using after 2FA.
As an alternative I use the full version of Pilot. Pilot also works for presence and can update Domoticz.
But Pilot does nog give me the current location and/or the battery level.

Re: Find My iPhone implementation in LUA script

Posted: Monday 04 December 2017 21:25
by landaisbenj
Hello. Mine run great !!! thanks for that.

I just have this in log:
2017-12-04 21:21:04.174 LUA: iPhone Benjamin: 0.02 km from home, 17.000000178814% battery remaining. PowerState: NotCharging
.0000000000 on % bat lol not really disturbing but.... lol

I have 3 device and just one do this. The first.

Re: Find My iPhone implementation in LUA script

Posted: Saturday 23 December 2017 13:54
by Maartenkr
Hello i have the next fault:

EventSystem: in /home/pi/domoticz/scripts/lua/script_time_checkphones.lua: /usr/local/share/lua/5.2/json/init.lua:63: attempt to index global 'minetest' (a nil value)


What can I do about it?

Re: Find My iPhone implementation in LUA script

Posted: Monday 19 February 2018 14:56
by numanx
Hello,
The script is working for me but I have the following inputs in error log and it's very annoying.
2018-02-19 15:45:20.128 Error: EventSystem: in iPhone: [string "-- Script to check the location of multiple i..."]:31: attempt to index global 'output' (a nil value)
2018-02-19 15:52:25.236 Error: EventSystem: in iPhone: [string "-- Script to check the location of multiple i..."]:31: attempt to index field '?' (a nil value)
On line 31 I have:
return output.results[1].formatted_address

Re: Find My iPhone implementation in LUA script

Posted: Monday 19 February 2018 14:58
by landaisbenj
Google need an apikey and make a cool down for request.

Re: Find My iPhone implementation in LUA script

Posted: Monday 19 February 2018 15:31
by numanx
landaisbenj wrote: Monday 19 February 2018 14:58 Google need an apikey and make a cool down for request.
I've added a api key to the curl request.
I will reply back if I encounter any issue.
Thanks for your help!

UPDATE:
It seems that I have the same issue after the using of the apikey...

Re: Find My iPhone implementation in LUA script

Posted: Monday 19 February 2018 17:13
by landaisbenj
replace for this:

Code: Select all

  function address(longitude, latitude)
    command = "curl -s https://maps.googleapis.com/maps/api/geocode/json?latlng=" .. latitude .. "," .. longitude .. "&sensor=false"
    local handle = io.popen(command)
    local result = handle:read("*a")
    handle:close()
    output = json:decode(result)
    print(result)
    return output.results[1].formatted_address
  end
and post result

Re: Find My iPhone implementation in LUA script

Posted: Monday 19 February 2018 20:26
by numanx
It seems that the problem is with the if statement for the repeat interval as it seems that I have more output prints.
How should I made the check for this if statement?

Code: Select all

interval = 5
local m = os.date('%M')
if (m % interval == 0) then

Re: Find My iPhone implementation in LUA script

Posted: Tuesday 20 February 2018 16:01
by dens1975
I also got the error:

Code: Select all

Error: EventSystem: in /usr/local/domoticz/var/scripts/lua/script_time_checkphones.lua: ...cal/domoticz/var/scripts/lua/script_time_checkphones.lua:30: attempt to index field '?' (a nil value) 
I have three iphones and somtimes it find 1, 2 or all 3 or none and almost always with the above error except if sometimes all three are found correct. If I put a print (result) before the 'output = json:decode(result)' line I do get some results which are looking good but I do also get a 'exceeded daily request' error. So now I did register for a api and key but how do I use this api key in the script?

Code: Select all

{
 "error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_",
 "results" : [],
 "status" : "OVER_QUERY_LIMIT"
}

Re: Find My iPhone implementation in LUA script

Posted: Tuesday 20 February 2018 16:16
by landaisbenj
numanx wrote: Monday 19 February 2018 20:26 It seems that the problem is with the if statement for the repeat interval as it seems that I have more output prints.
How should I made the check for this if statement?

Code: Select all

interval = 5
local m = os.date('%M')
if (m % interval == 0) then
We all use this. I don't understand what you want.
dens1975 wrote: Tuesday 20 February 2018 16:01 I also got the error:

Code: Select all

Error: EventSystem: in /usr/local/domoticz/var/scripts/lua/script_time_checkphones.lua: ...cal/domoticz/var/scripts/lua/script_time_checkphones.lua:30: attempt to index field '?' (a nil value) 
I have three iphones and somtimes it find 1, 2 or all 3 or none and almost always with the above error except if sometimes all three are found correct. If I put a print (result) before the 'output = json:decode(result)' line I do get some results which are looking good but I do also get a 'exceeded daily request' error. So now I did register for a api and key but how do I use this api key in the script?

Code: Select all

{
 "error_message" : "You have exceeded your daily request quota for this API. We recommend registering for a key at the Google Developers Console: https://console.developers.google.com/apis/credentials?project=_",
 "results" : [],
 "status" : "OVER_QUERY_LIMIT"
}
In URL add &key=

And key don't resolve over query limit. You must add a condition to request address just one time on first no mouvement.