dev #103

Merged
marko merged 10 commits from dev into testing 2024-04-15 13:58:50 +00:00
3 changed files with 81 additions and 60 deletions
Showing only changes of commit 8b66df8407 - Show all commits

View File

@ -2,7 +2,7 @@
# #
# Developed with VSCodium and richterger perl plugin. # 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 # All rights reserved
# #
# Special thanks goes to comitters: # Special thanks goes to comitters:
@ -629,6 +629,7 @@ sub ErrorHandling {
if ($decode_json) { if ($decode_json) {
if ( ref( $decode_json->{errors} ) eq "ARRAY" if ( ref( $decode_json->{errors} ) eq "ARRAY"
&& exists( $decode_json->{errors} ) ) && exists( $decode_json->{errors} ) )
# replace defined with exists # replace defined with exists
# && defined( $decode_json->{errors} ) ) # && defined( $decode_json->{errors} ) )
{ {
@ -1060,11 +1061,17 @@ sub WriteReadings {
#$v = encode_utf8($v); #$v = encode_utf8($v);
$v = ' ' if ( !defined $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] 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/ ); {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/ ); {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/ ); {name} !~ /ethernet_status|wifi_status/ );
readingsBulkUpdateIfChanged( readingsBulkUpdateIfChanged(
@ -1086,12 +1093,18 @@ sub WriteReadings {
) )
{ {
if ( $v->{is_connected} ) { if ( $v->{is_connected} ) {
readingsBulkUpdateIfChanged( $hash, readingsBulkUpdateIfChanged(
$decode_json->{abilities}[0]{properties}[$properties]{name}.'-ip', $v->{ip} ) $hash,
if ( ref( $v->{ip} ) ne 'HASH' ); $decode_json->{abilities}[0]{properties}
readingsBulkUpdateIfChanged( $hash, [$properties]{name} . '-ip',
$decode_json->{abilities}[0]{properties}[$properties]{name}.'-isconnected', $v->{is_connected} ) $v->{ip}
if ( $v->{is_connected} ); ) 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
} }

View File

@ -2,7 +2,7 @@
# #
# Developed with VSCodium and richterger perl plugin. # 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 # All rights reserved
# #
# Special thanks goes to comitters: # Special thanks goes to comitters:
@ -324,7 +324,8 @@ sub Set {
elsif ( lc $cmd eq 'parkuntilnexttimer' ) { elsif ( lc $cmd eq 'parkuntilnexttimer' ) {
$payload = '"name":"park_until_next_timer"'; $payload = '"name":"park_until_next_timer"';
if ( $mainboard_version > 10.30 ) { if ( $mainboard_version > 10.30 ) {
$payload = '"mowerTimer":0,"startingPointDistance":null,"areaId":null'; $payload =
'"mowerTimer":0,"startingPointDistance":null,"areaId":null';
$abilities = 'mower'; $abilities = 'mower';
} }
} }
@ -339,12 +340,14 @@ sub Set {
} }
} }
elsif ( lc $cmd eq 'startoverridetimer' ) { elsif ( lc $cmd eq 'startoverridetimer' ) {
# $payload = '"name":"start_override_timer","parameters":{"duration":' # $payload = '"name":"start_override_timer","parameters":{"duration":'
# . $aArg->[0] * 60 . '}'; # . $aArg->[0] * 60 . '}';
# if ( $mainboard_version > 10.30 ) { # if ( $mainboard_version > 10.30 ) {
$payload = '"startingPointDistance":null,"areaId":null, "mowerTimer": ' $payload = '"startingPointDistance":null,"areaId":null, "mowerTimer": '
. $aArg->[0] * 60; . $aArg->[0] * 60;
$abilities = 'mower'; $abilities = 'mower';
# } removed code < 10.30 api changes March 2024 # } removed code < 10.30 api changes March 2024
} }
@ -735,7 +738,8 @@ sub WriteReadings {
. RigReadingsValue( $hash, . RigReadingsValue( $hash,
$propertie->{value} ) # cast all data to string with "" $propertie->{value} ) # cast all data to string with ""
) )
if ( exists( $propertie->{value} ) if (
exists( $propertie->{value} )
&& $decode_json->{abilities}[$abilities]{name} . '-' && $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ne 'radio-quality' . $propertie->{name} ne 'radio-quality'
&& $decode_json->{abilities}[$abilities]{name} . '-' && $decode_json->{abilities}[$abilities]{name} . '-'
@ -756,7 +760,8 @@ sub WriteReadings {
. $propertie->{name} ne 'ic24-valves_master_config' . $propertie->{name} ne 'ic24-valves_master_config'
&& ( $decode_json->{abilities}[$abilities]{name} . '-' && ( $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ) !~ /scheduling-timeslot_state_\d/ . $propertie->{name} ) !~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) ne "HASH" ); && ref( $propertie->{value} ) ne "HASH"
);
readingsBulkUpdateIfChanged( readingsBulkUpdateIfChanged(
$hash, $hash,
@ -852,11 +857,13 @@ sub WriteReadings {
} }
} }
} }
# decode timeslot_state_N arrays code by hhhdg # decode timeslot_state_N arrays code by hhhdg
if ( defined( $propertie->{value} ) if ( defined( $propertie->{value} )
&& $decode_json->{abilities}[$abilities]{name} . '-' && $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} =~ /scheduling-timeslot_state_\d/ . $propertie->{name} =~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) eq "ARRAY" ) { && ref( $propertie->{value} ) eq "ARRAY" )
{
while ( my ( $r, $v ) = each @{ $propertie->{value} } ) { while ( my ( $r, $v ) = each @{ $propertie->{value} } ) {
if ( ref($v) eq "HASH" ) { if ( ref($v) eq "HASH" ) {
my $entry = $r + 1; my $entry = $r + 1;
@ -976,7 +983,8 @@ sub WriteReadings {
while ( my $old_schedule_id = shift(@ist) ) { while ( my $old_schedule_id = shift(@ist) ) {
foreach ( keys %{ $hash->{READINGS} } ) { foreach ( keys %{ $hash->{READINGS} } ) {
delete $hash->{READINGS}->{$_} delete $hash->{READINGS}->{$_}
if ( $_ =~ /scheduling-schedules_event_${old_schedule_id}_.*/ ); if ( $_ =~
/scheduling-schedules_event_${old_schedule_id}_.*/ );
} # fi } # fi
Log3 $name, 5, Log3 $name, 5,
"[DEBUG] - $name : deletereading scheduling-schedules_event_${old_schedule_id}_.*" "[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_15:44:03 49971 FHEM/73_GardenaSmartBridge.pm
UPD 2024-04-15_09:37:55 127663 FHEM/74_GardenaSmartDevice.pm UPD 2024-04-15_15:43:50 127762 FHEM/74_GardenaSmartDevice.pm