Problem on/off action for System Alive Checker (Ping)

Please use template to report bugs and problems. Post here your questions when not sure where else to post
Only for bugs in the Domoticz application! other problems go in different subforums!
Forum rules
Before posting here, make sure you are on the latest Beta or Stable version.
If you have problems related to the web gui, clear your browser cache + appcache first.

Use the following template when posting here:

Version: xxxx
Platform: xxxx
Plugin/Hardware: xxxx
Description:
.....

If you are having problems with scripts/blockly, always post the script (in a spoiler or code tag) or screenshots of your blockly

If you are replying, please do not quote images/code from the first post

Please mark your topic as Solved when the problem is solved.
Post Reply
axelct
Posts: 2
Joined: Thursday 13 September 2018 15:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Problem on/off action for System Alive Checker (Ping)

Post by axelct » Thursday 13 September 2018 15:51

Hi all,
I'm very happy to use domoticz, it's great!!
My installation is:

Version: 4.9700
Platform: Raspberry Pi

And I've have the following problem:
I've used the System Alive Checker to ping a server and it works perfect (the server status is reported correctly).
I've defined an off and on action with script, but always, when I trigger the on/off action I get the following message: "Error sending switch command, check device/hardware !"

The scripts have no error, I've tried to run manually by command line and both script works, I've defined the same script as on/off action in a switch device and works with no problem.

Have I missing anything or could be a bug?

Thanks,
Alessandro

axelct
Posts: 2
Joined: Thursday 13 September 2018 15:42
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Problem on/off action for System Alive Checker (Ping)

Post by axelct » Thursday 13 September 2018 15:57

Uhm, I've got by myself... sorry, looking at the log I've got this message:

Error: Pinger: This is a read-only sensor!

Seems to be very clear, I think no way out... so do I need two devices? One for Systema live chech and the other as switch device to perform on/off action?

Alex

User avatar
HansieNL
Posts: 457
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Problem on/off action for System Alive Checker (Ping)

Post by HansieNL » Thursday 13 September 2018 17:01

I made 3 dummy switches and use a LUA script to ping the devices and they have off scripts. Maybe you can use this LUA script:

Code: Select all

commandArray={}

-- Debug mode (display of messages)
debug=true
-- Prefix for log outputs
prefixe="(Ping) "


-- Table of devices to ping
-- Key = ip address to ping
-- Value = virtual device to switch
local ping={}
ping['192.168.2.22']='Desktop PC'
ping['192.168.2.6']='Mede8er'
ping['192.168.2.55']='Notebook PC'

--For each entry in the table
for ip, switch in pairs(ping) do

 --Ping ! : -c1 = one ping , -w1 one second waiting time
 ping_success=os.execute('ping -c1 -w1 '..ip)


 --If the ping answered 
 if ping_success then
   if(debug==true)then
    print(prefixe.. switch.. " online")
   end
   --If the switch was off it is turned on
   if(otherdevices[switch]=='Off') then
      commandArray['UpdateDevice'] = otherdevices_idx[switch]..'|1|0'
   end
  else

 --If no answer
   if(debug==true)then
    print(prefixe.. switch.. " offline")
   end
   --If the switch was on it is turned off
   if(otherdevices[switch]=='On') then
      commandArray['UpdateDevice'] = otherdevices_idx[switch]..'|0|0' 
   end
 end

end

return commandArray
Blah blah blah

chaimeichini
Posts: 48
Joined: Tuesday 02 October 2018 16:40
Target OS: Raspberry Pi
Domoticz version:
Contact:

Re: Problem on/off action for System Alive Checker (Ping)

Post by chaimeichini » Sunday 11 November 2018 15:47

Well, I implemented the ping retry, and made the ping checker more like the original boost example, and for now it seems stable.
It needs a bit more testing, but the false negatives are gone, and, for as far as I can tell, also the false positives.

My C++/Boost knowledge is very limited, so I might need a bit of help to clean up the Q&D version of my modifications.Rightmove Kijiji Quizlet

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests