Merge pull request 'patch-watercontrol_schedule' (#32) from patch-watercontrol_schedule into devel
Reviewed-on: #32 Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
This commit is contained in:
commit
5fb14e80a8
@ -731,6 +731,18 @@ sub ErrorHandling {
|
|||||||
$output .= "value: $dev_settings->{value} \n";
|
$output .= "value: $dev_settings->{value} \n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$output .= '\n=== Abilities \n';
|
||||||
|
my $i = 0;
|
||||||
|
for my $dev_settings ( @ { $devJson->{abilities} } ) {
|
||||||
|
$output .= "[".$i++."]id: $dev_settings->{id} \n";
|
||||||
|
$output .= "name: $dev_settings->{name} ";
|
||||||
|
if (ref ($dev_settings->{value}) eq 'ARRAY'
|
||||||
|
|| ref ($dev_settings->{value}) eq 'HASH'){
|
||||||
|
$output .= 'N/A \n';
|
||||||
|
} else {
|
||||||
|
$output .= "value: $dev_settings->{value} \n";
|
||||||
|
}
|
||||||
|
}
|
||||||
$hash->{helper}{debug_device_output} = $output;
|
$hash->{helper}{debug_device_output} = $output;
|
||||||
asyncOutput($param->{cl}, $hash->{helper}{debug_device_output});
|
asyncOutput($param->{cl}, $hash->{helper}{debug_device_output});
|
||||||
return;
|
return;
|
||||||
@ -1215,7 +1227,6 @@ sub createHttpValueStrings {
|
|||||||
|
|
||||||
$uri = '/devices/'.InternalVal($hash->{helper}{debug_device}, 'DEVICEID', 0 ) if ( exists ($hash->{helper}{debug_device}));
|
$uri = '/devices/'.InternalVal($hash->{helper}{debug_device}, 'DEVICEID', 0 ) if ( exists ($hash->{helper}{debug_device}));
|
||||||
$uri = '/auth/token' if ( !defined( $hash->{helper}{session_id} ) );
|
$uri = '/auth/token' if ( !defined( $hash->{helper}{session_id} ) );
|
||||||
|
|
||||||
if ( defined( $hash->{helper}{locations_id} ) ) {
|
if ( defined( $hash->{helper}{locations_id} ) ) {
|
||||||
if ( defined($abilities) && $abilities =~ /.*_settings/ ) {
|
if ( defined($abilities) && $abilities =~ /.*_settings/ ) {
|
||||||
|
|
||||||
@ -1279,6 +1290,19 @@ sub createHttpValueStrings {
|
|||||||
. $abilities
|
. $abilities
|
||||||
. '/properties/manual_watering_timer';
|
. '/properties/manual_watering_timer';
|
||||||
|
|
||||||
|
}
|
||||||
|
elsif (defined($abilities)
|
||||||
|
&& defined($payload)
|
||||||
|
&& $abilities eq 'watering_button_config' )
|
||||||
|
{
|
||||||
|
$method = 'PUT';
|
||||||
|
|
||||||
|
$uri .=
|
||||||
|
'/devices/'
|
||||||
|
. $deviceId
|
||||||
|
. '/abilities/watering'
|
||||||
|
. '/properties/button_config_time';
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif (defined($abilities)
|
elsif (defined($abilities)
|
||||||
&& defined($payload)
|
&& defined($payload)
|
||||||
@ -1463,7 +1487,7 @@ sub DeletePassword {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v2.4.0",
|
"version": "v2.4.1",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <leongaultier@gmail.com>"
|
"Marko Oldenburg <leongaultier@gmail.com>"
|
||||||
],
|
],
|
||||||
|
@ -361,6 +361,18 @@ sub Set {
|
|||||||
. $aArg->[0] * 60
|
. $aArg->[0] * 60
|
||||||
. ',"valve_id":1}}';
|
. ',"valve_id":1}}';
|
||||||
}
|
}
|
||||||
|
elsif ( lc $cmd eq 'manualbuttontime'){
|
||||||
|
$service_id = $hash->{helper}{button_config_time_id};
|
||||||
|
$payload=
|
||||||
|
'"properties":{"name":"button_config_time",'
|
||||||
|
.'"value":'
|
||||||
|
. $aArg->[0] * 60
|
||||||
|
. ',"timestamp":"2021-05-26T19:06:23.680Z"'
|
||||||
|
. ',"at_bound":null,"unit":"seconds","ability":"'
|
||||||
|
. $service_id
|
||||||
|
.'"}';
|
||||||
|
$abilities = 'watering_button_config';
|
||||||
|
}
|
||||||
elsif ( $cmd =~ m{\AcancelOverride}xms ) {
|
elsif ( $cmd =~ m{\AcancelOverride}xms ) {
|
||||||
|
|
||||||
my $valve_id = 1;
|
my $valve_id = 1;
|
||||||
@ -377,6 +389,18 @@ sub Set {
|
|||||||
. ',"valve_id":'
|
. ',"valve_id":'
|
||||||
. $valve_id . '}}';
|
. $valve_id . '}}';
|
||||||
}
|
}
|
||||||
|
elsif ( $cmd =~ /.*Schedule/ ){
|
||||||
|
my $duration = (( defined($aArg->[0]) ? ( ((Time::Piece->new)+(ONE_HOUR * $aArg->[0]) - (Time::Piece->new)->tzoffset )->datetime ).'.000Z' : '2040-12-31T22:00:00.000Z'));
|
||||||
|
|
||||||
|
$abilities = 'wateringcomputer_settings';
|
||||||
|
$service_id = $hash->{helper}->{'schedules_paused_until_id'};
|
||||||
|
$payload = '"settings":{"name":"schedules_paused_until"'
|
||||||
|
. ', "value":"'
|
||||||
|
. ($cmd eq 'resumeSchedule' ? '' : $duration )
|
||||||
|
. '","device":"'
|
||||||
|
. $hash->{DEVICEID}
|
||||||
|
. '"}';
|
||||||
|
}
|
||||||
elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) {
|
elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) {
|
||||||
my $val = (
|
my $val = (
|
||||||
defined($aArg) && ref($aArg) eq 'ARRAY'
|
defined($aArg) && ref($aArg) eq 'ARRAY'
|
||||||
@ -452,7 +476,7 @@ sub Set {
|
|||||||
'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,240 startpoint'
|
'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,240 startpoint'
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' );
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' );
|
||||||
|
|
||||||
$list .= 'manualOverride:slider,1,1,59 cancelOverride:noArg'
|
$list .= 'manualOverride:slider,1,1,59 cancelOverride:noArg resumeSchedule:noArg stopSchedule manualButtonTime:slider,0,2,100'
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
||||||
|
|
||||||
$list .=
|
$list .=
|
||||||
@ -547,6 +571,27 @@ sub WriteReadings {
|
|||||||
for my $propertie (
|
for my $propertie (
|
||||||
@{ $decode_json->{abilities}[$abilities]{properties} } )
|
@{ $decode_json->{abilities}[$abilities]{properties} } )
|
||||||
{
|
{
|
||||||
|
if ( exists($decode_json->{abilities}[$abilities]{name})
|
||||||
|
&& (
|
||||||
|
$decode_json->{abilities}[$abilities]{name} eq 'watering' )
|
||||||
|
) {
|
||||||
|
if ( $propertie->{name} eq 'button_config_time' )
|
||||||
|
{
|
||||||
|
if ( $hash->{helper}{$propertie->{name}.'_id'} ne
|
||||||
|
$decode_json->{abilities}[$abilities]{id} )
|
||||||
|
{
|
||||||
|
$hash->{helper}{$propertie->{name}.'_id'} =
|
||||||
|
$decode_json->{abilities}[$abilities]{id};
|
||||||
|
}
|
||||||
|
readingsBulkUpdateIfChanged(
|
||||||
|
$hash,
|
||||||
|
'manualButtonTime',
|
||||||
|
(RigReadingsValue( $hash, $propertie->{value} / 60) )
|
||||||
|
);
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
readingsBulkUpdateIfChanged(
|
readingsBulkUpdateIfChanged(
|
||||||
$hash,
|
$hash,
|
||||||
$decode_json->{abilities}[$abilities]{name} . '-'
|
$decode_json->{abilities}[$abilities]{name} . '-'
|
||||||
@ -1125,6 +1170,7 @@ sub SetPredefinedStartPoints {
|
|||||||
<a name="GardenaSmartDeviceset"></a>
|
<a name="GardenaSmartDeviceset"></a>
|
||||||
<b>set</b>
|
<b>set</b>
|
||||||
<ul>
|
<ul>
|
||||||
|
<h3>mower</h3>
|
||||||
<li>parkUntilFurtherNotice</li>
|
<li>parkUntilFurtherNotice</li>
|
||||||
<li>parkUntilNextTimer</li>
|
<li>parkUntilNextTimer</li>
|
||||||
<li>startOverrideTimer - (in minutes, 60 = 1h, 1440 = 24h, 4320 = 72h)</li>
|
<li>startOverrideTimer - (in minutes, 60 = 1h, 1440 = 24h, 4320 = 72h)</li>
|
||||||
@ -1134,10 +1180,14 @@ sub SetPredefinedStartPoints {
|
|||||||
<li>set NAME startpoint enable 1</li>
|
<li>set NAME startpoint enable 1</li>
|
||||||
<li>set NAME startpoint disable 3 enable 1</li>
|
<li>set NAME startpoint disable 3 enable 1</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h3>irrigation control</h3>
|
||||||
<li>resumeScheduleValve - start schedule irrigation on valve n</li>
|
<li>resumeScheduleValve - start schedule irrigation on valve n</li>
|
||||||
<li>stopScheduleValve - stop schedule irrigation on valve n (Default: 2040-12-31T22:00:00.000Z) | optional params hours (now + hours)</li>
|
<li>stopScheduleValve - stop schedule irrigation on valve n (Default: 2040-12-31T22:00:00.000Z) | optional params hours (now + hours)</li>
|
||||||
<li>closeAllValves - close all valves</li>
|
<li>closeAllValves - close all valves</li>
|
||||||
|
<h3>water control</h3>
|
||||||
|
<li>manualButtonTime - set manual time for button press (in minutes) 0 disable button</li>
|
||||||
|
<li>stopSchedule - stop schedule for now + n hours (Default: 2040-12-31T22:00:00.000Z)</li>
|
||||||
|
<li>resumeSchedule - resume schedule</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -1273,6 +1323,7 @@ sub SetPredefinedStartPoints {
|
|||||||
<a name="GardenaSmartDeviceset"></a>
|
<a name="GardenaSmartDeviceset"></a>
|
||||||
<b>set</b>
|
<b>set</b>
|
||||||
<ul>
|
<ul>
|
||||||
|
<h3>mäher</h3>
|
||||||
<li>parkUntilFurtherNotice - Parken des Mähers unter Umgehung des Zeitplans</li>
|
<li>parkUntilFurtherNotice - Parken des Mähers unter Umgehung des Zeitplans</li>
|
||||||
<li>parkUntilNextTimer - Parken bis zum nächsten Zeitplan</li>
|
<li>parkUntilNextTimer - Parken bis zum nächsten Zeitplan</li>
|
||||||
<li>startOverrideTimer - Manuelles mähen (in Minuten, 60 = 1h, 1440 = 24h, 4320 = 72h)</li>
|
<li>startOverrideTimer - Manuelles mähen (in Minuten, 60 = 1h, 1440 = 24h, 4320 = 72h)</li>
|
||||||
@ -1282,9 +1333,14 @@ sub SetPredefinedStartPoints {
|
|||||||
<li>set NAME startpoint enable 1</li>
|
<li>set NAME startpoint enable 1</li>
|
||||||
<li>set NAME startpoint disable 3 enable 1</li>
|
<li>set NAME startpoint disable 3 enable 1</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h3>irrigation control</h3>
|
||||||
<li>resumeScheduleValve - Startet Bew&aauml;sserung am Ventil n nach Zeitplan</li>
|
<li>resumeScheduleValve - Startet Bew&aauml;sserung am Ventil n nach Zeitplan</li>
|
||||||
<li>stopScheduleValve - Setzt Bew&aauml;sserung am Ventil n aus (Default: 2040-12-31T22:00:00.000Z) | Optionaler Parameter Stunden (Jetzt + Stunden)</li>
|
<li>stopScheduleValve - Setzt Bew&aauml;sserung am Ventil n aus (Default: 2040-12-31T22:00:00.000Z) | Optionaler Parameter Stunden (Jetzt + Stunden)</li>
|
||||||
<li>closeAllValves - Stopt Bew&aauml;sserung an allen Ventilen </li>
|
<li>closeAllValves - Stopt Bew&aauml;sserung an allen Ventilen </li>
|
||||||
|
<h3>water control</h3>
|
||||||
|
<li>manualButtonTime - setzt die Dauer für den manuellen Knopf (in Minuten) 0 Schaltet den Knopf aus</li>
|
||||||
|
<li>stopSchedule - Halte Zeitplan an für x Stunden - (Default: 2040-12-31T22:00:00.000Z)</li>
|
||||||
|
<li>resumeSchedule - Weiterführung des Zeitplans</li>
|
||||||
</ul>
|
</ul>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -1307,7 +1363,7 @@ sub SetPredefinedStartPoints {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v2.4.0",
|
"version": "v2.4.1",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <leongaultier@gmail.com>"
|
"Marko Oldenburg <leongaultier@gmail.com>"
|
||||||
],
|
],
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
UPD 2021-05-22_04:53:56 46135 FHEM/73_GardenaSmartBridge.pm
|
UPD 2021-05-28_20:35:00 46928 FHEM/73_GardenaSmartBridge.pm
|
||||||
UPD 2021-05-22_04:54:14 51644 FHEM/74_GardenaSmartDevice.pm
|
UPD 2021-05-28_20:35:12 54414 FHEM/74_GardenaSmartDevice.pm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user