mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 16:56:54 +00:00
Alarm.pm: catch stupid configuration errors
OWMULTI.pm: bugfix of warning http://forum.fhem.de/index.php/topic,28047.0.html git-svn-id: https://svn.fhem.de/fhem/trunk@6789 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
d0d92d0ae3
commit
f5113cc1ea
@ -82,7 +82,7 @@ no warnings 'deprecated';
|
||||
|
||||
sub Log($$);
|
||||
|
||||
my $owx_version="5.20";
|
||||
my $owx_version="5.22";
|
||||
#-- flexible channel name
|
||||
my $owg_channel;
|
||||
|
||||
@ -189,7 +189,7 @@ sub OWMULTI_Attr(@) {
|
||||
}
|
||||
}
|
||||
last;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
@ -290,6 +290,14 @@ sub OWMULTI_Define ($$) {
|
||||
return undef;
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWMULTI_Notify - implements the Notify Function
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWMULTI_Notify ($$) {
|
||||
my ($hash,$dev) = @_;
|
||||
if( grep(m/^(INITIALIZED|REREADCFG)$/, @{$dev->{CHANGED}}) ) {
|
||||
@ -298,6 +306,14 @@ sub OWMULTI_Notify ($$) {
|
||||
}
|
||||
}
|
||||
|
||||
########################################################################################
|
||||
#
|
||||
# OWMULTI_Init - implements the Init function
|
||||
#
|
||||
# Parameter hash = hash of device addressed
|
||||
#
|
||||
########################################################################################
|
||||
|
||||
sub OWMULTI_Init ($) {
|
||||
my ($hash)=@_;
|
||||
#-- Start timer for updates
|
||||
@ -343,6 +359,7 @@ sub OWMULTI_ChannelNames($) {
|
||||
|
||||
#-- put into readings
|
||||
$owg_channel = $cnama[0];
|
||||
$hash->{READINGS}{$owg_channel}{VAL} = " ";
|
||||
$hash->{READINGS}{$owg_channel}{TYPE} = $cnama[1];
|
||||
$hash->{READINGS}{$owg_channel}{UNIT} = $unarr[0];
|
||||
$hash->{READINGS}{$owg_channel}{UNITABBR} = $unarr[1];
|
||||
@ -354,12 +371,12 @@ sub OWMULTI_ChannelNames($) {
|
||||
$tfactor = 1.0;
|
||||
|
||||
if( $tunit eq "Celsius" ){
|
||||
$tabbr = "°C";
|
||||
$tabbr = "°C";
|
||||
} elsif ($tunit eq "Kelvin" ){
|
||||
$tabbr = "K";
|
||||
$toffset += "273.16"
|
||||
} elsif ($tunit eq "Fahrenheit" ){
|
||||
$tabbr = "°F";
|
||||
$tabbr = "°F";
|
||||
$toffset = ($toffset+32)/1.8;
|
||||
$tfactor = 1.8;
|
||||
} else {
|
||||
@ -418,7 +435,7 @@ sub OWMULTI_FormatValues($) {
|
||||
} elsif( $vfunc ne "" ){
|
||||
$vval = int( $vfunc*1000 )/1000;
|
||||
} else {
|
||||
|
||||
#-- todo ?
|
||||
}
|
||||
|
||||
#-- string buildup for return value, STATE
|
||||
|
@ -40,7 +40,7 @@ my $alarmname = "Alarms"; # link text
|
||||
my $alarmhiddenroom = "AlarmRoom"; # hidden room
|
||||
my $alarmpublicroom = "Alarm"; # public room
|
||||
my $alarmno = 8;
|
||||
my $alarmversion = "1.6";
|
||||
my $alarmversion = "1.7";
|
||||
|
||||
#########################################################################################
|
||||
#
|
||||
@ -300,6 +300,7 @@ sub Alarm_Exec($$$$$){
|
||||
if( ($ntp <= $etp) && ($ntp >= $stp) ){
|
||||
#-- raised by sensor (attribute values have been controlled in CreateNotifiers)
|
||||
@sta = split('\|', AttrVal($dev, "alarmSettings", 0));
|
||||
if( $sta[2] ){
|
||||
$mga = $sta[2]." ".AttrVal($name, "level".$level."msg", 0);
|
||||
#-- replace some parts
|
||||
my @evtpart = split(" ",$evt);
|
||||
@ -318,6 +319,10 @@ sub Alarm_Exec($$$$$){
|
||||
$cmd = AttrVal($name, "level".$level."onact", 0);
|
||||
fhem($cmd);
|
||||
Log3 $hash,3,$msg;
|
||||
}else{
|
||||
$msg = "[Alarm $level] not raised, alarmSensor $dev has wrong settings";
|
||||
Log3 $hash,1,$msg;
|
||||
}
|
||||
}else{
|
||||
$msg = "[Alarm $level] not raised, not in time slot";
|
||||
Log3 $hash,5,$msg;
|
||||
|
Loading…
x
Reference in New Issue
Block a user