2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

98_serviced: code simplification

git-svn-id: https://svn.fhem.de/fhem/trunk@23754 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
deespe 2021-02-17 00:33:46 +00:00
parent f8c9f37c8f
commit 14b9585742

View File

@ -55,7 +55,7 @@ sub serviced_Define($$)
if (@args < 3 || @args > 5);
my ($name,$type,$service,$remote,$port) = @args;
return "Remote host must be like 'pi\@192.168.2.22' or 'pi\@myserver' or 'pi\@192.168.2.22 222' if you need to declare a SSH port other than the default port!"
if (($remote && $remote !~ /^\w{2,}@(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[\w\.\-_]{2,})$/ && !$port) || ($remote && $remote !~ /^\w{2,}@(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[\w\.\-_]{2,})$/ && $port && $port !~ /^\d{2,5}$/));
if (($remote && $remote !~ /^\w{2,}@(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|[\w\.\-_]{2,})$/) || ($port && $port !~ /^\d{2,5}$/));
RemoveInternalTimer($hash);
$hash->{NOTIFYDEV} = "global";
$hash->{SERVICENAME} = $service;