steef84 wrote:Nice find, thanks for sharing this. Want to try this with my iPhone 6s.
Can you help me troubleshoot it on Domoticz latest beta on my Synology DS213+
Running this script with only the following adapted.
Code: Select all
-- Array of users to be checked
users = {
Person1 = {username = '[email protected]' ; password = 'xxxxxxxxxxx' ; devicename = 'iPhone Stefan'}
}
-- The latitude and longitude of your house (use Google Maps or similar to find this)
homelongitude = x.xxxxxx
homelatitude = xx.xxxxxx
Now my Domoticz logs returns nothing and my dummy iPhone Stefan is not switching.
I've copied the json.lua with wget to /usr/local/share/lua/5.2/, chmodded it 777. Also tried putting longitude and latitude between 'xx.xxx'
So you don't see anything in your logs? That probably means you're almost there, otherwise you would see remarks on not being able to find json.lua, or about concatenating variables which are empty (nil).
I noticed that I missed a space on two positions in the script after 'iPhone', e.g. in
Code: Select all
if otherdevices['iPhone ' .. user] == 'Off then
This probably happened during anonimizing my own script and translating it from Dutch to English. I have now corrected this in my previous post, please adapt your own script accordingly.
Secondly, I see that you didn't change the name "Person1". I assume your dummy switch is not called "iPhone Person1" but "iPhone Stefan", right? If so, please change Person1 into Stefan.
If you still have problems, here are a few other things you can try:
- Remove the comment signs (--) before the print commands. Does it print the raw output (the value of the "result" variable) in the log? And the longitude/latitude?
- If you do get the raw output but no position, check the raw output for the device name of your phone. Is it spelled exactly as you did in the script?
Hope this brings you a bit further. Let me know your results.
Raspberry Pi 4 - RFXtrx433 - CC2531 Zigbee - Opentherm Gateway - P1 smart meter - Netatmo - Philips Hue - ELV Max! - ESP8266 DIY water meter - 6 x Sonos - 4 x IP cameras - Wall mounted tablet + Dashticz - Google Home integration - MANY switches/sensors