diff --git a/FHEM/98_NTFY_CLIENT.pm b/FHEM/98_NTFY_CLIENT.pm index 3ad2ee4..67a1cad 100644 --- a/FHEM/98_NTFY_CLIENT.pm +++ b/FHEM/98_NTFY_CLIENT.pm @@ -112,6 +112,7 @@ sub NTFY_CLIENT_Initialize $hash->{ReadFn} = 'NTFY_Read'; $hash->{AttrFn} = 'NTFY_Attr'; $hash->{ParseFn} = 'NTFY_Parse'; + $hash->{DeleteFn} = 'NTFY_Delete'; $hash->{AttrList} = "defaultTopic " . $readingFnAttributes; @@ -417,6 +418,19 @@ sub NTFY_Parse ($$) return; } +sub NTFY_Delete +{ + my ( $hash, $name ) = @_; + + #we need to delete all topic devices + for my $k (keys %{$modules{NTFY_TOPIC}{defptr}}) + { + $k=~/^(.*)_(.*)$/; + my $h = $modules{NTFY_TOPIC}{defptr}{$k}; + fhem("delete " . $h->{NAME}); + } +} + 1; #########################################