mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +00:00
95_YAAHM.pm: Neue Version mit neuen Features
git-svn-id: https://svn.fhem.de/fhem/trunk@15419 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
12cb17ce7e
commit
fbf6806a59
@ -48,7 +48,7 @@ my $yaahmname;
|
|||||||
my $yaahmlinkname = "Profile"; # link text
|
my $yaahmlinkname = "Profile"; # link text
|
||||||
my $yaahmhiddenroom = "ProfileRoom"; # hidden room
|
my $yaahmhiddenroom = "ProfileRoom"; # hidden room
|
||||||
my $yaahmpublicroom = "Unsorted"; # public room
|
my $yaahmpublicroom = "Unsorted"; # public room
|
||||||
my $yaahmversion = "1.15";
|
my $yaahmversion = "1.16";
|
||||||
my $firstcall = 1;
|
my $firstcall = 1;
|
||||||
|
|
||||||
my %yaahm_transtable_EN = (
|
my %yaahm_transtable_EN = (
|
||||||
@ -59,8 +59,6 @@ my %yaahm_transtable_EN = (
|
|||||||
"notstarted" => "Not started",
|
"notstarted" => "Not started",
|
||||||
"next" => "Next",
|
"next" => "Next",
|
||||||
"manual" => "Manual Time",
|
"manual" => "Manual Time",
|
||||||
"waketime" => "Wakeup Time",
|
|
||||||
"sleeptime" => "Sleep Time",
|
|
||||||
"exceptly" => "exceptionally",
|
"exceptly" => "exceptionally",
|
||||||
"undecid" => "not decidable",
|
"undecid" => "not decidable",
|
||||||
"swoff" => "switched off",
|
"swoff" => "switched off",
|
||||||
@ -148,8 +146,6 @@ my %yaahm_transtable_EN = (
|
|||||||
"notstarted" => "Nicht gestartet",
|
"notstarted" => "Nicht gestartet",
|
||||||
"next" => "Nächste",
|
"next" => "Nächste",
|
||||||
"manual" => "Manuelle Zeit",
|
"manual" => "Manuelle Zeit",
|
||||||
"waketime" => "Weckzeit",
|
|
||||||
"sleeptime" => "Schlafenszeit",
|
|
||||||
"clock" => "Uhr",
|
"clock" => "Uhr",
|
||||||
"exceptly" => "ausnahmsweise",
|
"exceptly" => "ausnahmsweise",
|
||||||
"undecid" => "nicht bestimmbar",
|
"undecid" => "nicht bestimmbar",
|
||||||
@ -668,18 +664,18 @@ sub YAAHM_Set($@) {
|
|||||||
}
|
}
|
||||||
$cmd = "next_".$args[0];
|
$cmd = "next_".$args[0];
|
||||||
}else{
|
}else{
|
||||||
my $ifound = undef;
|
my $if = undef;
|
||||||
for( my $i=0;$i<int(@{$hash->{DATA}{"WT"}});$i++){
|
for( my $i=0;$i<int(@{$hash->{DATA}{"WT"}});$i++){
|
||||||
$ifound = $i
|
$if = $i
|
||||||
if ($hash->{DATA}{"WT"}[$i]{"name"} eq $args[0] );
|
if ($hash->{DATA}{"WT"}[$i]{"name"} eq $args[0] );
|
||||||
};
|
};
|
||||||
#-- check if valid
|
#-- check if valid
|
||||||
if( !defined($ifound) ){
|
if( !defined($if) ){
|
||||||
$msg = "Error: timer name ".$args[0]." not found";
|
$msg = "Error: timer name ".$args[0]." not found";
|
||||||
Log3 $name,1,"[YAAHM_Set] ".$msg;
|
Log3 $name,1,"[YAAHM_Set] ".$msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
$cmd = "next_".$ifound;
|
$cmd = "next_".$if;
|
||||||
}
|
}
|
||||||
return YAAHM_nextWeeklyTime($name,$cmd,$args[1],$exec);
|
return YAAHM_nextWeeklyTime($name,$cmd,$args[1],$exec);
|
||||||
|
|
||||||
@ -777,7 +773,7 @@ sub YAAHM_Set($@) {
|
|||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
#
|
#
|
||||||
# YAAHM_Set - Implements the Get function
|
# YAAHM_Get - Implements the Get function
|
||||||
#
|
#
|
||||||
# Parameter hash = hash of device addressed
|
# Parameter hash = hash of device addressed
|
||||||
#
|
#
|
||||||
@ -831,12 +827,13 @@ sub YAAHM_Get($@) {
|
|||||||
" my \$time = ReadingsVal(\"".$name."\",\"housetime\",\"\");\n".
|
" my \$time = ReadingsVal(\"".$name."\",\"housetime\",\"\");\n".
|
||||||
" my \$phase = ReadingsVal(\"".$name."\",\"housephase\",\"\");\n".
|
" my \$phase = ReadingsVal(\"".$name."\",\"housephase\",\"\");\n".
|
||||||
" my \$state = ReadingsVal(\"".$name."\",\"housestate\",\"\");\n".
|
" my \$state = ReadingsVal(\"".$name."\",\"housestate\",\"\");\n".
|
||||||
" my \$party = (ReadingsVal(\"".$name."\",\"housemode\",\"\")) eq \"party\") ? 1 : 0;\n".
|
" my \$party = (ReadingsVal(\"".$name."\",\"housemode\",\"\") eq \"party\") ? 1 : 0;\n".
|
||||||
" my \$absence = (ReadingsVal(\"".$name."\",\"housemode\",\"\")) eq \"absence\") ? 1 : 0;\n".
|
" my \$absence = (ReadingsVal(\"".$name."\",\"housemode\",\"\") eq \"absence\") ? 1 : 0;\n".
|
||||||
|
" my \$dndist = (ReadingsVal(\"".$name."\",\"housemode\",\"\") eq \"donotdisturb\") ? 1 : 0;\n".
|
||||||
" my \$todaytype = ReadingsVal(\"".$name."\",\"tr_todayType\",\"\");\n".
|
" my \$todaytype = ReadingsVal(\"".$name."\",\"tr_todayType\",\"\");\n".
|
||||||
" my \$todaydesc = ReadingsVal(\"".$name."\",\"todayDesc\",\"\")\n".
|
" my \$todaydesc = ReadingsVal(\"".$name."\",\"todayDesc\",\"\");\n".
|
||||||
" my \$tomorrowtype = ReadingsVal(\"".$name."\",\"tr_tomorrowType\",\"\");\n".
|
" my \$tomorrowtype = ReadingsVal(\"".$name."\",\"tr_tomorrowType\",\"\");\n".
|
||||||
" my \$tomorrowdesc = ReadingsVal(\"".$name."\",\"tomorrowDesc\",\"\")\n";
|
" my \$tomorrowdesc = ReadingsVal(\"".$name."\",\"tomorrowDesc\",\"\");\n";
|
||||||
#-- iterate through table
|
#-- iterate through table
|
||||||
foreach my $key (sort YAAHM_dsort keys %dailytable){
|
foreach my $key (sort YAAHM_dsort keys %dailytable){
|
||||||
$res .= " #---------------------------------------------------------------------\n";
|
$res .= " #---------------------------------------------------------------------\n";
|
||||||
@ -850,8 +847,9 @@ sub YAAHM_Get($@) {
|
|||||||
" my \$time = ReadingsVal(\"".$name."\",\"housetime\",\"\");\n".
|
" my \$time = ReadingsVal(\"".$name."\",\"housetime\",\"\");\n".
|
||||||
" my \$phase = ReadingsVal(\"".$name."\",\"housephase\",\"\");\n".
|
" my \$phase = ReadingsVal(\"".$name."\",\"housephase\",\"\");\n".
|
||||||
" my \$state = ReadingsVal(\"".$name."\",\"housestate\",\"\");\n".
|
" my \$state = ReadingsVal(\"".$name."\",\"housestate\",\"\");\n".
|
||||||
" my \$party = (ReadingsVal(\"".$name."\",\"housemode\",\"\")) eq \"party\") ? 1 : 0;\n".
|
" my \$party = (ReadingsVal(\"".$name."\",\"housemode\",\"\") eq \"party\") ? 1 : 0;\n".
|
||||||
" my \$absence = (ReadingsVal(\"".$name."\",\"housemode\",\"\")) eq \"absence\") ? 1 : 0;\n";
|
" my \$absence = (ReadingsVal(\"".$name."\",\"housemode\",\"\") eq \"absence\") ? 1 : 0;\n".
|
||||||
|
" my \$dndist = (ReadingsVal(\"".$name."\",\"housemode\",\"\") eq \"donotdisturb\") ? 1 : 0;\n";
|
||||||
#-- iterate through table
|
#-- iterate through table
|
||||||
for( my $i=0;$i<int(@states);$i++) {
|
for( my $i=0;$i<int(@states);$i++) {
|
||||||
$res .= " #---------------------------------------------------------------------\n";
|
$res .= " #---------------------------------------------------------------------\n";
|
||||||
@ -1236,11 +1234,6 @@ sub YAAHM_mode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$hash->{DATA}{"HSM"}{"mode"} = $targetmode;
|
$hash->{DATA}{"HSM"}{"mode"} = $targetmode;
|
||||||
readingsBeginUpdate($hash);
|
|
||||||
readingsBulkUpdate($hash,"prev_housemode",$prevmode);
|
|
||||||
readingsBulkUpdate($hash,"housemode",$targetmode);
|
|
||||||
readingsBulkUpdate($hash,"tr_housemode",$yaahm_tt->{$targetmode});
|
|
||||||
readingsEndUpdate($hash,1);
|
|
||||||
|
|
||||||
#-- doit, if not simulation
|
#-- doit, if not simulation
|
||||||
if (defined($attr{$name}{"modeHelper"})){
|
if (defined($attr{$name}{"modeHelper"})){
|
||||||
@ -1252,6 +1245,13 @@ sub YAAHM_mode {
|
|||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
readingsBeginUpdate($hash);
|
||||||
|
readingsBulkUpdate($hash,"prev_housemode",$prevmode);
|
||||||
|
readingsBulkUpdate($hash,"housemode",$targetmode);
|
||||||
|
readingsBulkUpdate($hash,"tr_housemode",$yaahm_tt->{$targetmode});
|
||||||
|
readingsEndUpdate($hash,1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
@ -1286,15 +1286,6 @@ sub YAAHM_state {
|
|||||||
Log3 $name,1,"[YAAHM_state] ".$msg;
|
Log3 $name,1,"[YAAHM_state] ".$msg;
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
$hash->{DATA}{"HSM"}{"state"} = $targetstate;
|
|
||||||
readingsBeginUpdate($hash);
|
|
||||||
readingsBulkUpdate($hash,"prev_housestate",$prevstate);
|
|
||||||
readingsBulkUpdate($hash,"housestate",$targetstate);
|
|
||||||
readingsBulkUpdate($hash,"tr_housestate",$yaahm_tt->{$targetstate});
|
|
||||||
readingsEndUpdate($hash,1);
|
|
||||||
|
|
||||||
YAAHM_InternalTimer("check",time()+ 30, "YAAHM_checkstate", $hash, 0);
|
|
||||||
|
|
||||||
#-- doit, if not simulation
|
#-- doit, if not simulation
|
||||||
if (defined($attr{$name}{"stateHelper"})){
|
if (defined($attr{$name}{"stateHelper"})){
|
||||||
@ -1306,6 +1297,16 @@ sub YAAHM_state {
|
|||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$hash->{DATA}{"HSM"}{"state"} = $targetstate;
|
||||||
|
readingsBeginUpdate($hash);
|
||||||
|
readingsBulkUpdate($hash,"prev_housestate",$prevstate);
|
||||||
|
readingsBulkUpdate($hash,"housestate",$targetstate);
|
||||||
|
readingsBulkUpdate($hash,"tr_housestate",$yaahm_tt->{$targetstate});
|
||||||
|
readingsEndUpdate($hash,1);
|
||||||
|
|
||||||
|
YAAHM_InternalTimer("check",time()+ 30, "YAAHM_checkstate", $hash, 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
@ -1743,8 +1744,6 @@ sub YAAHM_setWeeklyTime($) {
|
|||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
YAAHM_sayWeeklyTime($hash,$i,0);
|
YAAHM_sayWeeklyTime($hash,$i,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#########################################################################################
|
#########################################################################################
|
||||||
@ -1772,18 +1771,11 @@ sub YAAHM_sayWeeklyTime($$$) {
|
|||||||
$tod = $hash->{DATA}{"WT"}[$timer]{"ring_0"};
|
$tod = $hash->{DATA}{"WT"}[$timer]{"ring_0"};
|
||||||
$tom = $hash->{DATA}{"WT"}[$timer]{"ring_1"};
|
$tom = $hash->{DATA}{"WT"}[$timer]{"ring_1"};
|
||||||
$ton = $hash->{DATA}{"WT"}[$timer]{"next"};
|
$ton = $hash->{DATA}{"WT"}[$timer]{"next"};
|
||||||
|
$msg = $hash->{DATA}{"WT"}[$timer]{"name"};
|
||||||
|
|
||||||
($hl,$ml) = split(':',strftime('%H:%M', localtime(time)));
|
($hl,$ml) = split(':',strftime('%H:%M', localtime(time)));
|
||||||
$tl = 60*$hl+$ml;
|
$tl = 60*$hl+$ml;
|
||||||
|
|
||||||
if( $timer == 0){
|
|
||||||
$msg = $yaahm_tt->{"waketime"}
|
|
||||||
}elsif( $timer == 1){
|
|
||||||
$msg = $yaahm_tt->{"sleeptime"}
|
|
||||||
}else{
|
|
||||||
$msg = $yaahm_tt->{"timer"}." $timer";
|
|
||||||
}
|
|
||||||
|
|
||||||
#-- today off AND tomorrow any time, off or special time
|
#-- today off AND tomorrow any time, off or special time
|
||||||
if( $tod eq "off" ){
|
if( $tod eq "off" ){
|
||||||
#-- special time
|
#-- special time
|
||||||
|
Loading…
x
Reference in New Issue
Block a user