ADD: own function for parsing subscriptions
Some checks failed
continuous-integration/drone Build is failing
Some checks failed
continuous-integration/drone Build is failing
This commit is contained in:
parent
002f1fa11a
commit
714db9fb25
@ -150,16 +150,24 @@ sub NTFY_Define
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub NTFY_Get_Subscriptions
|
||||||
|
{
|
||||||
|
my $hash = shift;
|
||||||
|
my @subscriptions;
|
||||||
|
|
||||||
|
for my $k (keys %{$modules{NTFY_TOPIC}{defptr}})
|
||||||
|
{
|
||||||
|
$k=~/^(.*)_(.*)$/;
|
||||||
|
push(@subscriptions,$2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return @subscriptions;
|
||||||
|
}
|
||||||
|
|
||||||
sub NTFY_Update_Subscriptions_Readings
|
sub NTFY_Update_Subscriptions_Readings
|
||||||
{
|
{
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
my @topics;
|
my @topics = NTFY_Get_Subscriptions($hash);
|
||||||
|
|
||||||
for my $k (keys %{$modules{NTFY_TOPIC}{defptr}})
|
|
||||||
{
|
|
||||||
$k=~/^(.*)_(.*)$/;
|
|
||||||
push(@topics,$2);
|
|
||||||
}
|
|
||||||
|
|
||||||
readingsSingleUpdate($hash,"subscriptions", join(",", @topics),1);
|
readingsSingleUpdate($hash,"subscriptions", join(",", @topics),1);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user