2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-07 19:04:20 +00:00

98_GAEBUS.pm : add support for Wolf/Kromschröder

git-svn-id: https://svn.fhem.de/fhem/trunk@18193 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jamesgo 2019-01-09 13:08:19 +00:00
parent 4088847288
commit d17278352b

View File

@ -44,6 +44,8 @@
# 27.12.2016 : A.Goebel : fix handling if ebusctl reports "usage:"
# 27.12.2016 : A.Goebel : fix scan removed from supported classes
# 13.12.2017 : A.Goebel : add "+f" as additional ebus command to disable "-f" for this request
# 03.01.2019 : A.Goebel : fix mask tilde in set/get
# 03.01.2019 : A.Goebel : fix change regexp for parsing commands from "/^w$delimiter.{1,7}$delimiter.*/" to "/^w$delimiter[^$delimiter]{1,}$delimiter.*/" to support "feuerung" as class
package main;
@ -188,6 +190,7 @@ GAEBUS_initParams ($)
}
#Log3 ($hash, 2, "GAEBUS Initialize: $setval:$allSetParamsForWriting");
}
}
#####################################
@ -257,6 +260,9 @@ GAEBUS_Set($@)
my $type = shift @a;
my $arg = join(" ", @a);
$type =~ s/\xe2\x88\xbc/~/g;
$arg =~ s/\xe2\x88\xbc/~/g;
#return "No $a[1] for dummies" if(IsDummy($name));
#Log3 ($hash, 3, "ebus1: reopen $name");
@ -324,7 +330,7 @@ GAEBUS_Set($@)
$readingname =~ s/:.*//;
# only for "w" commands
if ($oneattr =~ /^w$delimiter.{1,7}$delimiter.*/ or $oneattr =~ /^w$delimiter.{1,7}install$delimiter.*/)
if ($oneattr =~ /^w$delimiter[^$delimiter]{1,}$delimiter.*/ or $oneattr =~ /^w$delimiter[^$delimiter]{1,}install$delimiter.*/)
{
unless ($readingname =~ /^\s*$/ or $readingname eq "1")
{
@ -373,7 +379,7 @@ GAEBUS_Set($@)
{
foreach my $oneattr (sort keys %{$attr{$name}})
{
next unless ($oneattr =~ /^w.*$delimiter.{1,7}$delimiter.*$/ or $oneattr =~ /^w.*$delimiter.{1,7}install$delimiter.*$/);
next unless ($oneattr =~ /^w.*$delimiter[^$delimiter]{1,}$delimiter.*$/ or $oneattr =~ /^w.*$delimiter[^$delimiter]{1,}install$delimiter.*$/);
my $readingname = $attr{$name}{$oneattr};
next if ($readingname ne $type);
@ -385,6 +391,7 @@ GAEBUS_Set($@)
}
$actSetParams =~ s/~/∼/g;
return "Unknown argument $type, choose one of " . $actSetParams
if(!defined($sets{$type}));
@ -410,7 +417,7 @@ GAEBUS_Get($@)
if ($type eq "ebusd_hex")
{
Log3 ($hash, 4, "$name Set $type $arg");
Log3 ($hash, 4, "$name Get $type $arg");
my $answer = GAEBUS_doEbusCmd ($hash, "h", "", "", "$arg", "", 0);
@ -472,7 +479,7 @@ GAEBUS_Get($@)
$readingname =~ s/:.*//;
# only for "r" commands
if ($oneattr =~ /^r$delimiter.{1,7}$delimiter.*/)
if ($oneattr =~ /^r$delimiter[^$delimiter]{1,}$delimiter.*/)
{
$readings{$readingname} = $readingcmdname;
$readingsCmdaddon{$readingname} = $cmdaddon;
@ -532,6 +539,9 @@ GAEBUS_Get($@)
# other read commands
if (defined($a[1])) { $a[1] =~ s/\xe2\x88\xbc/~/g };
if (defined($a[2])) { $a[2] =~ s/\xe2\x88\xbc/~/g };
if ($a[1] =~ /^[r]$delimiter/)
{
my $readingname = "";
@ -548,6 +558,7 @@ GAEBUS_Get($@)
# handle commands from %gets and show result from ebusd
$actGetParams =~ s/~/∼/g;
return "Unknown argument $a[1], choose one of " . $actGetParams
if(!defined($gets{$a[1]}));
@ -1188,7 +1199,7 @@ GAEBUS_GetUpdatesDoit($)
foreach my $oneattr (keys %{$attr{$name}})
{
# only for "r" commands
if ($oneattr =~ /^r$delimiter.{1,7}$delimiter.*/)
if ($oneattr =~ /^r$delimiter[^$delimiter]{1,}$delimiter.*/)
{
my ($readingnameX, $cmdaddon) = split (" ", $attr{$name}{$oneattr}, 2);