mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
SMUtils: update to version 1.21.0
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@23425 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9d67ffd1ac
commit
1e1f06d460
@ -26,6 +26,7 @@
|
|||||||
#########################################################################################################################
|
#########################################################################################################################
|
||||||
|
|
||||||
# Version History
|
# Version History
|
||||||
|
# 1.21.0 new sub timestringToTimestamp / createReadingsFromArray
|
||||||
# 1.20.7 change to defined ... in sub _addSendqueueSimple
|
# 1.20.7 change to defined ... in sub _addSendqueueSimple
|
||||||
# 1.20.6 delete $hash->{OPMODE} in checkSendRetry
|
# 1.20.6 delete $hash->{OPMODE} in checkSendRetry
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ our @EXPORT_OK = qw(
|
|||||||
getClHash
|
getClHash
|
||||||
delClHash
|
delClHash
|
||||||
delReadings
|
delReadings
|
||||||
|
createReadingsFromArray
|
||||||
trim
|
trim
|
||||||
slurpFile
|
slurpFile
|
||||||
moduleVersion
|
moduleVersion
|
||||||
@ -81,6 +83,7 @@ our @EXPORT_OK = qw(
|
|||||||
checkSendRetry
|
checkSendRetry
|
||||||
purgeSendqueue
|
purgeSendqueue
|
||||||
updQueueLength
|
updQueueLength
|
||||||
|
timestringToTimestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
our %EXPORT_TAGS = (all => [@EXPORT_OK]);
|
our %EXPORT_TAGS = (all => [@EXPORT_OK]);
|
||||||
@ -100,6 +103,7 @@ BEGIN {
|
|||||||
CancelDelayedShutdown
|
CancelDelayedShutdown
|
||||||
devspec2array
|
devspec2array
|
||||||
FmtDateTime
|
FmtDateTime
|
||||||
|
fhemTimeLocal
|
||||||
setKeyValue
|
setKeyValue
|
||||||
getKeyValue
|
getKeyValue
|
||||||
InternalTimer
|
InternalTimer
|
||||||
@ -267,6 +271,46 @@ sub slurpFile {
|
|||||||
return ($errorcode, $content);
|
return ($errorcode, $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# einen Zeitstring YYYY-MM-TT hh:mm:ss in einen Unix
|
||||||
|
# Timestamp umwandeln
|
||||||
|
###############################################################################
|
||||||
|
sub timestringToTimestamp {
|
||||||
|
my $hash = shift // carp $carpnohash && return;
|
||||||
|
my $tstring = shift // carp "got no time string to convert" && return;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
my($y, $mo, $d, $h, $m, $s) = $tstring =~ /([0-9]{4})-([0-9]{2})-([0-9]{2})\s([0-9]{2}):([0-9]{2}):([0-9]{2})/xs;
|
||||||
|
return if(!$mo || !$y);
|
||||||
|
|
||||||
|
my $timestamp = fhemTimeLocal($s, $m, $h, $d, $mo-1, $y-1900);
|
||||||
|
|
||||||
|
return $timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
# Readings aus Array erstellen
|
||||||
|
# $daref: Referenz zum Array der zu erstellenden Readings
|
||||||
|
# muß Paare <Readingname>:<Wert> enthalten
|
||||||
|
# $doevt: 1-Events erstellen, 0-keine Events erstellen
|
||||||
|
###############################################################################
|
||||||
|
sub createReadingsFromArray {
|
||||||
|
my $hash = shift // carp $carpnohash && return;
|
||||||
|
my $daref = shift // carp "got no reading array reference" && return;
|
||||||
|
my $doevt = shift // 0;
|
||||||
|
|
||||||
|
readingsBeginUpdate($hash);
|
||||||
|
|
||||||
|
for my $elem (@$daref) {
|
||||||
|
my ($rn,$rval) = split ":", $elem, 2;
|
||||||
|
readingsBulkUpdate($hash, $rn, $rval);
|
||||||
|
}
|
||||||
|
|
||||||
|
readingsEndUpdate($hash, $doevt);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#############################################################################################
|
#############################################################################################
|
||||||
# liefert die Versionierung des Moduls zurück
|
# liefert die Versionierung des Moduls zurück
|
||||||
# Verwendung mit Packages: use version 0.77; our $VERSION = moduleVersion ($params)
|
# Verwendung mit Packages: use version 0.77; our $VERSION = moduleVersion ($params)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user