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

42_npmjs: fix reading update after update and re-enabling device

git-svn-id: https://svn.fhem.de/fhem/trunk@18445 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2019-01-29 12:40:23 +00:00
parent 2db0409878
commit 72e4a8ff4c

View File

@ -8,7 +8,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
my $version = "0.9.0"; my $version = "0.9.1";
sub npmjs_Initialize($) { sub npmjs_Initialize($) {
@ -234,6 +234,11 @@ sub Notify($$) {
} }
} }
if ( $devname eq $name and grep /^update:.successful$/, @{$events} ) {
$hash->{".fhem"}{npm}{cmd} = 'outdated';
AsynchronousExecuteNpmCommand($hash);
}
return; return;
} }
@ -323,7 +328,7 @@ sub ProcessUpdateTimer($) {
); );
Log3 $name, 4, "npmjs ($name) - stateRequestTimer: Call Request Timer"; Log3 $name, 4, "npmjs ($name) - stateRequestTimer: Call Request Timer";
if ( !IsDisabled($name) ) { unless ( IsDisabled($name) ) {
if ( exists( $hash->{".fhem"}{subprocess} ) ) { if ( exists( $hash->{".fhem"}{subprocess} ) ) {
Log3 $name, 2, Log3 $name, 2,
"npmjs ($name) - update in progress, process aborted."; "npmjs ($name) - update in progress, process aborted.";
@ -340,6 +345,7 @@ sub ProcessUpdateTimer($) {
' ', ReadingsTimestamp( $name, 'outdated', '1970-01-01' ) ' ', ReadingsTimestamp( $name, 'outdated', '1970-01-01' )
) )
)[0] )[0]
or ReadingsVal( $name, 'state', '' ) eq 'disabled'
) )
{ {
$hash->{".fhem"}{npm}{cmd} = 'outdated'; $hash->{".fhem"}{npm}{cmd} = 'outdated';
@ -492,7 +498,7 @@ sub GetNodeVersion($) {
my $update = {}; my $update = {};
my $v = `$cmd->{nodejsversion} 2>/dev/null`; my $v = `$cmd->{nodejsversion} 2>/dev/null`;
if ( defined($v) && $v =~ /^v(\d+\.\d+\.\d+)/ ) { if ( defined($v) and $v =~ /^v(\d+\.\d+\.\d+)/ ) {
$update->{nodejsversion} = $1; $update->{nodejsversion} = $1;
} }
else { else {