2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

42_AptToDate: add support for META and Installer Modules

git-svn-id: https://svn.fhem.de/fhem/trunk@19035 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2019-03-26 09:21:20 +00:00
parent 51d49f22ca
commit 04cc2a6207
2 changed files with 63 additions and 11 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- feature: 42_AptToDate: add support for META and Installer Modules
- bugfix: 98_WeekdayTimer: fix problem if use more then one holiday2we entry - bugfix: 98_WeekdayTimer: fix problem if use more then one holiday2we entry
- bugfix: 42_AptToDate: fix Can't call method readFromChild - bugfix: 42_AptToDate: fix Can't call method readFromChild
on an undefined value on an undefined value

View File

@ -34,19 +34,20 @@ package main;
use strict; use strict;
use warnings; use warnings;
use FHEM::Meta;
my $version = "1.4.3"; my $version = "1.4.4";
sub AptToDate_Initialize($) { sub AptToDate_Initialize($) {
my ($hash) = @_; my ($hash) = @_;
$hash->{SetFn} = "AptToDate::Set"; $hash->{SetFn} = "FHEM::AptToDate::Set";
$hash->{GetFn} = "AptToDate::Get"; $hash->{GetFn} = "FHEM::AptToDate::Get";
$hash->{DefFn} = "AptToDate::Define"; $hash->{DefFn} = "FHEM::AptToDate::Define";
$hash->{NotifyFn} = "AptToDate::Notify"; $hash->{NotifyFn} = "FHEM::AptToDate::Notify";
$hash->{UndefFn} = "AptToDate::Undef"; $hash->{UndefFn} = "FHEM::AptToDate::Undef";
$hash->{AttrFn} = "AptToDate::Attr"; $hash->{AttrFn} = "FHEM::AptToDate::Attr";
$hash->{AttrList} = $hash->{AttrList} =
"disable:1 " "disable:1 "
. "disabledForIntervals " . "disabledForIntervals "
@ -58,14 +59,17 @@ sub AptToDate_Initialize($) {
my $hash = $modules{AptToDate}{defptr}{$d}; my $hash = $modules{AptToDate}{defptr}{$d};
$hash->{VERSION} = $version; $hash->{VERSION} = $version;
} }
return FHEM::Meta::InitMod( __FILE__, $hash );
} }
## unserer packagename ## unserer packagename
package AptToDate; package FHEM::AptToDate;
use strict; use strict;
use warnings; use warnings;
use POSIX; use POSIX;
use FHEM::Meta;
use GPUtils qw(GP_Import) use GPUtils qw(GP_Import)
; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt ; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
@ -117,6 +121,7 @@ sub Define($$) {
my ( $hash, $def ) = @_; my ( $hash, $def ) = @_;
my @a = split( "[ \t][ \t]*", $def ); my @a = split( "[ \t][ \t]*", $def );
return $@ unless ( FHEM::Meta::SetInternals($hash) );
return "too few parameters: define <name> AptToDate <HOST>" if ( @a != 3 ); return "too few parameters: define <name> AptToDate <HOST>" if ( @a != 3 );
return return
"Cannot define AptToDate device. Perl modul ${missingModul}is missing." "Cannot define AptToDate device. Perl modul ${missingModul}is missing."
@ -401,7 +406,7 @@ sub ProcessUpdateTimer($) {
RemoveInternalTimer($hash); RemoveInternalTimer($hash);
InternalTimer( InternalTimer(
gettimeofday() + 14400, gettimeofday() + 14400,
"AptToDate::ProcessUpdateTimer", "FHEM::AptToDate::ProcessUpdateTimer",
$hash, 0 $hash, 0
); );
Log3 $name, 4, "AptToDate ($name) - stateRequestTimer: Call Request Timer"; Log3 $name, 4, "AptToDate ($name) - stateRequestTimer: Call Request Timer";
@ -490,7 +495,7 @@ sub AsynchronousExecuteAptGetCommand($) {
$hash->{".fhem"}{subprocess} = $subprocess; $hash->{".fhem"}{subprocess} = $subprocess;
InternalTimer( gettimeofday() + POLLINTERVAL, InternalTimer( gettimeofday() + POLLINTERVAL,
"AptToDate::PollChild", $hash, 0 ); "FHEM::AptToDate::PollChild", $hash, 0 );
Log3 $hash, 4, "AptToDate ($name) - control passed back to main loop."; Log3 $hash, 4, "AptToDate ($name) - control passed back to main loop.";
} }
@ -508,7 +513,7 @@ sub PollChild($) {
Log3 $name, 5, "AptToDate ($name) - still waiting (" Log3 $name, 5, "AptToDate ($name) - still waiting ("
. $subprocess->{lasterror} . ")."; . $subprocess->{lasterror} . ").";
InternalTimer( gettimeofday() + POLLINTERVAL, InternalTimer( gettimeofday() + POLLINTERVAL,
"AptToDate::PollChild", $hash, 0 ); "FHEM::AptToDate::PollChild", $hash, 0 );
return; return;
} }
else { else {
@ -1168,4 +1173,50 @@ sub ToDay() {
=end html_DE =end html_DE
=for :application/json;q=META.json 42_AptToDate.pm
{
"abstract": "Modul to retrieves apt information about Debian update state",
"x_lang": {
"de": {
"abstract": "Modul um apt Updateinformationen von Debian Systemen zu bekommen"
}
},
"keywords": [
"fhem-mod-device",
"fhem-core",
"Debian",
"apt",
"apt-get",
"dpkg",
"Package"
],
"release_status": "stable",
"license": "GPL_2",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],
"x_fhem_maintainer": [
"CoolTux"
],
"x_fhem_maintainer_github": [
"LeonGaultier"
],
"prereqs": {
"runtime": {
"requires": {
"FHEM": 5.00918799,
"perl": 5.016,
"Meta": 0,
"SubProcess": 0,
"JSON": 0
},
"recommends": {
},
"suggests": {
}
}
}
}
=end :application/json;q=META.json
=cut =cut