"mmm whas thinking that your ball was working.... sorry again "
The Script:
Code: Select all
commandArray = {}
print ("debug: D.M.: IP Port check")
function update_portalive(name, ip, port)
-- Windows https://joncraton.org/blog/46/netcat-for-windows/ untested
s = "nc -z -w 1 " .. ip .." " .. tostring(port)
print("debug:"..s)
if (os.execute(s) == nil) then
-- unreachable so need to be Off
print("debug: nil returned. status of "..name.."="..otherdevices[name])
if (otherdevices[name] == 'Off') then
commandArray[name] = 'On'
print(name .. " Dead")
end
else
-- reachable so need to be On
print("debug: Not nil returned. status of "..name.."="..otherdevices[name])
if (otherdevices[name] == 'On') then
print(name .. " Is a Alive")
commandArray[name] = 'Off'
end
end
end
-- Fill in your services here NAMEOFVIRTUALDEVICE IP PORT
--update_portalive("Port: Schuurtje", "192.168.5.98", 552)
--update_portalive("Port: Solarmeter", "192.168.5.99", 555)
update_portalive("Port: Dakrand", "192.168.5.97", 553)
--update_portalive("Port: Domoticz 1", "192.168.5.75", 8081)
--update_portalive("Port: Domoticz 3", "192.168.5.3", 8083)
--update_portalive("Port: Domoticz 2", "192.168.5.147", 8082)
--update_portalive("Port: Minecraft", "192.168.5.147", 22222)
--update_portalive("Port: Domoticz", "192.168.5.70", 8080)
--update_portalive("Port: Kachelrelais", "192.168.5.12", 17495)
--update_portalive("Port: Xiaomi gateway", "192.168.5.7", 9898)
return commandArray
The log:
Code: Select all
017-11-25 18:41:11.425 EventSystem: Event triggered: TER: Verlichting H/W_17
2017-11-25 18:41:11.445 OpenZWave: Domoticz has send a Switch command!, Level: 95, NodeID: 45 (0x2d)
2017-11-25 18:41:11.464 LUA: debug: D.M.: IP Port check
2017-11-25 18:41:11.464 LUA: debug:nc -z -w 1 192.168.5.97 553
2017-11-25 18:41:11.484 (D.M.: Zwave) Light/Switch (Zter: Mini Lampjes)
2017-11-25 18:41:11.485 LUA: debug: nil returned. status of Port: Dakrand=On
2017-11-25 18:41:11.520 LUA: D.M.: PS4 Internet
2017-11-25 18:41:11.551 LUA: Van D.M.:Dakrand Totaal, naar D.M.: Dakrand, voor totalen
The Ip:

- ScreenShot070.png (25.82 KiB) Viewed 1034 times
And when i change the on and off by both of the setpoints...
The switch is gioing on.
Only also not going off wen the ip:port is dead.
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups