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

73_GardenaSmartBridge: multiple bugfixes,changed published gateway informations

git-svn-id: https://svn.fhem.de/fhem/trunk@28216 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
LeonGaultier 2023-11-28 08:00:25 +00:00
parent 8053475b6e
commit 2bb3a481fe
3 changed files with 1579 additions and 548 deletions

View File

@ -1,5 +1,7 @@
# 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.
- bugfix: 73_GardenaSmartBridge: multiple bugfixes,
changed published gateway informations
- feature: 76_SolarForecast: new Attr graphicHeaderOwnspecValForm - feature: 76_SolarForecast: new Attr graphicHeaderOwnspecValForm
- feature: 58_RPI_1Wire: added on-for-timer and validated DS2408 - feature: 58_RPI_1Wire: added on-for-timer and validated DS2408
- change: 10_KNX.pm: minor changes, see Forum #122582 - change: 10_KNX.pm: minor changes, see Forum #122582

View File

@ -75,9 +75,9 @@ eval { use IO::Socket::SSL; 1 }
# try to use JSON::MaybeXS wrapper # try to use JSON::MaybeXS wrapper
# for chance of better performance + open code # for chance of better performance + open code
eval { eval {
require JSON::MaybeXS; require JSON::MaybeXS;
import JSON::MaybeXS qw( decode_json encode_json ); import JSON::MaybeXS qw( decode_json encode_json );
1; 1;
} or do { } or do {
# try to use JSON wrapper # try to use JSON wrapper
@ -166,7 +166,7 @@ BEGIN {
GP_Export( GP_Export(
qw( qw(
Initialize Initialize
) )
); );
sub Initialize { sub Initialize {
@ -437,12 +437,14 @@ sub Set {
DeletePassword($hash); DeletePassword($hash);
} }
elsif ( lc $cmd eq 'debughelper') { elsif ( lc $cmd eq 'debughelper' ) {
return "usage: $cmd" if ( scalar( @{$aArg} ) != 2 ); return "usage: $cmd" if ( scalar( @{$aArg} ) != 2 );
my $new_helper = $aArg->[0]; my $new_helper = $aArg->[0];
my $new_helper_value = $aArg->[1]; my $new_helper_value = $aArg->[1];
Log3( $name, 5, "[DEBUG] - GardenaSmartBridge ($name) - override helper $new_helper with $new_helper_value"); Log3( $name, 5,
$hash->{helper}{$new_helper} = $new_helper_value; "[DEBUG] - GardenaSmartBridge ($name) - override helper $new_helper with $new_helper_value"
);
$hash->{helper}{$new_helper} = $new_helper_value;
} }
else { else {
@ -488,8 +490,8 @@ sub Write {
"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method" "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method"
); );
# Log3($name, 3, # Log3($name, 3,
# "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method"); # "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
return; return;
} }
@ -611,8 +613,7 @@ sub ErrorHandling {
} }
if ( if (
$data =~ /Error/ $data =~ /Error/ && $data !~ /lastLonaErrorCode/
&& $data !~ /lastLonaErrorCode/
|| ( defined($decode_json) || ( defined($decode_json)
&& ref($decode_json) eq 'HASH' && ref($decode_json) eq 'HASH'
&& defined( $decode_json->{errors} ) ) && defined( $decode_json->{errors} ) )
@ -627,26 +628,32 @@ sub ErrorHandling {
if ( $param->{code} == 400 ) { if ( $param->{code} == 400 ) {
if ($decode_json) { if ($decode_json) {
if ( ref( $decode_json->{errors} ) eq "ARRAY" if ( ref( $decode_json->{errors} ) eq "ARRAY"
&& defined( $decode_json->{errors} ) ) && exists( $decode_json->{errors} ) )
# replace defined with exists
# && defined( $decode_json->{errors} ) )
{ {
readingsBulkUpdate( # $decode_json->{errors} -> ARRAY
# $decode_json->{errors}[0] -> HASH
if (exists ($decode_json->{errors}[0]{error}) ) {
readingsBulkUpdate(
$dhash, $dhash,
"state", "state",
$decode_json->{errors}[0]{error} . ' ' $decode_json->{errors}[0]{error} . ' '
. $decode_json->{errors}[0]{attribute}, . $decode_json->{errors}[0]{attribute},
1 1
); );
readingsBulkUpdate( readingsBulkUpdate(
$dhash, $dhash,
"lastRequestState", "lastRequestState",
$decode_json->{errors}[0]{error} . ' ' $decode_json->{errors}[0]{error} . ' '
. $decode_json->{errors}[0]{attribute}, . $decode_json->{errors}[0]{attribute},
1 1
); );
Log3 $dname, 5, Log3 $dname, 5,
"GardenaSmartBridge ($dname) - RequestERROR: " "GardenaSmartBridge ($dname) - RequestERROR: "
. $decode_json->{errors}[0]{error} . " " . $decode_json->{errors}[0]{error} . " "
. $decode_json->{errors}[0]{attribute}; . $decode_json->{errors}[0]{attribute};
} # fi exists error
} }
} }
else { else {
@ -737,7 +744,7 @@ sub ErrorHandling {
my $i = 0; my $i = 0;
for my $dev_settings ( @{ $devJson->{settings} } ) { for my $dev_settings ( @{ $devJson->{settings} } ) {
$output .= "[" . $i++ . "]id: $dev_settings->{id} \n"; $output .= "[" . $i++ . "]id: $dev_settings->{id} \n";
$output .= "name: $dev_settings->{name} "; $output .= "name: $dev_settings->{name} \n";
if ( ref( $dev_settings->{value} ) eq 'ARRAY' if ( ref( $dev_settings->{value} ) eq 'ARRAY'
|| ref( $dev_settings->{value} ) eq 'HASH' ) || ref( $dev_settings->{value} ) eq 'HASH' )
{ {
@ -753,16 +760,7 @@ sub ErrorHandling {
for my $dev_settings ( @{ $devJson->{abilities} } ) { for my $dev_settings ( @{ $devJson->{abilities} } ) {
$output .= "[" . $i++ . "]id: $dev_settings->{id} \n"; $output .= "[" . $i++ . "]id: $dev_settings->{id} \n";
$output .= "name: $dev_settings->{name} "; $output .= "name: $dev_settings->{name} \n";
if ( ref( $dev_settings->{value} ) eq 'ARRAY'
|| ref( $dev_settings->{value} ) eq 'HASH' )
{
$output .= 'N/A \n';
}
else {
$output .= "value: $dev_settings->{value} \n";
}
} }
$hash->{helper}{debug_device_output} = $output; $hash->{helper}{debug_device_output} = $output;
@ -1078,36 +1076,16 @@ sub WriteReadings {
) )
&& ref($v) eq 'HASH' && ref($v) eq 'HASH'
) )
{ {
if ( $decode_json->{abilities}[0]{properties} if ($v->{is_connected} ) {
[$properties]{name} eq 'ethernet_status' ) readingsBulkUpdateIfChanged( $hash,
{ $decode_json->{abilities}[0]{properties}[$properties]{name}.'-ip', $v->{ip} )
readingsBulkUpdateIfChanged( $hash, if ( ref( $v->{ip} ) ne 'HASH' );
'ethernet_status-mac', $v->{mac} ); readingsBulkUpdateIfChanged( $hash,
readingsBulkUpdateIfChanged( $hash, $decode_json->{abilities}[0]{properties}[$properties]{name}.'-isconnected', $v->{is_connected} )
'ethernet_status-ip', $v->{ip} ) if ( $v->{is_connected} );
if ( ref( $v->{ip} ) ne 'HASH' );
readingsBulkUpdateIfChanged( $hash,
'ethernet_status-isconnected',
$v->{isConnected} );
} }
elsif ( $decode_json->{abilities}[0]{properties} } # fi ethernet and wifi
[$properties]{name} eq 'wifi_status' )
{
readingsBulkUpdateIfChanged( $hash,
'wifi_status-ssid', $v->{ssid} )
if ( ref( $v->{ssid} ) ne 'HASH' );
readingsBulkUpdateIfChanged( $hash,
'wifi_status-mac', $v->{mac} );
readingsBulkUpdateIfChanged( $hash,
'wifi_status-ip', $v->{ip} )
if ( ref( $v->{ip} ) ne 'HASH' );
readingsBulkUpdateIfChanged( $hash,
'wifi_status-isconnected', $v->{isConnected} );
readingsBulkUpdateIfChanged( $hash,
'wifi_status-signal', $v->{signal} );
}
}
} }
$properties--; $properties--;
@ -1583,7 +1561,7 @@ sub DeletePassword {
], ],
"release_status": "stable", "release_status": "stable",
"license": "GPL_2", "license": "GPL_2",
"version": "v2.5.2", "version": "v2.6.1",
"author": [ "author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>" "Marko Oldenburg <fhemdevelopment@cooltux.net>"
], ],

File diff suppressed because it is too large Load Diff