2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

72_TA_CMI_JSON: introduced module package

git-svn-id: https://svn.fhem.de/fhem/trunk@23688 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
delmar 2021-02-06 20:46:46 +00:00
parent 64ff71de7e
commit ff2137252a
2 changed files with 41 additions and 12 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.
- change: 72_TA_CMI_JSON: introduced module package
- bugfix: 73_ElectricityCalculator: Use Time::Local added for compatibility - bugfix: 73_ElectricityCalculator: Use Time::Local added for compatibility
- bugfix: 73_WaterCalculator: Use Time::Local added for compatibility - bugfix: 73_WaterCalculator: Use Time::Local added for compatibility
- bugfix: 73_GasCalculator: Use Time::Local added for compatibility - bugfix: 73_GasCalculator: Use Time::Local added for compatibility

View File

@ -39,8 +39,27 @@
package main; package main;
use strict; use strict;
use warnings; use warnings;
sub TA_CMI_JSON_Initialize {
my ($hash) = @_;
$hash->{GetFn} = "TA_CMI_JSON::TA_CMI_JSON_Get";
$hash->{DefFn} = "TA_CMI_JSON::TA_CMI_JSON_Define";
$hash->{UndefFn} = "TA_CMI_JSON::TA_CMI_JSON_Undef";
$hash->{AttrList} = "username password interval readingNamesInputs readingNamesOutputs readingNamesDL-Bus readingNamesLoggingAnalog readingNamesLoggingDigital includePrettyReadings:0,1 includeUnitReadings:0,1 " . $readingFnAttributes;
Log3 '', 3, "TA_CMI_JSON - Initialize done ...";
}
package TA_CMI_JSON;
use strict;
use warnings;
use HttpUtils; use HttpUtils;
use GPUtils qw(:all);
my %deviceNames = ( my %deviceNames = (
'80' => 'UVR1611', '80' => 'UVR1611',
'87' => 'UVR16x2', '87' => 'UVR16x2',
@ -78,17 +97,26 @@ my %rasStates = (
3 => 'Standby/frost pr.' 3 => 'Standby/frost pr.'
); );
sub TA_CMI_JSON_Initialize { ## Import der FHEM Funktionen
my ($hash) = @_; BEGIN {
GP_Import(qw(
$hash->{GetFn} = "TA_CMI_JSON_Get"; readingsSingleUpdate
$hash->{DefFn} = "TA_CMI_JSON_Define"; readingsBulkUpdate
$hash->{UndefFn} = "TA_CMI_JSON_Undef"; readingsBulkUpdateIfChanged
readingsBeginUpdate
$hash->{AttrList} = "username password interval readingNamesInputs readingNamesOutputs readingNamesDL-Bus readingNamesLoggingAnalog readingNamesLoggingDigital includePrettyReadings:0,1 includeUnitReadings:0,1 " . $readingFnAttributes; readingsEndUpdate
Log3
Log3 '', 3, "TA_CMI_JSON - Initialize done ..."; HttpUtils_Close
} HttpUtils_NonblockingGet
CommandDeleteReading
RemoveInternalTimer
InternalTimer
makeReadingName
AttrVal
json2nameValue
gettimeofday
))
};
sub TA_CMI_JSON_Define { sub TA_CMI_JSON_Define {
my ( $hash, $def ) = @_; my ( $hash, $def ) = @_;
@ -218,7 +246,7 @@ sub TA_CMI_JSON_ParseHttpResponse {
# Log3 $name, 3, "TA_CMI_JSON ($name) - Device: $keyValues->{Header_Device}"; # Log3 $name, 3, "TA_CMI_JSON ($name) - Device: $keyValues->{Header_Device}";
} }
my $functionName = "TA_CMI_JSON_GetStatus"; my $functionName = "TA_CMI_JSON::TA_CMI_JSON_GetStatus";
RemoveInternalTimer($hash, $functionName); RemoveInternalTimer($hash, $functionName);
InternalTimer( gettimeofday() + $hash->{INTERVAL}, $functionName, $hash, 0 ); InternalTimer( gettimeofday() + $hash->{INTERVAL}, $functionName, $hash, 0 );