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

HMCCU: Fixed bug in GetDutyCycle

git-svn-id: https://svn.fhem.de/fhem/trunk@27999 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
zap 2023-09-26 16:33:11 +00:00
parent 8728eda5f0
commit 33bf0677aa
6 changed files with 22 additions and 9 deletions

View File

@ -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.
- change: 88_HMCCU: Fixed bug in GetDutyCycle
- change: 88_HMCCU: Fixed substitute and authentication
- change: 93_DbRep: Improvement of markouts in special cases, Forum:#134973
- bugfix: 36_ShellyMonitor: Change written reading from relay_0 to state

View File

@ -57,7 +57,7 @@ my %HMCCU_CUST_CHN_DEFAULTS;
my %HMCCU_CUST_DEV_DEFAULTS;
# HMCCU version
my $HMCCU_VERSION = '5.0 232641921';
my $HMCCU_VERSION = '5.0 232691829';
# Timeout for CCU requests (seconds)
my $HMCCU_TIMEOUT_REQUEST = 4;
@ -10539,12 +10539,25 @@ sub HMCCU_GetDutyCycle ($)
my $dc = 0;
my $interfaces = HMCCU_GetRPCInterfaceList ($hash);
my %readings;
my %readings = ();
foreach my $port (values %$interfaces) {
next if ($port != 2001 && $port != 2010);
my ($url, $auth) = HMCCU_BuildURL ($hash, $port) // next;
my $rpcclient = RPC::XML::Client->new ($url);
my ($url, $auth) = HMCCU_BuildURL ($hash, $port);
if ($url eq '') {
HMCCU_Log ($hash, 2, "Cannot get RPC URL for port $port");
next;
}
my $header = HTTP::Headers->new ('Connection' => 'Keep-Alive');
$header->header('Authorization' => "Basic $auth") if ($auth) ne '';
my $rpcclient = RPC::XML::Client->new ($url,
useragent => [
ssl_opts => { verify_hostname => 0, SSL_verify_mode => 0 }
]
);
$rpcclient->useragent->default_headers($header);
my $response = $rpcclient->simple_request ('listBidcosInterfaces');
next if (!defined($response) || ref($response) ne 'ARRAY');
foreach my $iface (@$response) {

View File

@ -30,7 +30,7 @@ sub HMCCUCHN_Set ($@);
sub HMCCUCHN_Get ($@);
sub HMCCUCHN_Attr ($@);
my $HMCCUCHN_VERSION = '5.0 232641921';
my $HMCCUCHN_VERSION = '5.0 232691829';
######################################################################
# Initialize module

View File

@ -31,7 +31,7 @@ sub HMCCUDEV_Set ($@);
sub HMCCUDEV_Get ($@);
sub HMCCUDEV_Attr ($@);
my $HMCCUDEV_VERSION = '5.0 232641921';
my $HMCCUDEV_VERSION = '5.0 232691829';
######################################################################
# Initialize module

View File

@ -39,7 +39,7 @@ use SetExtensions;
######################################################################
# HMCCURPC version
my $HMCCURPCPROC_VERSION = '5.0 232641921';
my $HMCCURPCPROC_VERSION = '5.0 232691829';
# Maximum number of events processed per call of Read()
my $HMCCURPCPROC_MAX_EVENTS = 100;

View File

@ -326,10 +326,9 @@ $HMCCU_CONFIG_VERSION = '5.0';
# A Perl function name
# Datapoint-Def:
# No parameters: Paramset:Datapoints:[Parameter=]FixedValue[,...]
# Toggle command: Paramset:Datapoints
# One parameter: Paramset:Datapoints:?Parameter
# Optional parameter with default: Paramset:Datapoints:?Parameter=Default-Value
# List of values: Paramset:Datapoints:#Parameter[=FixedValue[,...]]
# List of values (also toggle): Paramset:Datapoints:#Parameter[=FixedValue[,...]]
# Internal value (paramset "I"): Paramset:Datapoints:*Parameter=Default-Value
# Paramset:
# V=VALUES, M=MASTER (channel), D=MASTER (device), I=INTERNAL