From 045a060762818a615cb7d6b0dbd5c0c4a7025057 Mon Sep 17 00:00:00 2001 From: LeonGaultier Date: Tue, 26 Mar 2019 09:21:20 +0000 Subject: [PATCH] 42_AptToDate: add support for META and Installer Modules git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19035 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- CHANGED | 1 + FHEM/42_AptToDate.pm | 73 +++++++++++++++++++++++++++++++++++++------- 2 files changed, 63 insertions(+), 11 deletions(-) diff --git a/CHANGED b/CHANGED index bf08a3709..d52dc0a1e 100644 --- a/CHANGED +++ b/CHANGED @@ -1,5 +1,6 @@ # 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. + - feature: 42_AptToDate: add support for META and Installer Modules - bugfix: 98_WeekdayTimer: fix problem if use more then one holiday2we entry - bugfix: 42_AptToDate: fix Can't call method readFromChild on an undefined value diff --git a/FHEM/42_AptToDate.pm b/FHEM/42_AptToDate.pm index c4fc92466..564188674 100644 --- a/FHEM/42_AptToDate.pm +++ b/FHEM/42_AptToDate.pm @@ -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 AptToDate " 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 " + ], + "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