Originally posted by jon00
View Post

If this is your first visit, be sure to check out the FAQ. You must register before you can post.
IMPORTANT: Your first post will be checked for appropriate content. This may take a bit of time.
Sub main()
Dim strHost, strDeviceCode, bAlive
strHost = "192.168.0.4"
strDeviceCode = "N3"
bAlive = 1
bAlive = hs.Ping(Cstr(strHost),5)
If bAlive = 0 Then
hs.SetDeviceString strDeviceCode, "0n"
If hs.DeviceStatus(strDeviceCode) <> "2" Then
hs.SetDeviceStatus strDeviceCode, "2"
end If
else
hs.SetDeviceString strDeviceCode, "0ff"
If hs.DeviceStatus(strDeviceCode) <> "3" Then
hs.SetDeviceStatus strDeviceCode, "3"
end If
end If
' hs.WriteLog "debug",bAlive
'Only need to run next line once to add Ping button
' hs.DeviceButtonAdd strDeviceCode, "ping_dan.txt("""","""")", "Ping"
'Only need to run next line once if you want to remove Ping button
' hs.DeviceButtonRemove strDeviceCode, "Ping"
End Sub
Leave a comment: