Compare commits

...

56 Commits
v2.6.0 ... main

Author SHA1 Message Date
ea58454cca Merge pull request 'testing' (#110) from testing into main
Reviewed-on: #110
2024-05-22 19:14:16 +02:00
8972880d78 Merge pull request 'dev' (#109) from dev into testing
Reviewed-on: #109
2024-05-22 19:13:47 +02:00
c75f865589 Merge pull request 'patch_login_autodisable_api' (#108) from patch_login_autodisable_api into dev
Reviewed-on: #108
2024-05-22 19:10:36 +02:00
Sebastian
9412aac176 fix: disable after 5 attemps 2024-05-22 18:46:38 +02:00
Sebastian
ae437a09f2 fix: push 2024-05-22 18:40:04 +02:00
Sebastian
640a7544d7 fix: api und disablle 2024-05-22 18:15:35 +02:00
Sebastian
f38236f721 fix: intervall 180 sek add useragent 2024-05-21 22:45:49 +02:00
Sebastian
517f033ccc fix: api call, login limit, disable 2024-05-21 10:31:30 +02:00
Sebastian
03b2130625 fix: api call,rate limit 2024-05-21 10:29:07 +02:00
c55d7b4f1b Merge pull request 'testing' (#106) from testing into main
Reviewed-on: #106
2024-05-03 12:44:56 +02:00
90a561be10 Merge pull request 'dev' (#103) from dev into testing
Reviewed-on: #103
2024-04-15 15:58:49 +02:00
69d7681a28 Merge pull request 'patch-merge2' (#105) from patch-merge2 into dev
Reviewed-on: #105
2024-04-15 15:58:25 +02:00
5e60969fc4 fix: merge branch
Merge branch 'patch-merge' into patch-merge2
2024-04-15 15:57:29 +02:00
2d756e4aaa Merge pull request 'testing' (#104) from testing into main
Reviewed-on: #104
2024-04-15 15:48:53 +02:00
80147631d6 Merge pull request 'docs: change copyright year' (#102) from patch-merge into dev
Reviewed-on: #102
2024-04-15 15:46:41 +02:00
8b66df8407 docs: change copyright year
Ticket: no
2024-04-15 15:45:33 +02:00
fc3740fe9b Merge pull request 'fix: version push' (#100) from patch_valve_hhhdg into dev
Reviewed-on: #100
2024-04-15 09:38:54 +02:00
Sebastian
03ad7e3fba fix: version push 2024-04-15 09:38:16 +02:00
dfea4716d3 Merge pull request 'fix: patch code scheduling by hhhdg' (#99) from patch_valve_hhhdg into dev
Reviewed-on: #99
2024-04-15 09:36:13 +02:00
Sebastian
f9661f6452 fix: patch code scheduling by hhhdg 2024-04-15 09:32:51 +02:00
b41e583a9e Merge pull request 'docs: new CHANGELOG' (#98) from patch-tetsing into testing
Reviewed-on: #98
2024-03-28 12:42:10 +01:00
5138e6b3b0 docs: new CHANGELOG 2024-03-28 12:41:42 +01:00
89bc35b1bd Merge pull request 'dev' (#97) from dev into testing
Reviewed-on: #97
2024-03-28 08:16:03 +01:00
03e79bc782 Merge pull request 'patch_mucki_gwoffline' (#96) from patch_mucki_gwoffline into dev
Reviewed-on: #96
2024-03-28 06:06:33 +01:00
74635dfd0a controls_GardenaSmartDevice.txt aktualisiert 2024-03-28 06:05:59 +01:00
443ecd7776 controls_GardenaSmartDevice.txt aktualisiert 2024-03-28 05:59:55 +01:00
bbb4be939c Merge pull request 'patch_newstart_command' (#94) from patch_newstart_command into dev
Reviewed-on: #94
2024-03-27 20:03:15 +01:00
Sebastian
72daa71daf fix: put to post 2024-03-18 10:15:25 +01:00
Sebastian
68f66c8430 test: new api start cmd 2024-03-17 20:58:13 +01:00
Sebastian
579f632990 test: catch null value 2024-02-23 22:52:25 +01:00
Sebastian
790d5206b6 fix: fix 2024-02-21 22:00:02 +01:00
Sebastian
2c94924e97 fix: push version 2024-02-21 21:58:05 +01:00
Sebastian
918f4dc6a3 test: fix error spam 2024-02-21 21:56:14 +01:00
f14d34c1b4 Merge pull request 'dev' (#92) from dev into main
Reviewed-on: #92
2023-11-28 08:54:39 +01:00
274cb067cf Merge pull request 'patch-fix_div_with_attributes' (#91) from patch-fix_div_with_attributes into dev
Reviewed-on: #91
2023-11-28 08:54:09 +01:00
897a3c7aef fix: closes #90 2023-11-28 08:52:33 +01:00
232f82eafe Merge pull request 'testing' (#89) from testing into main
Reviewed-on: #89
2023-11-28 08:34:50 +01:00
9c49aa49b9 Merge pull request 'dev' (#88) from dev into testing
Reviewed-on: #88
2023-11-28 08:34:14 +01:00
24db680413 Merge pull request 'patch_mucki' (#87) from patch_mucki into dev
Reviewed-on: #87
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2023-11-20 20:43:36 +01:00
Sebastian
df1830a670 fix: missing tree 2023-11-12 19:47:49 +01:00
Sebastian
de58578a2d test: smartdevice variable wintermode initializied
Bridge consolidiert wifi/ethernet
2023-11-05 21:52:24 +01:00
Sebastian
e15a70ff0b test: fix initial variables 2023-11-01 21:04:39 +01:00
Sebastian
98b093bcba test: debug line 2023-10-28 18:02:17 +02:00
Sebastian
82907c73a3 test: cleanup initial error handling 2023-10-25 22:16:26 +02:00
Sebastian
13de67f570 test: fix wifi status if is_connected 2023-10-23 22:04:31 +02:00
Sebastian
7385959b38 test: changed published gateway informations 2023-10-21 20:21:31 +02:00
Sebastian
7dfa0b2dda test: gateway readings changed by gardena 2023-10-12 21:52:51 +02:00
Sebastian
abb325b448 test: versions pump 2023-10-03 22:40:58 +02:00
d7d5e4f843 Merge pull request 'dev' (#86) from dev into testing
Reviewed-on: #86
2023-03-15 18:17:18 +01:00
c0dec3d3fb Merge pull request 'patch_setExtention' (#85) from patch_setExtention into dev
Reviewed-on: #85
2023-03-15 18:15:48 +01:00
Sebastian
3e540471d5 feat: changelog 2023-03-02 11:58:58 +01:00
Sebastian
608719ba2f feat: add setextention 2023-03-02 11:58:29 +01:00
Sebastian
472fe88ac0 feat: test 2023-03-02 11:30:19 +01:00
682dea8bd1 Merge pull request 'testing' (#83) from testing into main
Reviewed-on: #83
2023-01-10 10:01:11 +01:00
fb3a690993 Merge pull request 'dev' (#82) from dev into testing
Reviewed-on: #82
2023-01-10 10:00:38 +01:00
2cae1812d8 Merge pull request 'patch-changeVersion' (#81) from patch-changeVersion into dev
Reviewed-on: #81
2023-01-10 10:00:15 +01:00
4 changed files with 448 additions and 110 deletions

View File

@ -1,4 +1,275 @@
### docs: change verson numbers (HEAD -> patch-changeVersion)
### fix: api call,rate limit (HEAD -> patch_login_autodisable_api)
>Tue, 21 May 2024 10:29:07 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### docs: change copyright year
>Mon, 15 Apr 2024 15:45:33 +0200
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
>Commiter: Marko Oldenburg (fhemdevelopment@cooltux.net)
Ticket: no
### fix: version push (origin/patch_valve_hhhdg, patch_valve_hhhdg)
>Mon, 15 Apr 2024 09:38:16 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### fix: patch code scheduling by hhhdg
>Mon, 15 Apr 2024 09:32:51 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### docs: new CHANGELOG
>Thu, 28 Mar 2024 12:41:42 +0100
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
>Commiter: Marko Oldenburg (fhemdevelopment@cooltux.net)
### 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
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
>Commiter: Marko Oldenburg (fhemdevelopment@cooltux.net)
### fix: missing tree (origin/patch_mucki, patch_mucki)
>Sun, 12 Nov 2023 19:47:49 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: smartdevice variable wintermode initializied Bridge consolidiert wifi/ethernet
>Sun, 5 Nov 2023 21:52:24 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: fix initial variables
>Wed, 1 Nov 2023 21:04:39 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: debug line
>Sat, 28 Oct 2023 18:02:17 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: cleanup initial error handling
>Wed, 25 Oct 2023 22:16:26 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: fix wifi status if is_connected
>Mon, 23 Oct 2023 22:04:31 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: changed published gateway informations
>Sat, 21 Oct 2023 20:21:31 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: gateway readings changed by gardena
>Thu, 12 Oct 2023 21:52:51 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### test: versions pump
>Tue, 3 Oct 2023 22:40:58 +0200
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### feat: changelog (origin/patch_setExtention, patch_setExtention)
>Thu, 2 Mar 2023 11:58:58 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### feat: add setextention
>Thu, 2 Mar 2023 11:58:29 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### feat: test
>Thu, 2 Mar 2023 11:30:19 +0100
>Author: Sebastian (em@ail.tld)
>Commiter: Sebastian (em@ail.tld)
### docs: add changelog file (tag: v2.6.0, origin/patch-changeVersion)
>Tue, 10 Jan 2023 09:51:23 +0100
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
>Commiter: Marko Oldenburg (fhemdevelopment@cooltux.net)
### docs: change verson numbers
>Tue, 10 Jan 2023 09:50:36 +0100
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
@ -9,7 +280,7 @@ change modul versions
### test: add hooks (origin/patch-changeVersion)
### test: add hooks
>Tue, 10 Jan 2023 09:48:39 +0100
>Author: Marko Oldenburg (fhemdevelopment@cooltux.net)
@ -20,7 +291,7 @@ hooks for commit test and create changelog
### [translaten] - add commandref translation
### [translaten] - add commandref translation (origin/patch-fix_commandref_spell, patch-fix_commandref_spell)
>Sun, 18 Sep 2022 08:52:43 +0200
>Author: Sebastian (em@ail.tld)
@ -40,7 +311,7 @@ hooks for commit test and create changelog
### [enhancement] - commandref
### [enhancement] - commandref (origin/patch-wc_rest_valve_and_additinal_commandref, patch-wc_rest_valve_and_additinal_commandref)
>Tue, 6 Sep 2022 12:32:40 +0200
>Author: Sebastian (em@ail.tld)
@ -90,7 +361,7 @@ hooks for commit test and create changelog
### [fix] - upper/lower case
### [fix] - upper/lower case (origin/patch-offline_status_startup_undefined, patch-offline_status_startup_undefined)
>Thu, 11 Aug 2022 14:25:19 +0200
>Author: Sebastian (em@ail.tld)
@ -380,7 +651,7 @@ hooks for commit test and create changelog
### readd lost setter webinterface
### readd lost setter webinterface (origin/patch-dev_merge_failed_electronic_pressure_pump, patch-dev_merge_failed_electronic_pressure_pump)
>Wed, 13 Jul 2022 20:56:47 +0200
>Author: Sebastian (em@ail.tld)
@ -401,7 +672,7 @@ hooks for commit test and create changelog
### „FHEM/74_GardenaSmartDevice.pm“ ändern
### „FHEM/74_GardenaSmartDevice.pm“ ändern (origin/patch_electronic_pressure_pump_water_pump_name_mistake)
>Tue, 12 Jul 2022 20:09:33 +0200
>Author: Sebastian Schwaz (sebastianschwarz@noreply@cooltux.net)
@ -621,7 +892,7 @@ hooks for commit test and create changelog
### [fix] - setter procedure
### [fix] - setter procedure (origin/patch_pressure_pump_setlist, patch_pressure_pump_setlist)
>Wed, 29 Jun 2022 20:32:00 +0200
>Author: Sebastian (em@ail.tld)
@ -771,7 +1042,7 @@ hooks for commit test and create changelog
### patch lono. eventuell recrusive readings einbauen. waterpump rechtschreibfehler mit fixed
### patch lono. eventuell recrusive readings einbauen. waterpump rechtschreibfehler mit fixed (origin/patch_lona, patch_lona)
>Sat, 25 Jun 2022 12:58:59 +0200
>Author: Sebastian (em@ail.tld)
@ -1151,7 +1422,7 @@ hooks for commit test and create changelog
### lona
### lona (origin/patch_waterpump, patch_waterpump)
>Tue, 17 May 2022 20:53:37 +0200
>Author: Sebastian (em@ail.tld)
@ -1541,7 +1812,7 @@ hooks for commit test and create changelog
### round minutes in irregation
### round minutes in irregation (origin/patch_water_control)
>Tue, 12 Apr 2022 08:40:40 +0200
>Author: Sebastian (em@ail.tld)
@ -1681,7 +1952,7 @@ hooks for commit test and create changelog
### fix state
### fix state (origin/patch_add_sensor2)
>Tue, 5 Apr 2022 09:23:34 +0200
>Author: Sebastian (em@ail.tld)
@ -1711,7 +1982,7 @@ hooks for commit test and create changelog
### fix ic24
### fix ic24 (origin/patch_ic24_schedule)
>Tue, 29 Mar 2022 16:35:58 +0200
>Author: Sebastian (em@ail.tld)

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:
@ -205,6 +205,7 @@ sub Define {
my $hash = shift // return;
my $aArg = shift // return;
return $@ unless ( FHEM::Meta::SetInternals($hash) );
use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' );
@ -221,8 +222,9 @@ sub Define {
$hash->{URL} =
AttrVal( $name, 'gardenaBaseURL', 'https://smart.gardena.com' ) . '/v1';
$hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{INTERVAL} = 60;
$hash->{INTERVAL} = 180;
$hash->{NOTIFYDEV} = "global,$name";
$hash->{helper}{gettoken_count} = 0;
CommandAttr( undef, $name . ' room GardenaSmart' )
if ( AttrVal( $name, 'room', 'none' ) eq 'none' );
@ -264,6 +266,8 @@ sub Attr {
if ( $cmd eq 'set' && $attrVal eq '1' ) {
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getDevices" );
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getToken" );
readingsSingleUpdate( $hash, 'state', 'inactive', 1 );
Log3 $name, 3, "GardenaSmartBridge ($name) - disabled";
}
@ -290,14 +294,14 @@ sub Attr {
if ( $attrVal == 0 );
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getDevices" );
$hash->{INTERVAL} = $attrVal;
$hash->{INTERVAL} = $attrVal if $attrVal >= 180;
Log3 $name, 3,
"GardenaSmartBridge ($name) - set interval: $attrVal";
}
elsif ( $cmd eq 'del' ) {
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getDevices" );
$hash->{INTERVAL} = 60;
$hash->{INTERVAL} = 180;
Log3 $name, 3,
"GardenaSmartBridge ($name) - delete User interval and set default: 60";
}
@ -628,26 +632,33 @@ sub ErrorHandling {
if ( $param->{code} == 400 ) {
if ($decode_json) {
if ( ref( $decode_json->{errors} ) eq "ARRAY"
&& defined( $decode_json->{errors} ) )
&& exists( $decode_json->{errors} ) )
# replace defined with exists
# && defined( $decode_json->{errors} ) )
{
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};
# $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
}
}
else {
@ -684,6 +695,16 @@ sub ErrorHandling {
"GardenaSmartBridge ($dname) - RequestERROR: check the ???";
}
elsif ( $decode_json->{errors}[0]{code} eq "ratelimit.exceeded" ) {
Log3 $name, 5,
"GardenaSmartBridge ($name) - RequestERROR: error ratelimit.exceeded";
readingsBulkUpdate( $hash, "lastRequestState", "too many requests", 1 );
readingsBulkUpdate( $hash, "state", "inactive", 1 );
# remove all timer and disable bridge
RemoveInternalTimer( $hash );
return; # post request max.
}
else {
Log3 $dname, 5,
@ -693,8 +714,18 @@ sub ErrorHandling {
if ( !defined( $hash->{helper}{session_id} ) ) {
readingsSingleUpdate( $hash, 'token', 'none', 1 );
InternalTimer( gettimeofday() + 5,
"FHEM::GardenaSmartBridge::getToken", $hash );
Log3 $name, 3,
"GardenaSmartBridge ($name) - getToken limit: "
. $hash->{helper}{gettoken_count} ;
if ($hash->{helper}{gettoken_count} < 6) {
$hash->{helper}{gettoken_count}++;
InternalTimer( gettimeofday() + 5,
"FHEM::GardenaSmartBridge::getToken", $hash )
} else {
RemoveInternalTimer ($hash);
$hash->{helper}{gettoken_count} = 0;
}
}
readingsEndUpdate( $dhash, 1 );
@ -1053,6 +1084,20 @@ 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]
{name} !~ /ethernet_status|wifi_status/ );
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]
{name} !~ /ethernet_status|wifi_status/ );
readingsBulkUpdateIfChanged(
$hash,
$decode_json->{abilities}[0]{properties}[$properties]
@ -1071,35 +1116,21 @@ sub WriteReadings {
&& ref($v) eq 'HASH'
)
{
if ( $decode_json->{abilities}[0]{properties}
[$properties]{name} eq 'ethernet_status' )
{
readingsBulkUpdateIfChanged( $hash,
'ethernet_status-mac', $v->{mac} );
readingsBulkUpdateIfChanged( $hash,
'ethernet_status-ip', $v->{ip} )
if ( ref( $v->{ip} ) ne 'HASH' );
readingsBulkUpdateIfChanged( $hash,
'ethernet_status-isconnected',
$v->{isConnected} );
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} );
}
elsif ( $decode_json->{abilities}[0]{properties}
[$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} );
}
}
} # fi ethernet and wifi
}
$properties--;
@ -1169,21 +1200,21 @@ sub getToken {
Write(
$hash,
'"data": {"type":"token", "attributes":{"username": "'
'"data":{"type":"token","attributes":{"username":"'
. AttrVal( $name, 'gardenaAccountEmail', 'none' )
. '","password": "'
. '","password":"'
. ReadPassword( $hash, $name )
. '", "client_id":"smartgarden-jwt-client"}}',
. '","client_id":"smartgarden-jwt-client"}}',
undef,
undef
);
Log3 $name, 4,
'"data": {"type":"token", "attributes":{"username": "'
'"data": {"type":"token", "attributes":{"username":"'
. AttrVal( $name, 'gardenaAccountEmail', 'none' )
. '","password": "'
. '","password":"'
. ReadPassword( $hash, $name )
. '", "client_id":"smartgarden-jwt-client"}}';
. '","client_id":"smartgarden-jwt-client"}}';
Log3 $name, 3,
"GardenaSmartBridge ($name) - send credentials to fetch Token and locationId";
@ -1282,7 +1313,10 @@ sub createHttpValueStrings {
my ( $hash, $payload, $deviceId, $abilities, $service_id ) = @_;
my $session_id = $hash->{helper}{session_id};
my $header = "Content-Type: application/json";
my $header = 'Content-Type: application/json';
$header .= "\r\norigin: https://smart.gardena.com";
$header .= "\r\nuser-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36";
#my $header = "Content-Type: application/json; origin: https://smart.gardena.com";
my $uri = '';
my $method = 'POST';
$header .= "\r\nAuthorization: Bearer $session_id"
@ -1329,17 +1363,16 @@ sub createHttpValueStrings {
} # park until next schedules or override
elsif (defined($abilities)
&& defined($payload)
&& $abilities eq 'mower_timer' )
&& $abilities eq 'mower' )
{
my $valve_id;
$method = 'PUT';
$uri .=
'/devices/'
. $deviceId
. '/abilities/'
. $abilities
. '/properties/mower_timer';
. '/commands/manual_start';
}
elsif (defined($abilities)
@ -1490,7 +1523,7 @@ sub DeletePassword {
<ul>
<li>debugJSON - </li>
<li>disable - Disables the Bridge</li>
<li>interval - Interval in seconds (Default=60)</li>
<li>interval - Interval in seconds (Default=180)</li>
<li>gardenaAccountEmail - Email Adresse which was used in the GardenaAPP</li>
</ul>
</ul>
@ -1551,7 +1584,7 @@ sub DeletePassword {
<ul>
<li>debugJSON - JSON Fehlermeldungen</li>
<li>disable - Schaltet die Datenübertragung der Bridge ab</li>
<li>interval - Abfrageinterval in Sekunden (default: 60)</li>
<li>interval - Abfrageinterval in Sekunden (default: 180)</li>
<li>gardenaAccountEmail - Email Adresse, die auch in der GardenaApp verwendet wurde</li>
</ul>
</ul>
@ -1575,7 +1608,7 @@ sub DeletePassword {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v2.6.0",
"version": "v2.6.3",
"author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
],

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:
@ -67,6 +67,8 @@ use Time::Local;
use Time::Piece;
use Time::Seconds;
use SetExtensions;
# try to use JSON::MaybeXS wrapper
# for chance of better performance + open code
eval {
@ -142,7 +144,8 @@ BEGIN {
modules
IOWrite
defs
makeDeviceName)
makeDeviceName
SetExtensions)
);
}
@ -321,8 +324,9 @@ sub Set {
elsif ( lc $cmd eq 'parkuntilnexttimer' ) {
$payload = '"name":"park_until_next_timer"';
if ( $mainboard_version > 10.30 ) {
$payload = '"properties":{"name":"mower_timer","value":0}';
$abilities = 'mower_timer';
$payload =
'"mowerTimer":0,"startingPointDistance":null,"areaId":null';
$abilities = 'mower';
}
}
elsif ( lc $cmd eq 'startresumeschedule' ) {
@ -336,13 +340,15 @@ sub Set {
}
}
elsif ( lc $cmd eq 'startoverridetimer' ) {
$payload = '"name":"start_override_timer","parameters":{"duration":'
. $aArg->[0] * 60 . '}';
if ( $mainboard_version > 10.30 ) {
$payload = '"properties":{"name":"mower_timer","value":'
. $aArg->[0] * 60 . '}';
$abilities = 'mower_timer';
}
# $payload = '"name":"start_override_timer","parameters":{"duration":'
# . $aArg->[0] * 60 . '}';
# if ( $mainboard_version > 10.30 ) {
$payload = '"startingPointDistance":null,"areaId":null, "mowerTimer": '
. $aArg->[0] * 60;
$abilities = 'mower';
# } removed code < 10.30 api changes March 2024
}
elsif ( lc $cmd eq 'startpoint' ) {
@ -561,6 +567,7 @@ sub Set {
$abilities = 'winter_settings';
$service_id = $hash->{helper}->{'winter_mode_id'};
}
else {
my $list = '';
@ -613,7 +620,9 @@ sub Set {
# all devices has abilitie to fall a sleep
$list .= ' winter_mode:awake,hibernate';
return "Unknown argument $cmd, choose one of $list";
return SetExtensions( $hash, $list, $name, $cmd, @$aArg );
# return "Unknown argument $cmd, choose one of $list";
}
$hash->{helper}{deviceAction} = $payload;
@ -729,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} . '-'
@ -748,7 +758,10 @@ sub WriteReadings {
. $propertie->{name} ne 'ic24-valves_connected'
&& $decode_json->{abilities}[$abilities]{name} . '-'
. $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(
$hash,
@ -845,7 +858,30 @@ sub WriteReadings {
}
}
# ic24 and other watering devices calc irrigation left in sec
# 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
readingsBulkUpdateIfChanged(
$hash,
$decode_json->{abilities}[$abilities]{name} . '-'
@ -901,15 +937,15 @@ sub WriteReadings {
foreach my $dev_schedules ( sort keys %{ $hash->{READINGS} } ) {
my $dev_reading = ReadingsVal( $name, $dev_schedules, "error" );
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
if $dev_schedules =~
/schedule.*_(\d)_id/; # push readigs d from x_id
/schedule.*_(\d+)_id/; # push readigs d from x_id
Log3 $name, 5,
"[DEBUG] $name - Schedule - Key ist : $dev_schedules ";
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);
@ -945,15 +981,13 @@ sub WriteReadings {
&& scalar(@soll) != scalar( @ist / 2 ) )
{
while ( my $old_schedule_id = shift(@ist) ) {
if ( length($old_schedule_id) == 1 ) {
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.*"
"[DEBUG] - $name : deletereading scheduling-schedules_event_${old_schedule_id}_.*"
if length($old_schedule_id) == 1;
}
}
@ -987,7 +1021,7 @@ sub WriteReadings {
}
; # fi scheduled_events
my $winter_mode;
my $winter_mode = 'awake';
do {
#Log3 $name, 1, "Settings pro Device : ".$decode_json->{settings}[$settings]{name};
@ -1683,7 +1717,7 @@ sub SetPredefinedStartPoints {
pump. Schedules can be disabled/enabled via fhem, defining or deleting them must be done via Gardena App or its web interface.<br>
</ul>
<br>
<div style="display: none">
<div>
<a id="GardenaSmartDevice-set"></a>
<li><a id="GardenaSmartDevice-set-parkUntilFurtherNotice">parkUntilFurtherNotice</a> - park mower and disable schedule</li>
<li><a id="GardenaSmartDevice-set-parkUntilNextTimer">parkUntilNextTimer</a> - park mower until next schedule</li>
@ -2149,7 +2183,7 @@ sub SetPredefinedStartPoints {
Steckdosen-Adapter und Pumpe. Zeitpl&auml;ne k&ouml;nnen &uuml;ber fhem pausiert/aktiviert werden, das Anlegen oder L&ouml;schen erfolgt
derzeit nur &uuml;ber die App oder deren Web-Frontend.
</ul>
<div style="display: none">
<div>
<a id="GardenaSmartDevice-set"></a>
<li><a id="GardenaSmartDevice-set-parkUntilFurtherNotice">parkUntilFurtherNotice</a> - Parken des M&auml;hers und Aussetzen des Zeitplans</li>
<li><a id="GardenaSmartDevice-set-parkUntilNextTimer">parkUntilNextTimer</a> - Parken bis zum n&auml;chsten Start nach Zeitplan</li>
@ -2678,7 +2712,7 @@ sub SetPredefinedStartPoints {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v2.6.0",
"version": "v2.6.3",
"author": [
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
],

View File

@ -1,2 +1,2 @@
UPD 2023-01-10_09:49:28 49646 FHEM/73_GardenaSmartBridge.pm
UPD 2023-01-10_09:49:45 126305 FHEM/74_GardenaSmartDevice.pm
UPD 2024-05-22_18:46:22 51262 FHEM/73_GardenaSmartBridge.pm
UPD 2024-05-21_09:01:54 127762 FHEM/74_GardenaSmartDevice.pm