Find My iPhone implementation in LUA script
Moderator: leecollings
- htilburgs
- Posts: 464
- Joined: Tuesday 03 November 2015 11:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Find My iPhone implementation in LUA script
Ok, I thought so. Thnx for the reply
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
-
- Posts: 11
- Joined: Sunday 23 April 2017 3:51
- Target OS: Linux
- Domoticz version: 3.8153
- Location: Romania
- Contact:
Re: Find My iPhone implementation in LUA script
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
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
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Find My iPhone implementation in LUA script
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
App Specific passwords are created when the app or tool don't support 2way verification
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
- Posts: 66
- Joined: Friday 21 October 2016 10:42
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Find My iPhone implementation in LUA script
For people who are struggling with the 'nil value' as a response to this line:
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['Position ' .. user] .. '|0|' .. position_text})
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})
-
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: Find My iPhone implementation in LUA script
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
App Specific passwords are created when the app or tool don't support 2way verification
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
- Posts: 20
- Joined: Wednesday 19 October 2016 19:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Find My iPhone implementation in LUA script
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.
-
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: Find My iPhone implementation in LUA script
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.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.
Hopefully someone finds a solution.
Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
-
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: Find My iPhone implementation in LUA script
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)?
- htilburgs
- Posts: 464
- Joined: Tuesday 03 November 2015 11:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Find My iPhone implementation in LUA script
2FA is NOT mandatory (yet). IOS11 will ask for it after the upgrade, but you’re still able to say no.
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
- htilburgs
- Posts: 464
- Joined: Tuesday 03 November 2015 11:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Find My iPhone implementation in LUA script
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.
Hardware:
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
RPi3 - Aeon Labs Z-Stick GEN5 - Fibaro Dimmer 2 - Fibaro Roller Shutter 2 - Fibaro Smoke Sensor - Yeelight RGBW Led bulb - Yeelight Smart LED Light Strip - Neo Coolcam PIR Motion Sensor - Neo Coolcam PowerPlug - Nest Thermostat v3
-
- Posts: 147
- Joined: Wednesday 02 August 2017 18:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: France
- Contact:
Re: Find My iPhone implementation in LUA script
Hello. Mine run great !!! thanks for that.
I just have this in log:
I have 3 device and just one do this. The first.
I just have this in log:
.0000000000 on % bat lol not really disturbing but.... lol2017-12-04 21:21:04.174 LUA: iPhone Benjamin: 0.02 km from home, 17.000000178814% battery remaining. PowerState: NotCharging
I have 3 device and just one do this. The first.
Platforme: Rpbi3b
Domoticz: Last stable
Bridge: RFLINK last stable
Domoticz: Last stable
Bridge: RFLINK last stable
-
- Posts: 15
- Joined: Sunday 18 September 2016 23:56
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.7196
- Location: Hellevoetsluis
- Contact:
Re: Find My iPhone implementation in LUA script
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?
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?
-
- Posts: 11
- Joined: Sunday 23 April 2017 3:51
- Target OS: Linux
- Domoticz version: 3.8153
- Location: Romania
- Contact:
Re: Find My iPhone implementation in LUA script
Hello,
The script is working for me but I have the following inputs in error log and it's very annoying.
The script is working for me but I have the following inputs in error log and it's very annoying.
On line 31 I have: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)
return output.results[1].formatted_address
-
- Posts: 147
- Joined: Wednesday 02 August 2017 18:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: France
- Contact:
Re: Find My iPhone implementation in LUA script
Google need an apikey and make a cool down for request.
Platforme: Rpbi3b
Domoticz: Last stable
Bridge: RFLINK last stable
Domoticz: Last stable
Bridge: RFLINK last stable
-
- Posts: 11
- Joined: Sunday 23 April 2017 3:51
- Target OS: Linux
- Domoticz version: 3.8153
- Location: Romania
- Contact:
Re: Find My iPhone implementation in LUA script
I've added a api key to the curl request.landaisbenj wrote: ↑Monday 19 February 2018 14:58 Google need an apikey and make a cool down for 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...
-
- Posts: 147
- Joined: Wednesday 02 August 2017 18:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: France
- Contact:
Re: Find My iPhone implementation in LUA script
replace for this:
and post result
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
Platforme: Rpbi3b
Domoticz: Last stable
Bridge: RFLINK last stable
Domoticz: Last stable
Bridge: RFLINK last stable
-
- Posts: 11
- Joined: Sunday 23 April 2017 3:51
- Target OS: Linux
- Domoticz version: 3.8153
- Location: Romania
- Contact:
Re: Find My iPhone implementation in LUA script
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?
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
-
- Posts: 26
- Joined: Monday 12 February 2018 17:03
- Target OS: NAS (Synology & others)
- Domoticz version:
- Contact:
Re: Find My iPhone implementation in LUA script
I also got the error:
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: 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)
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"
}
-
- Posts: 147
- Joined: Wednesday 02 August 2017 18:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: stable
- Location: France
- Contact:
Re: Find My iPhone implementation in LUA script
We all use this. I don't understand what you want.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
In URL add &key=dens1975 wrote: ↑Tuesday 20 February 2018 16:01 I also got the error: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: 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)
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" }
And key don't resolve over query limit. You must add a condition to request address just one time on first no mouvement.
Platforme: Rpbi3b
Domoticz: Last stable
Bridge: RFLINK last stable
Domoticz: Last stable
Bridge: RFLINK last stable
Who is online
Users browsing this forum: No registered users and 1 guest