add support for META and Installer Modules

This commit is contained in:
Marko Oldenburg 2019-03-26 10:19:19 +01:00
parent 380cea01ed
commit f2175114bc

View File

@ -34,19 +34,20 @@ package main;
use strict;
use warnings;
use FHEM::Meta;
my $version = "1.4.3";
my $version = "1.4.4";
sub AptToDate_Initialize($) {
my ($hash) = @_;
$hash->{SetFn} = "AptToDate::Set";
$hash->{GetFn} = "AptToDate::Get";
$hash->{DefFn} = "AptToDate::Define";
$hash->{NotifyFn} = "AptToDate::Notify";
$hash->{UndefFn} = "AptToDate::Undef";
$hash->{AttrFn} = "AptToDate::Attr";
$hash->{SetFn} = "FHEM::AptToDate::Set";
$hash->{GetFn} = "FHEM::AptToDate::Get";
$hash->{DefFn} = "FHEM::AptToDate::Define";
$hash->{NotifyFn} = "FHEM::AptToDate::Notify";
$hash->{UndefFn} = "FHEM::AptToDate::Undef";
$hash->{AttrFn} = "FHEM::AptToDate::Attr";
$hash->{AttrList} =
"disable:1 "
. "disabledForIntervals "
@ -58,14 +59,17 @@ sub AptToDate_Initialize($) {
my $hash = $modules{AptToDate}{defptr}{$d};
$hash->{VERSION} = $version;
}
return FHEM::Meta::InitMod( __FILE__, $hash );
}
## unserer packagename
package AptToDate;
package FHEM::AptToDate;
use strict;
use warnings;
use POSIX;
use FHEM::Meta;
use GPUtils qw(GP_Import)
; # wird für den Import der FHEM Funktionen aus der fhem.pl benötigt
@ -117,6 +121,7 @@ sub Define($$) {
my ( $hash, $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
"Cannot define AptToDate device. Perl modul ${missingModul}is missing."
@ -401,7 +406,7 @@ sub ProcessUpdateTimer($) {
RemoveInternalTimer($hash);
InternalTimer(
gettimeofday() + 14400,
"AptToDate::ProcessUpdateTimer",
"FHEM::AptToDate::ProcessUpdateTimer",
$hash, 0
);
Log3 $name, 4, "AptToDate ($name) - stateRequestTimer: Call Request Timer";
@ -490,7 +495,7 @@ sub AsynchronousExecuteAptGetCommand($) {
$hash->{".fhem"}{subprocess} = $subprocess;
InternalTimer( gettimeofday() + POLLINTERVAL,
"AptToDate::PollChild", $hash, 0 );
"FHEM::AptToDate::PollChild", $hash, 0 );
Log3 $hash, 4, "AptToDate ($name) - control passed back to main loop.";
}
@ -508,7 +513,7 @@ sub PollChild($) {
Log3 $name, 5, "AptToDate ($name) - still waiting ("
. $subprocess->{lasterror} . ").";
InternalTimer( gettimeofday() + POLLINTERVAL,
"AptToDate::PollChild", $hash, 0 );
"FHEM::AptToDate::PollChild", $hash, 0 );
return;
}
else {
@ -1168,4 +1173,50 @@ sub ToDay() {
=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