Try this:
Code:
require('socket.http')
socket.http.TIMEOUT = 5
local data = socket.http.request('http://api.ipify.org')
if not data then
return
log('No response getting IP')
end
ip_old = storage.get('ip_old')
if ip_old == nil then
storage.set('ip_old', data)
end
if data ~= ip_old then
storage.set('ip_old', data)
log('IP changed, new IP is: ' .. data)
end