Lua for PING with sleep

Moderator: leecollings

Post Reply
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Lua for PING with sleep

Post by emme »

cannot really figure it out.... but...
I think os.execute will return the errorlevel for the command.... not for the reply of it..
os.execute('ping -c1 192.168.0.150') will always return true even if the ping is not successful because the command ping were executed with no error

anyhow... it runs with no error into my deomoticz installation...
UNLESS....
you delete the script while it is wtill runing... then I got such error :P
The most dangerous phrase in any language is:
"We always done this way"
BakSeeDaa
Posts: 485
Joined: Thursday 17 September 2015 10:13
Target OS: Raspberry Pi / ODroid
Domoticz version:

Re: Lua for PING with sleep

Post by BakSeeDaa »

That script will stall the Domoticz event system. You don't want that. Don't do it.
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: Lua for PING with sleep

Post by JimmyH1969 »

How about the integrated "System alive checker"?
Jan Jansen
Posts: 229
Joined: Wednesday 30 April 2014 20:27
Target OS: Raspberry Pi / ODroid
Domoticz version: Stable
Location: The Netherlands
Contact:

Re: Lua for PING with sleep

Post by Jan Jansen »

In the first place I can't say how to do. Perhaps it is possible to set the script on or off with a virtual (timer) switch. I would like that option.
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: Lua for PING with sleep

Post by JimmyH1969 »

Just go to hardware and add the system alive checker.
When it's added you can configure it and add the ip adresses of all the systems you like to check and specify timeout's etc.
For every device you add a virtual switch is created. You can use that switch in other scripts like, when virtul switch is off (unable to ping that system) send a message, switch a light, whatever
JimmyH1969
Posts: 153
Joined: Tuesday 28 June 2016 16:38
Target OS: Windows
Domoticz version: Beta
Location: Amersfoort NL
Contact:

Re: Lua for PING with sleep

Post by JimmyH1969 »

:D
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest