add power plugin support
This commit is contained in:
parent
76559ab230
commit
8acadea5bf
@ -383,6 +383,8 @@ sub Write($@) {
|
||||
|
||||
Log3 $name, 4,
|
||||
"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method";
|
||||
# Log3 $name, 3,
|
||||
# "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method";
|
||||
}
|
||||
|
||||
sub ErrorHandling($$$) {
|
||||
@ -979,6 +981,21 @@ sub createHttpValueStrings($@) {
|
||||
. '/properties/watering_timer_'
|
||||
. $valve_id;
|
||||
|
||||
}
|
||||
elsif ( defined($abilities)
|
||||
and defined($payload)
|
||||
and $abilities eq 'power' )
|
||||
{
|
||||
my $valve_id;
|
||||
$method = 'PUT';
|
||||
|
||||
$uri .=
|
||||
'/devices/'
|
||||
. $deviceId
|
||||
. '/abilities/'
|
||||
. $abilities
|
||||
. '/properties/power_timer';
|
||||
|
||||
}
|
||||
else {
|
||||
$uri .=
|
||||
|
@ -238,7 +238,7 @@ sub Set($@) {
|
||||
SetPredefinedStartPoints( $hash, @args );
|
||||
return $err if ( defined($err) );
|
||||
|
||||
### watering_computer
|
||||
### watering_computer
|
||||
}
|
||||
elsif ( lc $cmd eq 'manualoverride' ) {
|
||||
|
||||
@ -251,20 +251,15 @@ sub Set($@) {
|
||||
|
||||
$payload = '"name":"cancel_override"';
|
||||
|
||||
### Watering ic24
|
||||
|
||||
}
|
||||
elsif ( lc $cmd eq 'on' or lc $cmd eq 'off' or lc $cmd eq 'on-for-timer' ) {
|
||||
|
||||
my $duration = join( " ", @args );
|
||||
if ( lc $cmd eq 'on-for-timer' ) {
|
||||
$payload = '"name":"power_timer","parameters":{"duration":'
|
||||
. $duration . '}';
|
||||
}
|
||||
else { $payload = '"name":"power_timer","parameters":{"duration":'
|
||||
. lc $cmd . '}';
|
||||
}
|
||||
my $val = ( defined($args[0]) ? join( " ", @args ) : lc $cmd );
|
||||
$payload =
|
||||
'"properties":{"value":"' . $val . '"}';
|
||||
}
|
||||
|
||||
### Watering ic24
|
||||
elsif ( $cmd =~ /manualDurationValve/ ) {
|
||||
|
||||
my $valve_id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user