add support for Irrigation Control
This commit is contained in:
parent
71cb6affea
commit
d487d65603
@ -68,7 +68,7 @@ eval "use JSON;1" or $missingModul .= "JSON ";
|
||||
eval "use IO::Socket::SSL;1" or $missingModul .= "IO::Socket::SSL ";
|
||||
|
||||
|
||||
my $version = "1.0.4";
|
||||
my $version = "1.2.0";
|
||||
|
||||
|
||||
|
||||
@ -83,8 +83,8 @@ sub GardenaSmartBridge_Undef($$);
|
||||
sub GardenaSmartBridge_Delete($$);
|
||||
sub GardenaSmartBridge_ResponseProcessing($$);
|
||||
sub GardenaSmartBridge_ErrorHandling($$$);
|
||||
sub GardenaSmartBridge_encrypt($);
|
||||
sub GardenaSmartBridge_decrypt($);
|
||||
#sub GardenaSmartBridge_encrypt($);
|
||||
#sub GardenaSmartBridge_decrypt($);
|
||||
sub GardenaSmartBridge_WriteReadings($$);
|
||||
sub GardenaSmartBridge_ParseJSON($$);
|
||||
sub GardenaSmartBridge_getDevices($);
|
||||
@ -782,14 +782,23 @@ sub GardenaSmartBridge_createHttpValueStrings($@) {
|
||||
$uri .= '/sessions' if( not defined($hash->{helper}{session_id}));
|
||||
|
||||
if( defined($hash->{helper}{locations_id}) ) {
|
||||
#$uri .= '/devices/' . $deviceId . '/abilities/' . $abilities . '/command' if( defined($abilities) and defined($payload) );
|
||||
if ( defined($abilities) and $abilities eq 'mower_settings') {
|
||||
|
||||
$method = 'PUT';
|
||||
my $dhash = $modules{GardenaSmartDevice}{defptr}{$deviceId};
|
||||
$uri .= '/devices/' . $deviceId . '/settings/' . $dhash->{helper}{STARTINGPOINTID} if( defined($abilities) and defined($payload) and $abilities eq 'mower_settings');
|
||||
|
||||
} elsif( defined($abilities) and defined($payload) and $abilities eq 'watering') {
|
||||
my $valve_id;
|
||||
$method = 'PUT';
|
||||
|
||||
if( $payload =~ m#watering_timer_(\d)# ) {
|
||||
$valve_id = $1;
|
||||
}
|
||||
$uri .= '/devices/' . $deviceId . '/abilities/' . $abilities . '/properties/watering_timer_' . $valve_id;
|
||||
|
||||
} else {
|
||||
$uri .= '/devices/' . $deviceId . '/abilities/' . $abilities . '/command' if( defined($abilities) and defined($payload) and $abilities ne 'mower_settings');
|
||||
$uri .= '/devices/' . $deviceId . '/abilities/' . $abilities . '/command' if( defined($abilities) and defined($payload) );
|
||||
}
|
||||
|
||||
$uri .= '?locationId=' . $hash->{helper}{locations_id};
|
||||
|
@ -66,7 +66,7 @@ use Time::Local;
|
||||
eval "use JSON;1" or $missingModul .= "JSON ";
|
||||
|
||||
|
||||
my $version = "1.0.4";
|
||||
my $version = "1.2.0";
|
||||
|
||||
|
||||
|
||||
@ -228,10 +228,16 @@ sub GardenaSmartDevice_Set($@) {
|
||||
$payload = '"name":"cancel_override"';
|
||||
|
||||
### Watering ic24
|
||||
} elsif( lc $cmd eq 'wateringtimertalve1' ) {
|
||||
} elsif( $cmd =~ /manualDurationValve/ ) {
|
||||
|
||||
my $valve_id;
|
||||
my $duration = join( " ", @args );
|
||||
$payload = '"name":"watering_timer_valve_1","parameters":{"duration":' . $duration . '}';
|
||||
|
||||
if( $cmd =~ m#(\d)$# ) {
|
||||
$valve_id = $1;
|
||||
}
|
||||
|
||||
$payload = '"properties":{"name":"watering_timer_' . $valve_id . '","value":{"state":"manual","duration":' . $duration . ',"valve_id":' . $valve_id . '}}';
|
||||
|
||||
### Sensors
|
||||
} elsif( lc $cmd eq 'refresh' ) {
|
||||
@ -255,7 +261,7 @@ sub GardenaSmartDevice_Set($@) {
|
||||
my $list = '';
|
||||
$list .= 'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,60,1440 startpoint' if( AttrVal($name,'model','unknown') eq 'mower' );
|
||||
$list .= 'manualOverride:slider,0,1,59 cancelOverride:noArg' if( AttrVal($name,'model','unknown') eq 'watering_computer' );
|
||||
$list .= 'wateringTimerValve1:slider,0,1,59' if( AttrVal($name,'model','unknown') eq 'ic24' );
|
||||
$list .= 'manualDurationValve1:slider,0,1,59 manualDurationValve2:slider,0,1,59 manualDurationValve3:slider,0,1,59 manualDurationValve4:slider,0,1,59 manualDurationValve5:slider,0,1,59 manualDurationValve6:slider,0,1,59' if( AttrVal($name,'model','unknown') eq 'ic24' );
|
||||
$list .= 'refresh:temperature,light,humidity' if( AttrVal($name,'model','unknown') eq 'sensor' );
|
||||
|
||||
return "Unknown argument $cmd, choose one of $list";
|
||||
@ -388,6 +394,8 @@ sub GardenaSmartDevice_WriteReadings($$) {
|
||||
|
||||
readingsBulkUpdate($hash,'state','T: ' . ReadingsVal($name,'ambient_temperature-temperature','readingsValError') . '°C, H: ' . ReadingsVal($name,'humidity-humidity','readingsValError') . '%, L: ' . ReadingsVal($name,'light-light','readingsValError') . 'lux') if( AttrVal($name,'model','unknown') eq 'sensor' );
|
||||
|
||||
readingsBulkUpdate($hash,'state','scheduled watering next start: ' . (ReadingsVal($name,'scheduling-scheduled_watering_next_start','readingsValError'))) if( AttrVal($name,'model','unknown') eq 'ic24' );
|
||||
|
||||
readingsEndUpdate( $hash, 1 );
|
||||
|
||||
Log3 $name, 4, "GardenaSmartDevice ($name) - readings was written}";
|
||||
|
Loading…
x
Reference in New Issue
Block a user