testing #29
@ -1219,7 +1219,7 @@ sub createHttpValueStrings {
|
||||
$uri = '/auth/token' if ( !defined( $hash->{helper}{session_id} ) );
|
||||
|
||||
if ( defined( $hash->{helper}{locations_id} ) ) {
|
||||
if ( defined($abilities) && $abilities eq 'mower_settings' ) {
|
||||
if ( defined($abilities) && $abilities =~ /.*_settings/ ) {
|
||||
|
||||
$method = 'PUT';
|
||||
my $dhash = $modules{GardenaSmartDevice}{defptr}{$deviceId};
|
||||
@ -1231,7 +1231,7 @@ sub createHttpValueStrings {
|
||||
. $service_id
|
||||
if ( defined($abilities)
|
||||
&& defined($payload)
|
||||
&& $abilities eq 'mower_settings' );
|
||||
&& $abilities =~ /.*_settings/ );
|
||||
|
||||
} # park until next schedules or override
|
||||
elsif (defined($abilities)
|
||||
|
@ -209,6 +209,14 @@ sub Define {
|
||||
$hash->{helper}{STARTINGPOINTID} = '';
|
||||
$hash->{helper}{schedules_paused_until_id} = '';
|
||||
$hash->{helper}{eco_mode_id} = '';
|
||||
# IrrigationControl valve control max 6
|
||||
$hash->{helper}{schedules_paused_until_1_id} = '';
|
||||
$hash->{helper}{schedules_paused_until_2_id} = '';
|
||||
$hash->{helper}{schedules_paused_until_3_id} = '';
|
||||
$hash->{helper}{schedules_paused_until_4_id} = '';
|
||||
$hash->{helper}{schedules_paused_until_5_id} = '';
|
||||
$hash->{helper}{schedules_paused_until_6_id} = '';
|
||||
|
||||
|
||||
CommandAttr( undef,
|
||||
"$name IODev $modules{GardenaSmartBridge}{defptr}{BRIDGE}->{NAME}" )
|
||||
@ -282,6 +290,18 @@ sub Set {
|
||||
my $abilities;
|
||||
my $service_id;
|
||||
my $mainboard_version = ReadingsVal( $name, 'mower_type-mainboard_version', 0.0 );
|
||||
|
||||
#set default abilitie ... overwrite in cmd to change
|
||||
$abilities = 'mower'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' );
|
||||
$abilities = 'watering'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24'
|
||||
|| AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
||||
$abilities = 'power'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' );
|
||||
$abilities = 'manual_watering'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' );
|
||||
|
||||
### mower
|
||||
# service_id (eco, parkuntilfurhternotice, startpoints)
|
||||
if ( lc $cmd eq 'parkuntilfurthernotice' ) {
|
||||
@ -383,6 +403,21 @@ sub Set {
|
||||
. ',"valve_id":'
|
||||
. $valve_id . '}}';
|
||||
}
|
||||
elsif ( $cmd eq 'closeAllValves' ){
|
||||
$payload = '"name":"close_all_valves","parameters":{}';
|
||||
}
|
||||
elsif ( $cmd =~ '/.*ScheduleValve/' ){
|
||||
my $valve_id = $1;
|
||||
$abilities = 'irrigation_settings';
|
||||
$service_id = $hash->{helper}->{'schedules_paused_until_'.$valve_id.'_id'};
|
||||
$payload = '"settings":{"name":"schedules_paused_until_'
|
||||
.$valve_id.
|
||||
'", "value":"'
|
||||
. ($cmd eq 'resumeScheduleValve') ? '' : '2040-12-31T22:00:00.000Z'
|
||||
.'","device":"'
|
||||
.$hash->{DEVICEID}
|
||||
.'"}';
|
||||
}
|
||||
### Sensors
|
||||
elsif ( lc $cmd eq 'refresh' ) {
|
||||
|
||||
@ -420,7 +455,7 @@ sub Set {
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
||||
|
||||
$list .=
|
||||
'manualDurationValve1:slider,1,1,59 manualDurationValve2:slider,1,1,59 manualDurationValve3:slider,1,1,59 manualDurationValve4:slider,1,1,59 manualDurationValve5:slider,1,1,59 manualDurationValve6:slider,1,1,59 cancelOverrideValve1:noArg cancelOverrideValve2:noArg cancelOverrideValve3:noArg cancelOverrideValve4:noArg cancelOverrideValve5:noArg cancelOverrideValve6:noArg'
|
||||
'closeAllValves:noArg stopScheduleValve:selectnumbers,1,1,6,0,lin resumeScheduleValve:selectnumbers,1,1,6,0,lin manualDurationValve1:slider,1,1,59 manualDurationValve2:slider,1,1,59 manualDurationValve3:slider,1,1,59 manualDurationValve4:slider,1,1,59 manualDurationValve5:slider,1,1,59 manualDurationValve6:slider,1,1,59 cancelOverrideValve1:noArg cancelOverrideValve2:noArg cancelOverrideValve3:noArg cancelOverrideValve4:noArg cancelOverrideValve5:noArg cancelOverrideValve6:noArg'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' );
|
||||
|
||||
$list .= 'refresh:temperature,humidity'
|
||||
@ -435,17 +470,6 @@ sub Set {
|
||||
|
||||
return "Unknown argument $cmd, choose one of $list";
|
||||
}
|
||||
|
||||
$abilities = 'mower'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' )
|
||||
&& ($abilities !~ /mower_settings|mower_timer/);
|
||||
$abilities = 'watering'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24'
|
||||
|| AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
||||
$abilities = 'power'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' );
|
||||
$abilities = 'manual_watering'
|
||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' );
|
||||
|
||||
$hash->{helper}{deviceAction} = $payload;
|
||||
readingsSingleUpdate( $hash, "state", "send command to gardena cloud", 1 );
|
||||
@ -614,7 +638,8 @@ sub WriteReadings {
|
||||
#Log3 $name, 1, " - IST ARRAY" if ( ref( $decode_json->{settings}[$settings]{value} ) eq "ARRAY");
|
||||
|
||||
if ( exists($decode_json->{settings}[$settings]{name})
|
||||
&& ( $decode_json->{settings}[$settings]{name} eq 'schedules_paused_until'
|
||||
&& (
|
||||
$decode_json->{settings}[$settings]{name} =~ /schedules_paused_until_?\d?$/
|
||||
|| $decode_json->{settings}[$settings]{name} eq 'eco_mode' )
|
||||
)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user