diff --git a/fhem/CHANGED b/fhem/CHANGED index 2c3e0ff84..d1ef918e1 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - bugfix : 74_HOMBOT: check path for sshpass - feature: fhem_codemirror: Added new codemirrorParams: keyMap, jumpToLine, jumpToLine_extraKey - feature: 10_pilight_ctrl: NEW: protocol oregon_21 for temperature diff --git a/fhem/FHEM/74_HOMBOT.pm b/fhem/FHEM/74_HOMBOT.pm index ca04f89dd..48381174d 100644 --- a/fhem/FHEM/74_HOMBOT.pm +++ b/fhem/FHEM/74_HOMBOT.pm @@ -35,7 +35,7 @@ use Time::HiRes qw(gettimeofday); use HttpUtils; use Blocking; -my $version = "0.2.3"; +my $version = "0.2.4"; @@ -67,13 +67,15 @@ sub HOMBOT_Define($$) { my ( $hash, $def ) = @_; my @a = split( "[ \t][ \t]*", $def ); + return "too few parameters: define HOMBOT " if( @a != 3 ); return "please check if ssh installed" unless( -X "/usr/bin/ssh" ); - return "please check if /opt/fhem/.ssh/known_hosts exist" unless( -R "/opt/fhem/.ssh/known_hosts" ); - return "please check if sshpass installed" unless( -X "/usr/bin/sshpass" ); + return "please check if $attr{global}{modpath}/.ssh/known_hosts or /root/.ssh/known_hosts exist" unless( -R "$attr{global}{modpath}/.ssh/known_hosts" or -R "/root/.ssh/known_hosts" ); + return "please check if sshpass installed" unless( -X "/usr/bin/sshpass" or -X "/usr/local/bin/sshpass" ); + my $name = $a[0]; my $host = $a[2]; my $port = 6260; @@ -85,6 +87,8 @@ sub HOMBOT_Define($$) { $hash->{VERSION} = $version; $hash->{helper}{requestErrorCounter} = 0; $hash->{helper}{setErrorCounter} = 0; + $hash->{helper}{sshpass} = "/usr/bin/sshpass"; + $hash->{helper}{sshpass} = "/usr/local/bin/sshpass" unless( -X "/usr/bin/sshpass"); Log3 $name, 3, "HOMBOT ($name) - defined with host $hash->{HOST} on port $hash->{PORT} and interval $hash->{INTERVAL} (sec)"; @@ -844,19 +848,20 @@ sub HOMBOT_Check_Bot_Alive($) { my $hash = $defs{$name}; my $host = $hash->{HOST}; my $sshalive; + my $sshpass = $hash->{helper}{sshpass}; Log3 $name, 3, "HOMBOT ($name) - Start SSH Connection for check Hombot alive"; - $sshalive = qx(/usr/bin/sshpass -p 'most9981' /usr/bin/ssh root\@$host 'uname' ); + $sshalive = qx($sshpass -p 'most9981' /usr/bin/ssh root\@$host 'uname' ); if( $sshalive ) { - my $lgSrvPID = ((split (/\s+/,qx(/usr/bin/sshpass -p 'most9981' /usr/bin/ssh root\@$host 'ps | grep -v grep | grep /usr/bin/lg.srv' )))[1]); + my $lgSrvPID = ((split (/\s+/,qx($sshpass -p 'most9981' /usr/bin/ssh root\@$host 'ps | grep -v grep | grep /usr/bin/lg.srv' )))[1]); if( not defined( $lgSrvPID ) ) { - qx(/usr/bin/sshpass -p 'most9981' /usr/bin/ssh root\@$host '/usr/bin/lg.srv &' ); + qx($sshpass -p 'most9981' /usr/bin/ssh root\@$host '/usr/bin/lg.srv &' ); return "$name|$callingtype|restarted";