Commit 9f4ffa16 authored by Admin's avatar Admin
Browse files

bump: 10_MAX 14_CUL_MAX 57_Calendar 70_BOTVAC 70_HYDRAWISE...

bump: 10_MAX 14_CUL_MAX 57_Calendar 70_BOTVAC 70_HYDRAWISE 73_GardenaSmartBridge 74_GardenaSmartDevice 77_UWZ 98_DOIF 98_RandomTimer 98_configdb 98_readingsWatcher 98_todoist; @SVN: 21829
parent 3086290a
Pipeline #73 passed with stage
in 3 seconds
This diff is collapsed.
This diff is collapsed.
# $Id: 57_Calendar.pm 21531 2020-03-28 16:02:21Z neubert $
# $Id: 57_Calendar.pm 21818 2020-04-30 14:21:02Z neubert $
##############################################################################
#
# 57_Calendar.pm
......@@ -1998,9 +1998,6 @@ sub Calendar_Notify($$) {
Calendar_DisarmTimer($hash);
my $delay = 10 + int( rand(20) );
# delay removed until further notice
$delay = 2;
Log3 $hash, 5,
"Calendar $name: FHEM initialization or rereadcfg triggered update, delay $delay seconds.";
InternalTimer( time() + $delay, "Calendar_Wakeup", $hash, 0 );
......
This diff is collapsed.
# $Id: 70_HYDRAWISE.pm 21790 2020-04-28 08:27:38Z xasher $
# $Id: 70_HYDRAWISE.pm 21804 2020-04-29 11:22:03Z xasher $
##############################################################################
#
# 70_HYDRAWISE.pm
......@@ -443,7 +443,7 @@ sub HYDRAWISE_SendCommand {
###################################
sub HYDRAWISE_ReceiveCommand {
my ( $param, $err, $data ) = @_;
my ( $param, $err, $data, $do_trigger ) = @_;
my $hash = $param->{hash};
my $name = $hash->{NAME};
my $service = $param->{service};
......@@ -485,13 +485,15 @@ sub HYDRAWISE_ReceiveCommand {
# Set reading for presence
#
#readingsSingleUpdate( $hash, "presence", $presence, 1 );
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash, "presence", "$presence" );
readingsSingleUpdate( $hash, "presence", $presence, 1 );
#HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash, "presence", "$presence" );
# Set reading for state
#
#readingsSingleUpdate( $hash, "state", $state, 1 );
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash, "state", "$state" );
readingsSingleUpdate( $hash, "state", $state, 1 );
#HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash, "state", "$state" );
if ( !defined($cmd) ) {
Log3 $name, 4, "HYDRAWISE $name: RCV $service";
......@@ -537,12 +539,20 @@ sub HYDRAWISE_ReceiveCommand {
if ( ref($return) eq "HASH" && !defined($cmd) ) {
# controllers
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash, "customer_id",
$return->{customer_id} );
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash,
"cur_controller_id", $return->{controller_id} );
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash,
"cur_controller_name", $return->{current_controller} );
if ( $return->{customer_id} ) {
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash,
"customer_id", $return->{customer_id} );
}
if ( $return->{controller_id} ) {
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash,
"cur_controller_id", $return->{controller_id} );
}
if ( $return->{current_controller} ) {
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash,
"cur_controller_name", $return->{current_controller} );
}
if ( ref( $return->{controllers} ) eq "ARRAY"
&& scalar( @{ $return->{controllers} } ) > 0 )
......@@ -592,6 +602,12 @@ sub HYDRAWISE_ReceiveCommand {
Log3 $name, 5,
"HYDRAWISE $name: $relays->{relay} $relays->{relay_id}";
#readingsSingleUpdate( $hash, "rl" . $relays->{relay} . "_relay", $relays->{relay}, $do_trigger );
#readingsSingleUpdate( $hash, "rl" . $relays->{relay} . "_relay_id", $relays->{relay_id}, $do_trigger );
#readingsSingleUpdate( $hash, "rl" . $relays->{relay} . "_name", $relays->{name}, $do_trigger );
#readingsSingleUpdate( $hash, "rl" . $relays->{relay} . "_next", $relays->{timestr}, $do_trigger );
#readingsSingleUpdate( $hash, "rl" . $relays->{relay} . "_run_minutes", $relays->{run}, $do_trigger );
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash,
"rl" . $relays->{relay} . "_relay",
$relays->{relay} );
......@@ -636,6 +652,7 @@ sub HYDRAWISE_ReceiveCommand {
if ( ref( $return->{relays} ) eq "ARRAY"
and scalar( @{ $return->{relays} } ) > 0 )
{
readingsBeginUpdate($hash);
HYDRAWISE_ReadingsBulkUpdateIfChanged( $hash, "relay_counts",
scalar( @{ $return->{relays} } ) );
for my $relays ( @{ $return->{relays} } ) {
......@@ -757,13 +774,15 @@ sub HYDRAWISE_TriggerFullDataUpdate {
}
sub HYDRAWISE_ReadingsBulkUpdateIfChanged {
my ( $hash, $reading, $value ) = @_;
my ( $hash, $reading, $value, $do_trigger ) = @_;
my $name = $hash->{NAME};
$value = "" if ( !defined($value) );
readingsBulkUpdate( $hash, $reading, $value )
if ( ReadingsVal( $name, $reading, "" ) ne $value );
# print "hydrawise READING: $reading -> $value \n";
if ($value) {
readingsBeginUpdate($hash);
readingsBulkUpdate( $hash, $reading, $value );
readingsEndUpdate( $hash, 1 );
}
return;
}
......
......@@ -28,7 +28,7 @@
# GNU General Public License for more details.
#
#
# $Id: 73_GardenaSmartBridge.pm 21791 2020-04-28 09:19:20Z CoolTux $
# $Id: 73_GardenaSmartBridge.pm 21829 2020-05-01 13:52:29Z CoolTux $
#
###############################################################################
##
......@@ -215,21 +215,21 @@ sub Initialize {
}
sub Define {
my $hash = shift;
my $a = shift;
my $hash = shift // return;
my $aArg = shift // return;
return $@ unless ( FHEM::Meta::SetInternals($hash) );
use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' );
return 'too few parameters: define <NAME> GardenaSmartBridge'
if ( scalar( @{$a} ) != 2 );
if ( scalar( @{$aArg} ) != 2 );
return
'Cannot define Gardena Bridge device. Perl modul '
. ${missingModul}
. ' is missing.'
if ($missingModul);
my $name = shift @$a;
my $name = shift @$aArg;
$hash->{BRIDGE} = 1;
$hash->{URL} =
AttrVal( $name, 'gardenaBaseURL',
......@@ -329,8 +329,8 @@ sub Attr {
}
sub Notify {
my $hash = shift;
my $dev = shift;
my $hash = shift // return;
my $dev = shift // return;
my $name = $hash->{NAME};
return if ( IsDisabled($name) );
......@@ -396,11 +396,14 @@ sub Notify {
}
sub Set {
my $hash = shift;
my $a = shift;
my $hash = shift // return;
my $aArg = shift // return;
my $name = shift @$aArg // return;
my $cmd = shift @$aArg
// return qq{"set $name" needs at least one argument};
my $name = shift @$a;
my $cmd = shift @$a // return qq{"set $name" needs at least one argument};
# Das Argument für das Passwort, also das Passwort an sich darf keine = enthalten!!!
if ( lc $cmd eq 'getdevicesstate' ) {
getDevices($hash);
......@@ -419,12 +422,12 @@ sub Set {
elsif ( lc $cmd eq 'gardenaaccountpassword' ) {
return "please set Attribut gardenaAccountEmail first"
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) eq 'none' );
return "usage: $cmd <password>" if ( scalar( @{$a} ) != 0 );
return "usage: $cmd <password>" if ( scalar( @{$aArg} ) != 1 );
StorePassword( $hash, $name, $a->[0] );
StorePassword( $hash, $name, $aArg->[0] );
}
elsif ( lc $cmd eq 'deleteaccountpassword' ) {
return "usage: $cmd <password>" if ( scalar( @{$a} ) != 0 );
return "usage: $cmd" if ( scalar( @{$aArg} ) != 0 );
DeletePassword($hash);
}
......@@ -1375,7 +1378,7 @@ sub DeletePassword {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v2.0.0",
"version": "v2.0.2",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],
......
......@@ -28,7 +28,7 @@
# GNU General Public License for more details.
#
#
# $Id: 74_GardenaSmartDevice.pm 21793 2020-04-28 13:21:32Z CoolTux $
# $Id: 74_GardenaSmartDevice.pm 21829 2020-05-01 13:52:29Z CoolTux $
#
###############################################################################
##
......@@ -187,19 +187,19 @@ sub Initialize {
}
sub Define {
my $hash = shift;
my $a = shift;
my $hash = shift // return;
my $aArg = shift // return;
return $@ unless ( FHEM::Meta::SetInternals($hash) );
use version 0.60; our $VERSION = FHEM::Meta::Get( $hash, 'version' );
return
"too few parameters: define <NAME> GardenaSmartDevice <device_Id> <model>"
if ( scalar( @{$a} ) < 3 );
if ( scalar( @{$aArg} ) < 3 );
my $name = $a->[0];
my $deviceId = $a->[2];
my $category = $a->[3];
my $name = $aArg->[0];
my $deviceId = $aArg->[2];
my $category = $aArg->[3];
$hash->{DEVICEID} = $deviceId;
$hash->{VERSION} = version->parse($VERSION)->normal;
......@@ -267,11 +267,12 @@ sub Attr {
}
sub Set {
my $hash = shift;
my $a = shift;
my $hash = shift // return;
my $aArg = shift // return;
my $name = shift @$a;
my $cmd = shift @$a // return qq{"set $name" needs at least one argument};
my $name = shift @$aArg;
my $cmd = shift @$aArg
// return qq{"set $name" needs at least one argument};
my $payload;
my $abilities = '';
......@@ -290,13 +291,14 @@ sub Set {
}
elsif ( lc $cmd eq 'startoverridetimer' ) {
$payload = '"name":"start_override_timer","parameters":{"duration":'
. $a->[0] * 60 . '}';
. $aArg->[0] * 60 . '}';
}
elsif ( lc $cmd eq 'startpoint' ) {
my $err;
( $err, $payload, $abilities ) = SetPredefinedStartPoints( $hash, @$a );
( $err, $payload, $abilities ) =
SetPredefinedStartPoints( $hash, @$aArg );
return $err if ( defined($err) );
}
......@@ -304,14 +306,14 @@ sub Set {
elsif ( lc $cmd eq 'pumptimer' ) {
$payload =
'"name":"pump_manual_watering_timer","parameters":{"duration":'
. $a->[0] . '}';
. $aArg->[0] . '}';
}
### watering_computer
elsif ( lc $cmd eq 'manualoverride' ) {
$payload =
'"properties":{"name":"watering_timer_1'
. '","value":{"state":"manual","duration":'
. $a->[0] * 60
. $aArg->[0] * 60
. ',"valve_id":1}}';
}
elsif ( $cmd =~ m{\AcancelOverride}xms ) {
......@@ -332,8 +334,8 @@ sub Set {
}
elsif ( lc $cmd eq 'on' || lc $cmd eq 'off' || lc $cmd eq 'on-for-timer' ) {
my $val = (
defined($a) && ref($a) eq 'ARRAY'
? $a->[0] * 60
defined($aArg) && ref($aArg) eq 'ARRAY'
? $aArg->[0] * 60
: lc $cmd
);
......@@ -351,14 +353,14 @@ sub Set {
'"properties":{"name":"watering_timer_'
. $valve_id
. '","value":{"state":"manual","duration":'
. $a->[0] * 60
. $aArg->[0] * 60
. ',"valve_id":'
. $valve_id . '}}';
}
### Sensors
elsif ( lc $cmd eq 'refresh' ) {
my $sensname = $a->[0];
my $sensname = $aArg->[0];
if ( lc $sensname eq 'temperature' ) {
$payload = '"name":"measure_ambient_temperature"';
$abilities = 'ambient_temperature';
......@@ -379,6 +381,10 @@ sub Set {
my $list = '';
$list .=
'parkUntilFurtherNotice:noArg parkUntilNextTimer:noArg startResumeSchedule:noArg startOverrideTimer:slider,0,1,60 startpoint'
if ( AttrVal( $name, 'model', 'unknown' ) eq 'mower' );
$list .= 'manualOverride:slider,1,1,59 cancelOverride:noArg'
if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
......@@ -606,10 +612,10 @@ sub WriteReadings {
readingsBulkUpdate(
$hash, 'state',
(
ReadingsVal( $name, 'watering-watering_timer_1_state', 'idle' ) eq
'idle'
? RigReadingsValue( $hash, 'closed' )
: RigReadingsValue( $hash, 'open' )
ReadingsVal( $name, 'watering-watering_timer_1_duration', 0 ) =~
m{\A[1-9]([0-9]+)?\z}xms
? RigReadingsValue( $hash, 'open' )
: RigReadingsValue( $hash, 'closed' )
)
) if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );
......@@ -1208,7 +1214,7 @@ sub SetPredefinedStartPoints {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v2.0.0",
"version": "v2.0.3",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
],
......
This diff is collapsed.
#############################################
# $Id: 98_DOIF.pm 21798 2020-04-28 17:41:58Z Damian $
# $Id: 98_DOIF.pm 21813 2020-04-30 10:05:47Z Damian $
#
# This file is part of fhem.
#
......@@ -22,7 +22,7 @@ use strict;
use warnings;
use Blocking;
use Color;
use vars qw($FW_CSRF);
use vars qw($FW_CSRF $FW_room);
my $hs;
......@@ -5470,7 +5470,7 @@ sub y_h {
}
my $prop = $value / ( $max - $min );
my $h = abs( $prop * ($height) ) + 4.3;
my $h = abs( $prop * ($height) ) + 4;
my $y;
my $null;
......@@ -5479,7 +5479,7 @@ sub y_h {
$y = $null;
}
else {
$y = $null + 4.3 - $h;
$y = $null + 4.9 - $h;
}
$null = undef if ( $max == 0 or $min == 0 );
return ( $y, $h, $null );
......@@ -6468,10 +6468,6 @@ Zeitintervalle über Mitternacht:<br>
<br>
<code>define di_light DOIF ([22:00-07:00]) (set light on) DOELSE (set light off) </code><br>
<br>
in Verbindung mit Wochentagen (einschalten am Freitag ausschalten am Folgetag):<br>
<br>
<code>define di_light DOIF ([22:00-07:00|5]) (set light on) DOELSE (set light off) </code><br>
<br>
Zeitintervalle über mehrere Tage müssen als Zeitpunkte angegeben werden.<br>
<br>
Einschalten am Freitag ausschalten am Montag:<br>
......
##########################################################################
# $Id: 98_RandomTimer.pm 21753 2020-04-22 20:05:04Z Beta-User $
# $Id: 98_RandomTimer.pm 21806 2020-04-29 11:58:04Z Beta-User $
#
# copyright ###################################################################
#
......@@ -28,8 +28,10 @@ package FHEM::RandomTimer; ## no critic 'Package declaration'
use strict;
use warnings;
use utf8;
use Time::HiRes qw(gettimeofday);
use Time::Local 'timelocal_nocheck';
use List::Util qw(max);
use GPUtils qw(GP_Import GP_Export);
## Import der FHEM Funktionen
......@@ -51,16 +53,17 @@ BEGIN {
AttrVal
ReadingsVal
Value
IsDisabled
Log3
InternalTimer
RemoveInternalTimer
CommandDeleteAttr
AnalyzeCommandChain
AnalyzePerlCommand
SemicolonEscape
FmtDateTime
strftime
GetTimeSpec
maxNum
stacktrace )
);
}
......@@ -83,7 +86,7 @@ sub Initialize {
$hash->{AttrFn} = \&Attr;
$hash->{AttrList} =
"onCmd offCmd switchmode disable:0,1 disableCond disableCondCmd:none,offCmd,onCmd offState "
. "runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 "
. "runonce:0,1 keepDeviceAlive:0,1 forceStoptimeSameDay:0,1 disabledForIntervals "
. $readingFnAttributes;
return;
}
......@@ -102,14 +105,14 @@ sub Define {
if ( !defined $timeToSwitch );
my ( $rel, $rep, $tspec );
if ( $timespec_start =~ m/^(\+)?(\*)?(.*)$/ix ) {
if ( $timespec_start =~ m{^(\+)?(\*)?(.*)$}ixms ) {
$rel = $1;
$rep = $2;
$tspec = $3;
}
else {
return
"Wrong timespec_start <$timespec_start>, use \"[+][*]<time or func>\"";
qq{"Wrong timespec_start <$timespec_start>, use "[+][*]<time or func>"};
}
my ( $err, $hr, $min, $sec, $fn ) = GetTimeSpec($tspec);
......@@ -119,27 +122,27 @@ sub Define {
$rep = $rep // "";
my ( $srel, $srep, $stspec );
if ( $timespec_stop =~ m/^(\+)?(\*)?(.*)$/ix ) {
if ( $timespec_stop =~ m{^(\+)?(\*)?(.*)$}ixms ) {
$srel = $1;
$srep = $2;
$stspec = $3;
}
else {
return
"Wrong timespec_stop <$timespec_stop>, use \"[+][*]<time or func>\"";
qq{"Wrong timespec_stop <$timespec_stop>, use "[+][*]<time or func>"};
}
my ( $e, $h, $m, $s, $f ) = GetTimeSpec($stspec);
return $e if ($e);
return "invalid timeToSwitch <$timeToSwitch>, use 9999"
if ( !( $timeToSwitch =~ m/^[0-9]{2,4}$/ix ) );
if ( !( $timeToSwitch =~ m{^[0-9]{2,4}$}ixms ) );
my ( $varDuration, $varStart );
$varDuration = 0;
$varStart = 0;
if ( defined $variation ) {
$variation =~ /^([\d]+)/x ? $varDuration = $1 : undef;
$variation =~ /[:]([\d]+)/x ? $varStart = $1 : undef;
$variation =~ m{^([\d]+)}xms ? $varDuration = $1 : undef;
$variation =~ m{[:]([\d]+)}xms ? $varStart = $1 : undef;
}
setSwitchmode( $hash, "800/200" )
if ( !defined $hash->{helper}{SWITCHMODE} );
......@@ -213,7 +216,8 @@ sub Set {
my ( $hash, @a ) = @_;
return "no set value specified" if ( int(@a) < 2 );
return "Unknown argument $a[1], choose one of execNow:noArg"
return
"Unknown argument $a[1], choose one of execNow:noArg active:noArg inactive:noArg"
if ( $a[1] eq "?" );
my $name = shift @a;
......@@ -228,6 +232,18 @@ sub Set {
RmInternalTimer( "Exec", $hash );
MkInternalTimer( "Exec", time() + 1, \&Exec, $hash, 0 );
}
return;
}
if ( $v eq "active" || $v eq "inactive" ) {
Log3( $hash, 3, "[$name] set $name $v" );
if ( $v eq "active" && AttrVal( $name, "disable", 0 ) ) {
CommandDeleteAttr( undef, "$name disable" );
}
my $statevalue = $v eq "active" ? "activated" : $v;
readingsSingleUpdate( $hash, "state", $statevalue, 1 );
RmInternalTimer( "Exec", $hash );
MkInternalTimer( "Exec", time() + 1, \&Exec, $hash, 0 );
return;
}
return;
}
......@@ -245,7 +261,7 @@ sub addDays {
}
sub device_switch {
my $hash = shift;
my $hash = shift // return;
my $command = "set @ $hash->{COMMAND}";
if ( $hash->{COMMAND} eq "on" ) {
......@@ -254,7 +270,7 @@ sub device_switch {
else {
$command = AttrVal( $hash->{NAME}, "offCmd", $command );
}
$command =~ s/@/$hash->{DEVICE}/gx;
$command =~ s/@/$hash->{DEVICE}/gxms;
$command = SemicolonEscape($command);
readingsSingleUpdate( $hash, 'LastCommand', $command, 1 );
Log3 $hash, 4, "[" . $hash->{NAME} . "]" . " command: $command";
......@@ -267,7 +283,7 @@ sub device_switch {
}
sub device_toggle {
my $hash = shift;
my $hash = shift // return;
my $name = $hash->{NAME};
#my $attrOffState = AttrVal($name,"offState",undef);
......@@ -277,8 +293,8 @@ sub device_toggle {
$status =
ReadingsVal( $hash->{DEVICE}, $hash->{helper}{offReading}, "off" );
my $attrOffState = $hash->{helper}{offRegex};
$status = $status =~ /^$attrOffState$/x ? "off" : lc($status);
$status = $status =~ /off/ ? "off" : "on";
$status = $status =~ m{^$attrOffState$}xms ? "off" : lc($status);
$status = $status =~ m{off}xms ? "off" : "on";
}
if ( $status ne "on" && $status ne "off" ) {
if ( $hash->{helper}{offRegex} ) {
......@@ -309,7 +325,7 @@ sub device_toggle {
}
sub disableDown {
my $hash = shift;
my $hash = shift // return;
my $disableCondCmd = AttrVal( $hash->{NAME}, "disableCondCmd", 0 );
if ( $disableCondCmd ne "none" ) {
......@@ -333,7 +349,7 @@ sub disableDown {
}
sub down {
my $hash = shift;
my $hash = shift // return;
Log3 $hash, 4,
"["
. $hash->{NAME} . "]"
......@@ -345,7 +361,7 @@ sub down {
}
sub Exec {
my $myHash = shift;
my $myHash = shift // return;
my $hash = GetHashIndirekt( $myHash, ( caller(0) )[3] );
return if ( !defined($hash) );
......@@ -452,7 +468,7 @@ sub Exec {
}
sub getSecsToNextAbschaltTest {
my $hash = shift;
my $hash = shift // return;
my $intervall = $hash->{helper}{TIMETOSWITCH};
my $varDuration = $hash->{helper}{VAR_DURATION};
my $nextSecs = $intervall + int( rand($varDuration) );
......@@ -465,14 +481,15 @@ sub getSecsToNextAbschaltTest {
}
sub isAktive {
my ($hash) = @_;
my $hash = shift // return;
return defined( $hash->{helper}{active} ) ? $hash->{helper}{active} : 0;
}
sub isDisabled {
my $hash = shift;
my $hash = shift // return;
my $disable = AttrVal( $hash->{NAME}, "disable", 0 );
my $disable =
IsDisabled( $hash->{NAME} ); #AttrVal($hash->{NAME}, "disable", 0 );
return $disable if ($disable);