30.11.2023, 06:46
Create a scheduled script that runs every minute:
Code:
sock = require('socket').tcp()
sock:settimeout(5)
conn = sock:connect('1.1.1.1', 80)
sock:close()
conn = toboolean(conn)
prev = storage.get('connected')
if prev ~= conn then
storage.set('connected', conn)
log(conn and 'connected' or 'disconnected')
end