mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +00:00
74_GardenaSmartDevice: add lona readings, [fix] - setter procedure
git-svn-id: https://svn.fhem.de/fhem/trunk@26186 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
837d82d4a5
commit
18c45fa09f
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: 74_GardenaSmartDevice: add lona readings, [fix] - setter procedure
|
||||||
- feature: 14_CUL_TCM97001:
|
- feature: 14_CUL_TCM97001:
|
||||||
add KW9015 (TFA 30.3161)
|
add KW9015 (TFA 30.3161)
|
||||||
add Mebus HQ7312
|
add Mebus HQ7312
|
||||||
|
@ -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} ) )
|
||||||
@ -1577,7 +1583,7 @@ sub DeletePassword {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v2.4.7",
|
"version": "v2.5.2",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
||||||
],
|
],
|
||||||
|
@ -195,6 +195,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} = '';
|
||||||
|
|
||||||
@ -294,7 +299,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
|
||||||
@ -355,12 +360,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'
|
||||||
@ -477,7 +482,41 @@ sub Set {
|
|||||||
. '","device":"'
|
. '","device":"'
|
||||||
. $hash->{DEVICEID} . '"}';
|
. $hash->{DEVICEID} . '"}';
|
||||||
}
|
}
|
||||||
### Sensors
|
### 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
|
||||||
elsif ( lc $cmd eq 'refresh' ) {
|
elsif ( lc $cmd eq 'refresh' ) {
|
||||||
|
|
||||||
my $sensname = $aArg->[0];
|
my $sensname = $aArg->[0];
|
||||||
@ -529,6 +568,9 @@ sub Set {
|
|||||||
'closeAllValves:noArg stopScheduleValve:selectnumbers,1,1,6,0,lin resumeScheduleValve:selectnumbers,1,1,6,0,lin manualDurationValve1:slider,1,1,90 manualDurationValve2:slider,1,1,90 manualDurationValve3:slider,1,1,90 manualDurationValve4:slider,1,1,90 manualDurationValve5:slider,1,1,90 manualDurationValve6:slider,1,1,90 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,90 manualDurationValve2:slider,1,1,90 manualDurationValve3:slider,1,1,90 manualDurationValve4:slider,1,1,90 manualDurationValve5:slider,1,1,90 manualDurationValve6:slider,1,1,90 cancelOverrideValve1:noArg cancelOverrideValve2:noArg cancelOverrideValve3:noArg cancelOverrideValve4:noArg cancelOverrideValve5:noArg cancelOverrideValve6:noArg'
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' );
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'ic24' );
|
||||||
|
|
||||||
|
$list .= 'manualOverride:slider,1,1,90 cancelOverride:noArg operating_mode:automatic,scheduled leakage_detection:watering,washing_machine,domestic_water_supply,off turn_on_pressure:slider,2,0.2,3.0,1 resetValveErrors:noArg'
|
||||||
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'electronic_pressure_pump' );
|
||||||
|
|
||||||
$list .= 'refresh:temperature,humidity'
|
$list .= 'refresh:temperature,humidity'
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ );
|
if ( AttrVal( $name, 'model', 'unknown' ) =~ /sensor.?/ );
|
||||||
|
|
||||||
@ -734,13 +776,25 @@ sub WriteReadings {
|
|||||||
|
|
||||||
if ( ref( $propertie->{value} ) eq "HASH" ) {
|
if ( ref( $propertie->{value} ) eq "HASH" ) {
|
||||||
while ( my ( $r, $v ) = each %{ $propertie->{value} } ) {
|
while ( my ( $r, $v ) = each %{ $propertie->{value} } ) {
|
||||||
readingsBulkUpdate(
|
if ( ref( $v ) ne "HASH" ) {
|
||||||
$hash,
|
readingsBulkUpdate(
|
||||||
$decode_json->{abilities}[$abilities]{name} . '-'
|
$hash,
|
||||||
|
$decode_json->{abilities}[$abilities]{name} . '-'
|
||||||
|
. $propertie->{name} . '_'
|
||||||
|
. $r,
|
||||||
|
RigReadingsValue( $hash, $v )
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
while ( my ( $i_r, $i_v ) = each %{ $v } ) {
|
||||||
|
readingsBulkUpdate(
|
||||||
|
$hash,
|
||||||
|
$decode_json->{abilities}[$abilities]{name} . '-'
|
||||||
. $propertie->{name} . '_'
|
. $propertie->{name} . '_'
|
||||||
. $r,
|
. $r . '_' . $i_r,
|
||||||
RigReadingsValue( $hash, $v )
|
RigReadingsValue( $hash, $i_v )
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -761,7 +815,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}
|
||||||
@ -778,6 +835,14 @@ sub WriteReadings {
|
|||||||
$decode_json->{settings}[$settings]{value} );
|
$decode_json->{settings}[$settings]{value} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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' ) {
|
||||||
@ -867,7 +932,6 @@ sub setState {
|
|||||||
# 4. Ventil manuell geoeffnet, Zeitpläne deaktiviert.
|
# 4. Ventil manuell geoeffnet, Zeitpläne deaktiviert.
|
||||||
# App zeigt: "Wird bewässert xx Minuten verbleibend"
|
# App zeigt: "Wird bewässert xx Minuten verbleibend"
|
||||||
if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ){
|
if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' ){
|
||||||
|
|
||||||
my $state_string = ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~
|
my $state_string = ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~
|
||||||
m{\A[1-9]([0-9]+)?\z}xms
|
m{\A[1-9]([0-9]+)?\z}xms
|
||||||
# offen
|
# offen
|
||||||
@ -941,6 +1005,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,6 +1151,7 @@ sub ReadingLangGerman {
|
|||||||
'paused until %s' => 'pausiert bis %s',
|
'paused until %s' => 'pausiert bis %s',
|
||||||
'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',
|
||||||
|
'pump_not_filled' => 'Pumpe nicht gefüllt',
|
||||||
);
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -1535,7 +1633,7 @@ sub SetPredefinedStartPoints {
|
|||||||
],
|
],
|
||||||
"release_status": "stable",
|
"release_status": "stable",
|
||||||
"license": "GPL_2",
|
"license": "GPL_2",
|
||||||
"version": "v2.4.3",
|
"version": "v2.5.2",
|
||||||
"author": [
|
"author": [
|
||||||
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user