dev #103

Merged
marko merged 10 commits from dev into testing 2024-04-15 13:58:50 +00:00
4 changed files with 195 additions and 64 deletions

View File

@ -1,4 +1,94 @@
### fix: closes #90 (HEAD -> patch-fix_div_with_attributes) ### fix: patch code scheduling by hhhdg (HEAD -> patch_valve_hhhdg)
>Mon, 15 Apr 2024 09:32:51 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### controls_GardenaSmartDevice.txt aktualisiert
>Thu, 28 Mar 2024 06:05:59 +0100
>Author: Marko Oldenburg (marko@noreply@cooltux.net)
>Commiter: Marko Oldenburg (marko@noreply@cooltux.net)
### controls_GardenaSmartDevice.txt aktualisiert
>Thu, 28 Mar 2024 05:59:55 +0100
>Author: Marko Oldenburg (marko@noreply@cooltux.net)
>Commiter: Marko Oldenburg (marko@noreply@cooltux.net)
### fix: put to post (origin/patch_newstart_command, patch_newstart_command)
>Mon, 18 Mar 2024 10:15:25 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: new api start cmd
>Sun, 17 Mar 2024 20:58:13 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: catch null value (origin/patch_mucki_gwoffline, patch_mucki_gwoffline)
>Fri, 23 Feb 2024 22:52:25 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### fix: fix
>Wed, 21 Feb 2024 22:00:02 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### fix: push version
>Wed, 21 Feb 2024 21:58:05 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: fix error spam
>Wed, 21 Feb 2024 21:56:14 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### fix: closes #90
>Tue, 28 Nov 2023 08:52:33 +0100 >Tue, 28 Nov 2023 08:52:33 +0100
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net) >Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
@ -8,7 +98,7 @@
### fix: missing tree (origin/patch_mucki) ### fix: missing tree (origin/patch_mucki, patch_mucki)
>Sun, 12 Nov 2023 19:47:49 +0100 >Sun, 12 Nov 2023 19:47:49 +0100
>Author: Sebastian (em@ail.tld) >Author: Sebastian (em@ail.tld)

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} . '-'
@ -754,7 +758,10 @@ sub WriteReadings {
. $propertie->{name} ne 'ic24-valves_connected' . $propertie->{name} ne 'ic24-valves_connected'
&& $decode_json->{abilities}[$abilities]{name} . '-' && $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ne 'ic24-valves_master_config' . $propertie->{name} ne 'ic24-valves_master_config'
&& ref( $propertie->{value} ) ne "HASH" ); && ( $decode_json->{abilities}[$abilities]{name} . '-'
. $propertie->{name} ) !~ /scheduling-timeslot_state_\d/
&& ref( $propertie->{value} ) ne "HASH"
);
readingsBulkUpdateIfChanged( readingsBulkUpdateIfChanged(
$hash, $hash,
@ -851,6 +858,29 @@ 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" )
{
while ( my ( $r, $v ) = each @{ $propertie->{value} } ) {
if ( ref($v) eq "HASH" ) {
my $entry = $r + 1;
while ( my ( $i_r, $i_v ) = each %{$v} ) {
readingsBulkUpdateIfChanged(
$hash,
$decode_json->{abilities}[$abilities]{name}
. '-'
. $propertie->{name} . '_'
. $entry . '_'
. $i_r,
RigReadingsValue( $hash, $i_v )
);
}
}
}
} # fi defined
# ic24 and other watering devices calc irrigation left in sec # ic24 and other watering devices calc irrigation left in sec
readingsBulkUpdateIfChanged( readingsBulkUpdateIfChanged(
$hash, $hash,
@ -907,15 +937,15 @@ sub WriteReadings {
foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) { foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) {
my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" ); my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" );
push @ist, $dev_reading push @ist, $dev_reading
if $dev_schedules =~ /schedule.*\d_id/; # push reading _id if $dev_schedules =~ /schedule.*\d+_id/; # push reading _id
push @ist, $1 push @ist, $1
if $dev_schedules =~ if $dev_schedules =~
/schedule.*_(\d)_id/; # push readigs d from x_id /schedule.*_(\d+)_id/; # push readigs d from x_id
Log3 $name, 5, Log3 $name, 5,
"[DEBUG] $name - Schedule - Key ist : $dev_schedules "; "[DEBUG] $name - Schedule - Key ist : $dev_schedules ";
Log3 $name, 5, "[DEBUG] $name - Schedule - ID FOUND $dev_reading" Log3 $name, 5, "[DEBUG] $name - Schedule - ID FOUND $dev_reading"
if $dev_schedules =~ /schedule.*_\d_id/; # cloud hat SOLL if $dev_schedules =~ /schedule.*_\d+_id/; # cloud hat SOLL
} }
#Log3 $name, 5, "[DEBUG] Cloud:".Dumper(@soll) . "- Internal:". Dumper(@ist); #Log3 $name, 5, "[DEBUG] Cloud:".Dumper(@soll) . "- Internal:". Dumper(@ist);
@ -951,15 +981,13 @@ sub WriteReadings {
&& scalar(@soll) != scalar( @ist / 2 ) ) && scalar(@soll) != scalar( @ist / 2 ) )
{ {
while ( my $old_schedule_id = shift(@ist) ) { while ( my $old_schedule_id = shift(@ist) ) {
if ( length($old_schedule_id) == 1 ) {
foreach ( keys %{ $hash->{READINGS} } ) { foreach ( keys %{ $hash->{READINGS} } ) {
delete $hash->{READINGS}->{$_} delete $hash->{READINGS}->{$_}
if ( $_ =~ if ( $_ =~
/scheduling-schedules_event_$old_schedule_id.*/ ); /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}_.*"
if length($old_schedule_id) == 1; if length($old_schedule_id) == 1;
} }
} }
@ -2684,7 +2712,7 @@ sub SetPredefinedStartPoints {
], ],
"release_status": "stable", "release_status": "stable",
"license": "GPL_2", "license": "GPL_2",
"version": "v2.6.2", "version": "v2.6.3",
"author": [ "author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>" "Marko Oldenburg <fhemdevelopment@cooltux.net>"
], ],

View File

@ -1,2 +1,2 @@
UPD 2024-03-28_12:39:18 49572 FHEM/73_GardenaSmartBridge.pm UPD 2024-04-15_15:52:28 49971 FHEM/73_GardenaSmartBridge.pm
UPD 2024-03-28_12:39:18 126450 FHEM/74_GardenaSmartDevice.pm UPD 2024-04-15_15:52:28 127762 FHEM/74_GardenaSmartDevice.pm