01.03.2021, 15:40
(This post was last modified: 01.03.2021, 15:44 by davidchispas.)
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
ipPublic_old = storage.get('ipPublic_old')
if ipPublic_old == nil then
storage.set('ipPublic_old', data)
end
if data ~= ipPublic_old then
storage.set('ipPublic_old', data)
log('IP changed, new IP is: ' .. data)
end
if data ~= ipPublic_old then
subject = 'IP Pública'
message = 'La nueva ip pública es: ' .. data
mail('xxxxxxxxxxxx', subject, message)
storage.set('ipPublic_old', data)
end
Hi, I'm using this script and lately it was working fine but now I get notifications every little time (1-2 hours) and the IP has not changed. I receive an email notifying that the IP has changed but it appears blank, and after 60 seconds a second notification arrives with the same IP that I had previously.