patch_ic24 #69
2
CHANGED
2
CHANGED
@ -1 +1 @@
|
|||||||
[enhancement] - change stopSchedule and resumeSchedule setter to connected valves
|
[add] - cancleValve for conencted valvs only
|
||||||
|
@ -414,7 +414,6 @@ sub Set {
|
|||||||
|
|
||||||
if ( lc $cmd eq 'getdevicesstate' ) {
|
if ( lc $cmd eq 'getdevicesstate' ) {
|
||||||
getDevices($hash);
|
getDevices($hash);
|
||||||
|
|
||||||
}
|
}
|
||||||
elsif ( lc $cmd eq 'gettoken' ) {
|
elsif ( lc $cmd eq 'gettoken' ) {
|
||||||
return "please set Attribut gardenaAccountEmail first"
|
return "please set Attribut gardenaAccountEmail first"
|
||||||
@ -438,6 +437,13 @@ sub Set {
|
|||||||
|
|
||||||
DeletePassword($hash);
|
DeletePassword($hash);
|
||||||
}
|
}
|
||||||
|
elsif ( lc $cmd eq 'debughelper') {
|
||||||
|
return "usage: $cmd" if ( scalar( @{$aArg} ) != 2 );
|
||||||
|
my $new_helper = $aArg->[0];
|
||||||
|
my $new_helper_value = $aArg->[1];
|
||||||
|
Log3( $name, 5, "[DEBUG] - GardenaSmartBridge ($name) - override helper $new_helper with $new_helper_value");
|
||||||
|
$hash->{helper}{$new_helper} = $new_helper_value;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
my $list = "getDevicesState:noArg getToken:noArg"
|
my $list = "getDevicesState:noArg getToken:noArg"
|
||||||
@ -482,8 +488,8 @@ sub Write {
|
|||||||
"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method"
|
"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method"
|
||||||
);
|
);
|
||||||
|
|
||||||
# Log3($name, 3,
|
# Log3($name, 3,
|
||||||
# "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
|
# "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -520,7 +526,6 @@ sub ErrorHandling {
|
|||||||
1 );
|
1 );
|
||||||
|
|
||||||
if ( $err =~ /timed out/ ) {
|
if ( $err =~ /timed out/ ) {
|
||||||
|
|
||||||
Log3 $dname, 5,
|
Log3 $dname, 5,
|
||||||
"GardenaSmartBridge ($dname) - RequestERROR: connect to gardena cloud is timed out. check network";
|
"GardenaSmartBridge ($dname) - RequestERROR: connect to gardena cloud is timed out. check network";
|
||||||
}
|
}
|
||||||
@ -607,6 +612,7 @@ sub ErrorHandling {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
$data =~ /Error/
|
$data =~ /Error/
|
||||||
|
&& $data !~ /lastLonaErrorCode/
|
||||||
|| ( defined($decode_json)
|
|| ( defined($decode_json)
|
||||||
&& ref($decode_json) eq 'HASH'
|
&& ref($decode_json) eq 'HASH'
|
||||||
&& defined( $decode_json->{errors} ) )
|
&& defined( $decode_json->{errors} ) )
|
||||||
@ -1568,7 +1574,7 @@ sub DeletePassword {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v2.4.8",
|
"version": "v2.5.2",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
||||||
],
|
],
|
||||||
|
@ -196,6 +196,11 @@ sub Define {
|
|||||||
$hash->{helper}{eco_mode_id} = '';
|
$hash->{helper}{eco_mode_id} = '';
|
||||||
$hash->{helper}{button_config_time_id} = '';
|
$hash->{helper}{button_config_time_id} = '';
|
||||||
$hash->{helper}{winter_mode_id} = '';
|
$hash->{helper}{winter_mode_id} = '';
|
||||||
|
# Electroni Pressure Pump
|
||||||
|
$hash->{helper}{operating_mode_id} = '';
|
||||||
|
$hash->{helper}{leakage_detection_id} = '';
|
||||||
|
$hash->{helper}{turn_on_pressure_id} = '';
|
||||||
|
|
||||||
|
|
||||||
$hash->{helper}{_id} = '';
|
$hash->{helper}{_id} = '';
|
||||||
|
|
||||||
@ -295,7 +300,7 @@ sub Set {
|
|||||||
|| AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
|| AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
|
||||||
$abilities = 'power'
|
$abilities = 'power'
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' );
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' );
|
||||||
$abilities = 'manual_watering'
|
$abilities = 'watering'
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' );
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' );
|
||||||
|
|
||||||
### mower
|
### mower
|
||||||
@ -356,12 +361,12 @@ sub Set {
|
|||||||
#$abilities['service_id'] = $hash->{helper}{SCHEDULESID} if ( $mainboard_version > 10.30 );
|
#$abilities['service_id'] = $hash->{helper}{SCHEDULESID} if ( $mainboard_version > 10.30 );
|
||||||
}
|
}
|
||||||
### electronic_pressure_pump
|
### electronic_pressure_pump
|
||||||
elsif ( lc $cmd eq 'pumptimer' ) {
|
# elsif ( lc $cmd eq 'pumptimer' ) {
|
||||||
$payload =
|
# $payload =
|
||||||
'"name":"pump_manual_watering_timer","parameters":{"duration":'
|
# '"name":"pump_manual_watering_timer","parameters":{"duration":'
|
||||||
. $aArg->[0] . '}';
|
# . $aArg->[0] . '}';
|
||||||
}
|
# }
|
||||||
### watering_computer
|
### watering_computer & electronic pump
|
||||||
elsif ( lc $cmd eq 'manualoverride' ) {
|
elsif ( lc $cmd eq 'manualoverride' ) {
|
||||||
$payload =
|
$payload =
|
||||||
'"properties":{"name":"watering_timer_1'
|
'"properties":{"name":"watering_timer_1'
|
||||||
@ -478,6 +483,40 @@ sub Set {
|
|||||||
. '","device":"'
|
. '","device":"'
|
||||||
. $hash->{DEVICEID} . '"}';
|
. $hash->{DEVICEID} . '"}';
|
||||||
}
|
}
|
||||||
|
### Watering_pressure_pump
|
||||||
|
elsif ( lc $cmd eq 'operating_mode') {
|
||||||
|
my $op_mode = $aArg->[0];
|
||||||
|
$payload = '"settings":{"name":"operating_mode",'
|
||||||
|
.'"value":"'.$op_mode.'",'
|
||||||
|
.'"device":"'
|
||||||
|
. $hash->{DEVICEID}.'"}';
|
||||||
|
$abilities = 'watering_pressure_pump_settings';
|
||||||
|
$service_id = $hash->{helper}->{ 'operating_mode_id' };
|
||||||
|
}
|
||||||
|
elsif ( lc $cmd eq 'leakage_detection') {
|
||||||
|
my $leakdetection_mode = $aArg->[0];
|
||||||
|
$payload = '"settings":{"name":"leakage_detection",'
|
||||||
|
.'"value":"'.$leakdetection_mode.'",'
|
||||||
|
.'"device":"'
|
||||||
|
. $hash->{DEVICEID}.'"}';
|
||||||
|
$abilities = 'watering_pressure_pump_settings';
|
||||||
|
$service_id = $hash->{helper}->{ 'leakage_detection_id' };
|
||||||
|
}
|
||||||
|
elsif ( lc $cmd eq 'turn_on_pressure') {
|
||||||
|
my $turnonpressure = $aArg->[0];
|
||||||
|
$payload = '"settings":{"name":"turn_on_pressure",'
|
||||||
|
.'"value":"'.$turnonpressure.'",'
|
||||||
|
.'"device":"'
|
||||||
|
. $hash->{DEVICEID}.'"}';
|
||||||
|
$abilities = 'watering_pressure_pump_settings';
|
||||||
|
$service_id = $hash->{helper}->{ 'turn_on_pressure_id' };
|
||||||
|
}
|
||||||
|
elsif ( lc $cmd eq 'resetvalveerrors') {
|
||||||
|
$payload = '"name":"reset_valve_errors",'
|
||||||
|
.' "parameters": {}';
|
||||||
|
$abilities = 'error';
|
||||||
|
}
|
||||||
|
|
||||||
### Sensors
|
### Sensors
|
||||||
elsif ( lc $cmd eq 'refresh' ) {
|
elsif ( lc $cmd eq 'refresh' ) {
|
||||||
|
|
||||||
@ -748,6 +787,7 @@ sub WriteReadings {
|
|||||||
if ( ref( $propertie->{value} ) eq "HASH" ) {
|
if ( ref( $propertie->{value} ) eq "HASH" ) {
|
||||||
my $sub_state = 0; my $sub_value = 0;
|
my $sub_state = 0; my $sub_value = 0;
|
||||||
while ( my ( $r, $v ) = each %{ $propertie->{value} } ) {
|
while ( my ( $r, $v ) = each %{ $propertie->{value} } ) {
|
||||||
|
if ( ref( $v ) ne "HASH" ) {
|
||||||
readingsBulkUpdate(
|
readingsBulkUpdate(
|
||||||
$hash,
|
$hash,
|
||||||
$decode_json->{abilities}[$abilities]{name} . '-'
|
$decode_json->{abilities}[$abilities]{name} . '-'
|
||||||
@ -755,6 +795,17 @@ sub WriteReadings {
|
|||||||
. $r,
|
. $r,
|
||||||
RigReadingsValue( $hash, $v )
|
RigReadingsValue( $hash, $v )
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
while ( my ( $i_r, $i_v ) = each %{ $v } ) {
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash,
|
||||||
|
$decode_json->{abilities}[$abilities]{name} . '-'
|
||||||
|
. $propertie->{name} . '_'
|
||||||
|
. $r . '_' . $i_r,
|
||||||
|
RigReadingsValue( $hash, $i_v )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# ic24 and other watering devices calc irrigation left in sec
|
# ic24 and other watering devices calc irrigation left in sec
|
||||||
@ -821,7 +872,10 @@ sub WriteReadings {
|
|||||||
&& ( $decode_json->{settings}[$settings]{name} =~
|
&& ( $decode_json->{settings}[$settings]{name} =~
|
||||||
/schedules_paused_until_?\d?$/
|
/schedules_paused_until_?\d?$/
|
||||||
|| $decode_json->{settings}[$settings]{name} eq 'eco_mode'
|
|| $decode_json->{settings}[$settings]{name} eq 'eco_mode'
|
||||||
|| $decode_json->{settings}[$settings]{name} eq 'winter_mode' )
|
|| $decode_json->{settings}[$settings]{name} eq 'winter_mode'
|
||||||
|
|| $decode_json->{settings}[$settings]{name} eq 'operating_mode'
|
||||||
|
|| $decode_json->{settings}[$settings]{name} eq 'leakage_detection'
|
||||||
|
|| $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' )
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if ( $hash->{helper}
|
if ( $hash->{helper}
|
||||||
@ -847,7 +901,14 @@ sub WriteReadings {
|
|||||||
# CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' )
|
# CommandAttr( undef, $name . " scheduling-scheduled_watering_next_start_") if ($decode_json->{settings}[$settings]{value} eq '' )
|
||||||
}
|
}
|
||||||
|
|
||||||
######
|
# save electronid pressure pump settings as readings
|
||||||
|
if ( $decode_json->{settings}[$settings]{name} eq 'operating_mode'
|
||||||
|
|| $decode_json->{settings}[$settings]{name} eq 'leakage_detection'
|
||||||
|
|| $decode_json->{settings}[$settings]{name} eq 'turn_on_pressure' ) {
|
||||||
|
readingsBulkUpdateIfChanged( $hash, $decode_json->{settings}[$settings]{name},
|
||||||
|
$decode_json->{settings}[$settings]{value} );
|
||||||
|
|
||||||
|
}
|
||||||
# save winter mode as reading
|
# save winter mode as reading
|
||||||
if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) {
|
if ( $decode_json->{settings}[$settings]{name} eq 'winter_mode' ) {
|
||||||
readingsBulkUpdateIfChanged( $hash, 'winter_mode',
|
readingsBulkUpdateIfChanged( $hash, 'winter_mode',
|
||||||
@ -1176,6 +1237,39 @@ sub setState {
|
|||||||
ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) )
|
ReadingsVal( $name, 'power-power_timer', 'no info from power-timer' ) )
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' );
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'power' );
|
||||||
|
|
||||||
|
#electronic water pump
|
||||||
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' ) { # | ok | pump_not_filled (Pumpe nicht gefüllt)
|
||||||
|
my $state_string = ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~
|
||||||
|
m{\A[1-9]([0-9]+)?\z}xms
|
||||||
|
# offen
|
||||||
|
?
|
||||||
|
( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' )
|
||||||
|
# leer ( zeitplan aktiv ... )
|
||||||
|
? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash, 'next watering: %s')), (ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 )/60), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '')) )
|
||||||
|
# zeitplan pausiert
|
||||||
|
:
|
||||||
|
( ReadingsVal($name, 'scheduling-schedules_paused_until', '') eq '2038-01-18T00:00:00.000Z')
|
||||||
|
# pause bis dauerhaft
|
||||||
|
? sprintf( (RigReadingsValue($hash, 'will be irrigated %.f minutes remaining.').' '.RigReadingsValue($hash , 'schedule permanently paused')), (ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 )/60) )
|
||||||
|
# naechter termin
|
||||||
|
: sprintf( RigReadingsValue($hash , 'paused until %s'), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-schedules_paused_until', '')) )
|
||||||
|
# zu
|
||||||
|
:
|
||||||
|
( ReadingsVal($name, 'scheduling-schedules_paused_until', '' ) eq '' )
|
||||||
|
# zeitplan aktiv
|
||||||
|
? sprintf( (RigReadingsValue($hash, 'closed') .'. '.RigReadingsValue($hash, 'next watering: %s')), RigReadingsValue($hash, ReadingsVal($name, 'scheduling-scheduled_watering_next_start', '') ) )
|
||||||
|
# zeitplan pausiert
|
||||||
|
: RigReadingsValue($hash, 'closed')
|
||||||
|
;
|
||||||
|
# state offline | override
|
||||||
|
$state_string = 'offline' if ($online_state eq 'offline');
|
||||||
|
# check valv error, override state
|
||||||
|
my $error_type = ReadingsVal( $name, 'error-valve_error_1_type', 'ok' );
|
||||||
|
$state_string = ( $error_type ne 'ok' ) ? $error_type : $state_string;
|
||||||
|
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash, 'state', RigReadingsValue( $hash, $state_string ) );
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1290,6 +1384,7 @@ sub ReadingLangGerman {
|
|||||||
'will be irrigated %.f minutes remaining.'=> 'Wird bewässert. %.f Minuten verbleibend.',
|
'will be irrigated %.f minutes remaining.'=> 'Wird bewässert. %.f Minuten verbleibend.',
|
||||||
'next watering: %s' => 'Nächste Bewässerung: %s',
|
'next watering: %s' => 'Nächste Bewässerung: %s',
|
||||||
'n/a' => 'nicht verfügbar',
|
'n/a' => 'nicht verfügbar',
|
||||||
|
'pump_not_filled' => 'Pumpe nicht gefüllt',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
UPD 2022-07-01_16:13:02 49241 FHEM/73_GardenaSmartBridge.pm
|
UPD 2022-07-12_19:25:17 49634 FHEM/73_GardenaSmartBridge.pm
|
||||||
UPD 2022-07-11_20:22:02 76451 FHEM/74_GardenaSmartDevice.pm
|
UPD 2022-07-12_19:24:20 81601 FHEM/74_GardenaSmartDevice.pm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user