From 2bad6d1ce17c7cbfdfc1242b3ea61be7f5d83a6e Mon Sep 17 00:00:00 2001 From: dominikkarall Date: Sun, 17 Feb 2019 08:50:02 +0000 Subject: [PATCH] 39_gassistant: support npmjs module git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@18616 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/39_gassistant.pm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/FHEM/39_gassistant.pm b/FHEM/39_gassistant.pm index 3d6cc80ca..cb1028159 100755 --- a/FHEM/39_gassistant.pm +++ b/FHEM/39_gassistant.pm @@ -84,7 +84,7 @@ gassistant_Define($$) gassistant_AttrDefaults($hash); - $hash->{NOTIFYDEV} = "global"; + $hash->{NOTIFYDEV} = "global,global:npmjs.*gassistant-fhem.*"; if( $attr{global}{logdir} ) { CommandAttr(undef, "$name gassistantFHEM-log %L/gassistant-%Y-%m-%d.log") if( !AttrVal($name, 'gassistantFHEM-log', undef ) ); @@ -116,14 +116,24 @@ gassistant_Define($$) sub gassistant_Notify($$) -{ +{ my ($hash,$dev) = @_; - + return if($dev->{NAME} ne "global"); - return if(!grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}})); - - CoProcess::start($hash); - + + if( grep(m/^npmjs:BEGIN.*gassistant-fhem.*/, @{$dev->{CHANGED}}) ) { + CoProcess::stop($hash); + return undef; + + } elsif( grep(m/^npmjs:FINISH.*gassistant-fhem.*/, @{$dev->{CHANGED}}) ) { + CoProcess::start($hash); + return undef; + + } elsif( grep(m/^INITIALIZED|REREADCFG$/, @{$dev->{CHANGED}}) ) { + CoProcess::start($hash); + return undef; + } + return undef; }