mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
74_GardenaSmart: code change
git-svn-id: https://svn.fhem.de/fhem/trunk@21829 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
77d9141f56
commit
7b934945e8
@ -1,5 +1,6 @@
|
||||
# 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.
|
||||
- change: 74_GardenaSmart: code change
|
||||
- bugfix: 77_UWZ: fix Undefined subroutine &main::encode_utf8
|
||||
- change: 14_CUL_MAX: new Version, Forum #625108
|
||||
- change: 10_MAX: new Version, Forum #625108
|
||||
|
@ -215,21 +215,21 @@ sub Initialize {
|
||||
}
|
||||
|
||||
sub Define {
|
||||
my $hash = shift;
|
||||
my $a = shift;
|
||||
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' );
|
||||
|
||||
return 'too few parameters: define <NAME> GardenaSmartBridge'
|
||||
if ( scalar( @{$a} ) != 2 );
|
||||
if ( scalar( @{$aArg} ) != 2 );
|
||||
return
|
||||
'Cannot define Gardena Bridge device. Perl modul '
|
||||
. ${missingModul}
|
||||
. ' is missing.'
|
||||
if ($missingModul);
|
||||
|
||||
my $name = shift @$a;
|
||||
my $name = shift @$aArg;
|
||||
$hash->{BRIDGE} = 1;
|
||||
$hash->{URL} =
|
||||
AttrVal( $name, 'gardenaBaseURL',
|
||||
@ -329,8 +329,8 @@ sub Attr {
|
||||
}
|
||||
|
||||
sub Notify {
|
||||
my $hash = shift;
|
||||
my $dev = shift;
|
||||
my $hash = shift // return;
|
||||
my $dev = shift // return;
|
||||
|
||||
my $name = $hash->{NAME};
|
||||
return if ( IsDisabled($name) );
|
||||
@ -396,11 +396,13 @@ sub Notify {
|
||||
}
|
||||
|
||||
sub Set {
|
||||
my $hash = shift;
|
||||
my $a = shift;
|
||||
my $hash = shift // return;
|
||||
my $aArg = shift // return;
|
||||
|
||||
my $name = shift @$a;
|
||||
my $cmd = shift @$a // return qq{"set $name" needs at least one argument};
|
||||
my $name = shift @$aArg // return;
|
||||
my $cmd = shift @$aArg // return qq{"set $name" needs at least one argument};
|
||||
|
||||
# Das Argument für das Passwort, also das Passwort an sich darf keine = enthalten!!!
|
||||
|
||||
if ( lc $cmd eq 'getdevicesstate' ) {
|
||||
getDevices($hash);
|
||||
@ -419,12 +421,12 @@ sub Set {
|
||||
elsif ( lc $cmd eq 'gardenaaccountpassword' ) {
|
||||
return "please set Attribut gardenaAccountEmail first"
|
||||
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) eq 'none' );
|
||||
return "usage: $cmd <password>" if ( scalar( @{$a} ) != 1 );
|
||||
return "usage: $cmd <password>" if ( scalar( @{$aArg} ) != 1 );
|
||||
|
||||
StorePassword( $hash, $name, $a->[0] );
|
||||
StorePassword( $hash, $name, $aArg->[0] );
|
||||
}
|
||||
elsif ( lc $cmd eq 'deleteaccountpassword' ) {
|
||||
return "usage: $cmd" if ( scalar( @{$a} ) != 0 );
|
||||
return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 );
|
||||
|
||||
DeletePassword($hash);
|
||||
}
|
||||
@ -1375,7 +1377,7 @@ sub DeletePassword {
|
||||
],
|
||||
"release_status": "stable",
|
||||
"license": "GPL_2",
|
||||
"version": "v2.0.1",
|
||||
"version": "v2.0.2",
|
||||
"author": [
|
||||
"Marko Oldenburg <leongaultier@gmail.com>"
|
||||
],
|
||||
|
@ -187,19 +187,19 @@ sub Initialize {
|
||||
}
|
||||
|
||||
sub Define {
|
||||
my $hash = shift;
|
||||
my $a = shift;
|
||||
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' );
|
||||
|
||||
return
|
||||
"too few parameters: define <NAME> GardenaSmartDevice <device_Id> <model>"
|
||||
if ( scalar( @{$a} ) < 3 );
|
||||
if ( scalar( @{$aArg} ) < 3 );
|
||||
|
||||
my $name = $a->[0];
|
||||
my $deviceId = $a->[2];
|
||||
my $category = $a->[3];
|
||||
my $name = $aArg->[0];
|
||||
my $deviceId = $aArg->[2];
|
||||
my $category = $aArg->[3];
|
||||
|
||||
$hash->{DEVICEID} = $deviceId;
|
||||
$hash->{VERSION} = version->parse($VERSION)->normal;
|
||||
@ -267,11 +267,11 @@ sub Attr {
|
||||
}
|
||||
|
||||
sub Set {
|
||||
my $hash = shift;
|
||||
my $a = shift;
|
||||
my $hash = shift // return;
|
||||
my $aArg = shift // return;
|
||||
|
||||
my $name = shift @$a;
|
||||
my $cmd = shift @$a // return qq{"set $name" needs at least one argument};
|
||||
my $name = shift @$aArg;
|
||||
my $cmd = shift @$aArg // return qq{"set $name" needs at least one argument};
|
||||
|
||||
my $payload;
|
||||
my $abilities = '';
|
||||
@ -290,13 +290,13 @@ sub Set {
|
||||
}
|
||||
elsif ( lc $cmd eq 'startoverridetimer' ) {
|
||||
$payload = '"name":"start_override_timer","parameters":{"duration":'
|
||||
. $a->[0] * 60 . '}';
|
||||
. $aArg->[0] * 60 . '}';
|
||||
|
||||
}
|
||||
elsif ( lc $cmd eq 'startpoint' ) {
|
||||
my $err;
|
||||
|
||||
( $err, $payload, $abilities ) = SetPredefinedStartPoints( $hash, @$a );
|
||||
( $err, $payload, $abilities ) = SetPredefinedStartPoints( $hash, @$aArg );
|
||||
return $err if ( defined($err) );
|
||||
|
||||
}
|
||||
@ -304,14 +304,14 @@ sub Set {
|
||||
elsif ( lc $cmd eq 'pumptimer' ) {
|
||||
$payload =
|
||||
'"name":"pump_manual_watering_timer","parameters":{"duration":'
|
||||
. $a->[0] . '}';
|
||||
. $aArg->[0] . '}';
|
||||
}
|
||||
### watering_computer
|
||||
elsif ( lc $cmd eq 'manualoverride' ) {
|
||||
$payload =
|
||||
'"properties":{"name":"watering_timer_1'
|
||||
. '","value":{"state":"manual","duration":'
|
||||
. $a->[0] * 60
|
||||
. $aArg->[0] * 60
|
||||
. ',"valve_id":1}}';
|
||||
}
|
||||
elsif ( $cmd =~ m{\AcancelOverride}xms ) {
|
||||
@ -332,8 +332,8 @@ sub Set {
|
||||
}
|
||||
elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) {
|
||||
my $val = (
|
||||
defined($a) && ref($a) eq 'ARRAY'
|
||||
? $a->[0] * 60
|
||||
defined($aArg) && ref($aArg) eq 'ARRAY'
|
||||
? $aArg->[0] * 60
|
||||
: lc $cmd
|
||||
);
|
||||
|
||||
@ -351,14 +351,14 @@ sub Set {
|
||||
'"properties":{"name":"watering_timer_'
|
||||
. $valve_id
|
||||
. '","value":{"state":"manual","duration":'
|
||||
. $a->[0] * 60
|
||||
. $aArg->[0] * 60
|
||||
. ',"valve_id":'
|
||||
. $valve_id . '}}';
|
||||
}
|
||||
### Sensors
|
||||
elsif ( lc $cmd eq 'refresh' ) {
|
||||
|
||||
my $sensname = $a->[0];
|
||||
my $sensname = $aArg->[0];
|
||||
if ( lc $sensname eq 'temperature' ) {
|
||||
$payload = '"name":"measure_ambient_temperature"';
|
||||
$abilities = 'ambient_temperature';
|
||||
@ -1212,7 +1212,7 @@ sub SetPredefinedStartPoints {
|
||||
],
|
||||
"release_status": "stable",
|
||||
"license": "GPL_2",
|
||||
"version": "v2.0.2",
|
||||
"version": "v2.0.3",
|
||||
"author": [
|
||||
"Marko Oldenburg <leongaultier@gmail.com>"
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user