Merge pull request 'docs: change copyright year' (#102) from patch-merge into dev

Reviewed-on: #102
This commit is contained in:
Marko Oldenburg 2024-04-15 15:46:41 +02:00
commit 80147631d6
3 changed files with 81 additions and 60 deletions

View File

@ -2,7 +2,7 @@
#
# Developed with VSCodium and richterger perl plugin.
#
# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# (c) 2017-2024 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# All rights reserved
#
# Special thanks goes to comitters:
@ -75,9 +75,9 @@ eval { use IO::Socket::SSL; 1 }
# try to use JSON::MaybeXS wrapper
# for chance of better performance + open code
eval {
require JSON::MaybeXS;
import JSON::MaybeXS qw( decode_json encode_json );
1;
require JSON::MaybeXS;
import JSON::MaybeXS qw( decode_json encode_json );
1;
} or do {
# try to use JSON wrapper
@ -629,31 +629,32 @@ sub ErrorHandling {
if ($decode_json) {
if ( ref( $decode_json->{errors} ) eq "ARRAY"
&& exists( $decode_json->{errors} ) )
# replace defined with exists
# && defined( $decode_json->{errors} ) )
# replace defined with exists
# && defined( $decode_json->{errors} ) )
{
# $decode_json->{errors} -> ARRAY
# $decode_json->{errors}[0] -> HASH
if (exists ($decode_json->{errors}[0]{error}) ) {
readingsBulkUpdate(
$dhash,
"state",
$decode_json->{errors}[0]{error} . ' '
. $decode_json->{errors}[0]{attribute},
1
);
readingsBulkUpdate(
$dhash,
"lastRequestState",
$decode_json->{errors}[0]{error} . ' '
. $decode_json->{errors}[0]{attribute},
1
);
Log3 $dname, 5,
"GardenaSmartBridge ($dname) - RequestERROR: "
. $decode_json->{errors}[0]{error} . " "
. $decode_json->{errors}[0]{attribute};
} # fi exists error
if ( exists( $decode_json->{errors}[0]{error} ) ) {
readingsBulkUpdate(
$dhash,
"state",
$decode_json->{errors}[0]{error} . ' '
. $decode_json->{errors}[0]{attribute},
1
);
readingsBulkUpdate(
$dhash,
"lastRequestState",
$decode_json->{errors}[0]{error} . ' '
. $decode_json->{errors}[0]{attribute},
1
);
Log3 $dname, 5,
"GardenaSmartBridge ($dname) - RequestERROR: "
. $decode_json->{errors}[0]{error} . " "
. $decode_json->{errors}[0]{attribute};
} # fi exists error
}
}
else {
@ -1059,12 +1060,18 @@ sub WriteReadings {
if ( ref($v) eq 'ARRAY' );
#$v = encode_utf8($v);
$v = ' ' if (!defined $v);
Log3 $name, 4, "Gardena DEBUG DEBUG DEBUG stage 1 ".$decode_json->{abilities}[0]{properties}[$properties]{name} if ( $decode_json->{abilities}[0]{properties}[$properties]
$v = ' ' if ( !defined $v );
Log3 $name, 4,
"Gardena DEBUG DEBUG DEBUG stage 1 "
. $decode_json->{abilities}[0]{properties}[$properties]
{name}
if ( $decode_json->{abilities}[0]{properties}[$properties]
{name} !~ /ethernet_status|wifi_status/ );
Log3 $name, 4, "Gardena DEBUG DEBUG DEBUG stage 2".$t if ( $decode_json->{abilities}[0]{properties}[$properties]
Log3 $name, 4, "Gardena DEBUG DEBUG DEBUG stage 2" . $t
if ( $decode_json->{abilities}[0]{properties}[$properties]
{name} !~ /ethernet_status|wifi_status/ );
Log3 $name, 4, "Gardena DEBUG DEBUG DEBUG stage 3".$v if ( $decode_json->{abilities}[0]{properties}[$properties]
Log3 $name, 4, "Gardena DEBUG DEBUG DEBUG stage 3" . $v
if ( $decode_json->{abilities}[0]{properties}[$properties]
{name} !~ /ethernet_status|wifi_status/ );
readingsBulkUpdateIfChanged(
@ -1084,16 +1091,22 @@ sub WriteReadings {
)
&& ref($v) eq 'HASH'
)
{
if ($v->{is_connected} ) {
readingsBulkUpdateIfChanged( $hash,
$decode_json->{abilities}[0]{properties}[$properties]{name}.'-ip', $v->{ip} )
if ( ref( $v->{ip} ) ne 'HASH' );
readingsBulkUpdateIfChanged( $hash,
$decode_json->{abilities}[0]{properties}[$properties]{name}.'-isconnected', $v->{is_connected} )
if ( $v->{is_connected} );
{
if ( $v->{is_connected} ) {
readingsBulkUpdateIfChanged(
$hash,
$decode_json->{abilities}[0]{properties}
[$properties]{name} . '-ip',
$v->{ip}
) if ( ref( $v->{ip} ) ne 'HASH' );
readingsBulkUpdateIfChanged(
$hash,
$decode_json->{abilities}[0]{properties}
[$properties]{name} . '-isconnected',
$v->{is_connected}
) if ( $v->{is_connected} );
}
} # fi ethernet and wifi
} # fi ethernet and wifi
}
$properties--;
@ -1326,7 +1339,7 @@ sub createHttpValueStrings {
&& $abilities eq 'mower' )
{
my $valve_id;
$uri .=
'/devices/'
. $deviceId

View File

@ -2,7 +2,7 @@
#
# Developed with VSCodium and richterger perl plugin.
#
# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# (c) 2017-2024 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# All rights reserved
#
# Special thanks goes to comitters:
@ -324,7 +324,8 @@ sub Set {
elsif ( lc $cmd eq 'parkuntilnexttimer' ) {
$payload = '"name":"park_until_next_timer"';
if ( $mainboard_version > 10.30 ) {
$payload = '"mowerTimer":0,"startingPointDistance":null,"areaId":null';
$payload =
'"mowerTimer":0,"startingPointDistance":null,"areaId":null';
$abilities = 'mower';
}
}
@ -339,12 +340,14 @@ sub Set {
}
}
elsif ( lc $cmd eq 'startoverridetimer' ) {
# $payload = '"name":"start_override_timer","parameters":{"duration":'
# . $aArg->[0] * 60 . '}';
# . $aArg->[0] * 60 . '}';
# if ( $mainboard_version > 10.30 ) {
$payload = '"startingPointDistance":null,"areaId":null, "mowerTimer": '
. $aArg->[0] * 60;
$abilities = 'mower';
$payload = '"startingPointDistance":null,"areaId":null, "mowerTimer": '
. $aArg->[0] * 60;
$abilities = 'mower';
# } removed code < 10.30 api changes March 2024
}
@ -735,7 +738,8 @@ sub WriteReadings {
. RigReadingsValue( $hash,
$propertie->{value} ) # cast all data to string with ""
)
if ( exists( $propertie->{value} )
if (
exists( $propertie->{value} )
&& $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ne 'radio-quality'
&& $decode_json->{abilities}[$abilities]{name} . '-'
@ -754,9 +758,10 @@ sub WriteReadings {
. $propertie->{name} ne 'ic24-valves_connected'
&& $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ne 'ic24-valves_master_config'
&& ($decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name}) !~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) ne "HASH" );
&& ( $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ) !~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) ne "HASH"
);
readingsBulkUpdateIfChanged(
$hash,
@ -852,14 +857,16 @@ sub WriteReadings {
}
}
}
# decode timeslot_state_N arrays code by hhhdg
if ( defined( $propertie->{value} )
&& $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} =~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) eq "ARRAY" ) {
. $propertie->{name} =~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) eq "ARRAY" )
{
while ( my ( $r, $v ) = each @{ $propertie->{value} } ) {
if ( ref($v) eq "HASH" ) {
my $entry = $r+1;
my $entry = $r + 1;
while ( my ( $i_r, $i_v ) = each %{$v} ) {
readingsBulkUpdateIfChanged(
$hash,
@ -873,8 +880,8 @@ sub WriteReadings {
}
}
}
} # fi defined
# ic24 and other watering devices calc irrigation left in sec
} # fi defined
# ic24 and other watering devices calc irrigation left in sec
readingsBulkUpdateIfChanged(
$hash,
$decode_json->{abilities}[$abilities]{name} . '-'
@ -974,9 +981,10 @@ sub WriteReadings {
&& scalar(@soll) != scalar( @ist / 2 ) )
{
while ( my $old_schedule_id = shift(@ist) ) {
foreach ( keys %{ $hash->{READINGS} } ) {
delete $hash->{READINGS}->{$_}
if ( $_ =~ /scheduling-schedules_event_${old_schedule_id}_.*/ );
foreach ( keys %{ $hash->{READINGS} } ) {
delete $hash->{READINGS}->{$_}
if ( $_ =~
/scheduling-schedules_event_${old_schedule_id}_.*/ );
} # fi
Log3 $name, 5,
"[DEBUG] - $name : deletereading scheduling-schedules_event_${old_schedule_id}_.*"

View File

@ -1,2 +1,2 @@
UPD 2024-04-15_09:21:58 49572 FHEM/73_GardenaSmartBridge.pm
UPD 2024-04-15_09:37:55 127663 FHEM/74_GardenaSmartDevice.pm
UPD 2024-04-15_15:44:03 49971 FHEM/73_GardenaSmartBridge.pm
UPD 2024-04-15_15:43:50 127762 FHEM/74_GardenaSmartDevice.pm