mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
95_Alarm.pm: Neue Version, Bugfix disarm während armwait
95_Babble.pm: Neue Version, Räume können ausgeschlossen werden 95_YAAHM.pm: Neue Version, ein paar kleinere Fixes git-svn-id: https://svn.fhem.de/fhem/trunk@15981 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
5c16ec80e0
commit
e732a00ec6
@ -43,7 +43,7 @@ my $alarmlinkname = "Alarms"; # link text
|
|||||||
my $alarmhiddenroom = "AlarmRoom"; # hidden room
|
my $alarmhiddenroom = "AlarmRoom"; # hidden room
|
||||||
my $alarmpublicroom = "Alarm"; # public room
|
my $alarmpublicroom = "Alarm"; # public room
|
||||||
my $alarmno = 8;
|
my $alarmno = 8;
|
||||||
my $alarmversion = "4.0";
|
my $alarmversion = "4.01";
|
||||||
|
|
||||||
my %alarm_transtable_EN = (
|
my %alarm_transtable_EN = (
|
||||||
"ok" => "OK",
|
"ok" => "OK",
|
||||||
@ -805,10 +805,13 @@ sub Alarm_Arm($$$$$){
|
|||||||
#-- disarming implies canceling as well
|
#-- disarming implies canceling as well
|
||||||
}elsif( ($act eq "disarm") && ($xec ne "disarmed")) {
|
}elsif( ($act eq "disarm") && ($xec ne "disarmed")) {
|
||||||
#-- delete stale delayed arm
|
#-- delete stale delayed arm
|
||||||
fhem('delete alarm'.$level.'.arm.dly' )
|
if( defined $defs{'alarm'.$level.'.arm.dly'}){
|
||||||
if( defined $defs{'alarm'.$level.'.arm.dly'});
|
fhem('delete alarm'.$level.'.arm.dly' )
|
||||||
|
#-- really kill active alarm
|
||||||
|
}else{
|
||||||
|
Alarm_Exec($name,$level,"program","disarm","cancel");
|
||||||
|
}
|
||||||
$hash->{DATA}{"armstate"}{"level".$level} = "disarmed";
|
$hash->{DATA}{"armstate"}{"level".$level} = "disarmed";
|
||||||
Alarm_Exec($name,$level,"program","disarm","cancel");
|
|
||||||
#-- update state display
|
#-- update state display
|
||||||
readingsSingleUpdate( $hash, "level".$level,"disarmed",1 );
|
readingsSingleUpdate( $hash, "level".$level,"disarmed",1 );
|
||||||
readingsSingleUpdate( $hash, "state", Alarm_getstate($hash)." ".$hash->{READINGS}{"short"}{VAL}, 1 );
|
readingsSingleUpdate( $hash, "state", Alarm_getstate($hash)." ".$hash->{READINGS}{"short"}{VAL}, 1 );
|
||||||
|
@ -42,7 +42,7 @@ use JSON; # imports encode_json, decode_json, to_json and from_json.
|
|||||||
my $babblelinkname = "babbles"; # link text
|
my $babblelinkname = "babbles"; # link text
|
||||||
my $babblehiddenroom = "babbleRoom"; # hidden room
|
my $babblehiddenroom = "babbleRoom"; # hidden room
|
||||||
my $babblepublicroom = "babble"; # public room
|
my $babblepublicroom = "babble"; # public room
|
||||||
my $babbleversion = "1.01";
|
my $babbleversion = "1.06";
|
||||||
|
|
||||||
my %babble_transtable_EN = (
|
my %babble_transtable_EN = (
|
||||||
"ok" => "OK",
|
"ok" => "OK",
|
||||||
@ -166,7 +166,7 @@ sub Babble_Initialize ($) {
|
|||||||
#$hash->{AttrFn} = "Babble_Attr";
|
#$hash->{AttrFn} = "Babble_Attr";
|
||||||
my $attst = "lockstate:locked,unlocked helpFunc testParm0 testParm1 testParm2 testParm3 ".
|
my $attst = "lockstate:locked,unlocked helpFunc testParm0 testParm1 testParm2 testParm3 ".
|
||||||
"remoteFHEM0 remoteFHEM1 remoteFHEM2 remoteFHEM3 remoteFunc0 remoteFunc1 remoteFunc2 remoteFunc3 remoteToken0 remoteToken1 remoteToken2 remoteToken3 ".
|
"remoteFHEM0 remoteFHEM1 remoteFHEM2 remoteFHEM3 remoteFunc0 remoteFunc1 remoteFunc2 remoteFunc3 remoteToken0 remoteToken1 remoteToken2 remoteToken3 ".
|
||||||
"babbleDevices babblePlaces babbleVerbs babbleVerbParts babblePrepos babbleQuests babbleArticles babbleStatus babbleWrites babbleTimes";
|
"babbleDevices babblePlaces babbleNotPlaces babbleVerbs babbleVerbParts babblePrepos babbleQuests babbleArticles babbleStatus babbleWrites babbleTimes";
|
||||||
$hash->{AttrList} = $attst;
|
$hash->{AttrList} = $attst;
|
||||||
|
|
||||||
if( !defined($babble_tt) ){
|
if( !defined($babble_tt) ){
|
||||||
@ -790,7 +790,7 @@ sub Babble_Normalize($$){
|
|||||||
if( $word[0] =~ /^gut.*/){
|
if( $word[0] =~ /^gut.*/){
|
||||||
$subcat = 1;
|
$subcat = 1;
|
||||||
$device="zeit";
|
$device="zeit";
|
||||||
$reading="zeit";
|
$reading="status";
|
||||||
$value=$word[1];
|
$value=$word[1];
|
||||||
$reserve=$word[2]
|
$reserve=$word[2]
|
||||||
if( $word[2] );
|
if( $word[2] );
|
||||||
@ -1065,7 +1065,7 @@ sub Babble_TestIt{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}elsif( $exflag==1 ){
|
||||||
my $func = AttrVal($name,"helpFunc",undef);
|
my $func = AttrVal($name,"helpFunc",undef);
|
||||||
if( $func && $func ne "" ){
|
if( $func && $func ne "" ){
|
||||||
my $help = defined($hash->{DATA}{"help"}{$device}) ? $hash->{DATA}{"help"}{$device} : "";
|
my $help = defined($hash->{DATA}{"help"}{$device}) ? $hash->{DATA}{"help"}{$device} : "";
|
||||||
@ -1081,7 +1081,11 @@ sub Babble_TestIt{
|
|||||||
}
|
}
|
||||||
$func =~ s/\$HELP/$help/g;
|
$func =~ s/\$HELP/$help/g;
|
||||||
$res = eval($func);
|
$res = eval($func);
|
||||||
|
}else{
|
||||||
|
$str .= "==> command not found and help function undefined";
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$str .= "==> command not found";
|
||||||
}
|
}
|
||||||
return $str;
|
return $str;
|
||||||
}
|
}
|
||||||
@ -1532,6 +1536,8 @@ sub Babble_getplaces($$$) {
|
|||||||
my %rooms; # intermediate hash of all rooms
|
my %rooms; # intermediate hash of all rooms
|
||||||
my @special; # intermediate array of all special places for Babble
|
my @special; # intermediate array of all special places for Babble
|
||||||
my @places; # intermediate array of rooms/all babble places
|
my @places; # intermediate array of rooms/all babble places
|
||||||
|
|
||||||
|
my $nop = AttrVal($name,"babbleNotPlaces","");
|
||||||
|
|
||||||
#--generate a new list
|
#--generate a new list
|
||||||
if( $type eq "new" ){
|
if( $type eq "new" ){
|
||||||
@ -1543,6 +1549,7 @@ sub Babble_getplaces($$$) {
|
|||||||
foreach my $r (split(",", AttrVal($d, "room", "Unsorted"))) {
|
foreach my $r (split(",", AttrVal($d, "room", "Unsorted"))) {
|
||||||
next if($hre && $r =~ m/$hre/);
|
next if($hre && $r =~ m/$hre/);
|
||||||
next if($r eq "Unsorted" || $r eq "hidden" || $r eq $babblehiddenroom || $r eq $babblepublicroom );
|
next if($r eq "Unsorted" || $r eq "hidden" || $r eq $babblehiddenroom || $r eq $babblepublicroom );
|
||||||
|
next if (index($nop, $r) != -1);
|
||||||
$rooms{$r}{$d} = 1;
|
$rooms{$r}{$d} = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2025,6 +2032,8 @@ sub Babble_Html($)
|
|||||||
<br/>csrfToken for addressing a certain remote FHEM device</li>
|
<br/>csrfToken for addressing a certain remote FHEM device</li>
|
||||||
<li><a name="babblePlaces"><code>attr <name> babblePlaces <place_1> <place_2> ...</code></a>
|
<li><a name="babblePlaces"><code>attr <name> babblePlaces <place_1> <place_2> ...</code></a>
|
||||||
<br />space separated list of special places to be identified in speech</li>
|
<br />space separated list of special places to be identified in speech</li>
|
||||||
|
<li><a name="babbleNotPlaces"><code>attr <name> babbleNoPlaces <place_1> <place_2> ...</code></a>
|
||||||
|
<br />space separated list of rooms (in the local FHEM device) that should <i>not</i> appear in the list of place</li>
|
||||||
<li><a name="babbleStatus"><code>attr <name> babbleStatus <status_1> <status_2> ...</code></a>
|
<li><a name="babbleStatus"><code>attr <name> babbleStatus <status_1> <status_2> ...</code></a>
|
||||||
<br />space separated list of status identifiers to be identified in speech. Example: <code>Status Value Weather Time</code></li>
|
<br />space separated list of status identifiers to be identified in speech. Example: <code>Status Value Weather Time</code></li>
|
||||||
<li><a name="babblePrepos"><code>attr <name> babblePrepos <prepo_1> <prepo_2> ...</code></a>
|
<li><a name="babblePrepos"><code>attr <name> babblePrepos <prepo_1> <prepo_2> ...</code></a>
|
||||||
|
@ -47,7 +47,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.43";
|
my $yaahmversion = "1.45";
|
||||||
my $firstcall = 1;
|
my $firstcall = 1;
|
||||||
|
|
||||||
my %yaahm_transtable_EN = (
|
my %yaahm_transtable_EN = (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//########################################################################################
|
//########################################################################################
|
||||||
// alarm.js
|
// alarm.js
|
||||||
// Version 4.0
|
// Version 4.01
|
||||||
// See 95_Alarm for licensing
|
// See 95_Alarm for licensing
|
||||||
//########################################################################################
|
//########################################################################################
|
||||||
//# Prof. Dr. Peter A. Henning
|
//# Prof. Dr. Peter A. Henning
|
||||||
@ -13,6 +13,9 @@ var req = new XMLHttpRequest();
|
|||||||
req.open('GET', document.location, false);
|
req.open('GET', document.location, false);
|
||||||
req.send(null);
|
req.send(null);
|
||||||
var csrfToken = req.getResponseHeader('X-FHEM-csrfToken');
|
var csrfToken = req.getResponseHeader('X-FHEM-csrfToken');
|
||||||
|
if( csrfToken == null ){
|
||||||
|
csrfToken = "null";
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
// encode Parameters for URL
|
// encode Parameters for URL
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//########################################################################################
|
//########################################################################################
|
||||||
// babble.js
|
// babble.js
|
||||||
// Version 1.04
|
// Version 1.06
|
||||||
// See 95_Babble for licensing
|
// See 95_Babble for licensing
|
||||||
//########################################################################################
|
//########################################################################################
|
||||||
//# Prof. Dr. Peter A. Henning
|
//# Prof. Dr. Peter A. Henning
|
||||||
@ -13,6 +13,9 @@ var req = new XMLHttpRequest();
|
|||||||
req.open('GET', document.location, false);
|
req.open('GET', document.location, false);
|
||||||
req.send(null);
|
req.send(null);
|
||||||
var csrfToken = req.getResponseHeader('X-FHEM-csrfToken');
|
var csrfToken = req.getResponseHeader('X-FHEM-csrfToken');
|
||||||
|
if( csrfToken == null ){
|
||||||
|
csrfToken = "null";
|
||||||
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
// encode Parameters for URL
|
// encode Parameters for URL
|
||||||
@ -37,9 +40,6 @@ function encodeParm(oldval) {
|
|||||||
// Add and remove places and verbs
|
// Add and remove places and verbs
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function reload() {
|
|
||||||
//location.reload()
|
|
||||||
}
|
|
||||||
|
|
||||||
function dialog1(message) {
|
function dialog1(message) {
|
||||||
$('<div></div>').appendTo('body').html('<div><h6>' + message + '</h6></div>').dialog({
|
$('<div></div>').appendTo('body').html('<div><h6>' + message + '</h6></div>').dialog({
|
||||||
|
@ -1,10 +1,26 @@
|
|||||||
//########################################################################################
|
//########################################################################################
|
||||||
// yaahm.js
|
// yaahm.js
|
||||||
// Version 1.4
|
// Version 1.45
|
||||||
// See 95_YAAHM for licensing
|
// See 95_YAAHM for licensing
|
||||||
//########################################################################################
|
//########################################################################################
|
||||||
//# Prof. Dr. Peter A. Henning
|
//# Prof. Dr. Peter A. Henning
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
// Determine csrfToken
|
||||||
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
req.open('GET', document.location, false);
|
||||||
|
req.send(null);
|
||||||
|
var csrfToken = req.getResponseHeader('X-FHEM-csrfToken');
|
||||||
|
if( csrfToken == null ){
|
||||||
|
csrfToken = "null";
|
||||||
|
}
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
// encode Parameters for URL
|
||||||
|
//------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
function encodeParm(oldval) {
|
function encodeParm(oldval) {
|
||||||
var newval;
|
var newval;
|
||||||
newval = oldval.replace(/"/g, '%27');
|
newval = oldval.replace(/"/g, '%27');
|
||||||
@ -56,7 +72,7 @@ function yaahm_setAttribute(name, attr, val) {
|
|||||||
location = location.substr(0, location.length -1);
|
location = location.substr(0, location.length -1);
|
||||||
}
|
}
|
||||||
var url = document.location.protocol + "//" + document.location.host + location;
|
var url = document.location.protocol + "//" + document.location.host + location;
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + '=attr ' + name + ' ' + encodeParm(attr) + ' ' + encodeParm(val));
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + '=attr ' + name + ' ' + encodeParm(attr) + ' ' + encodeParm(val));
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
@ -73,7 +89,7 @@ function yaahm_mode(name, targetmode) {
|
|||||||
}
|
}
|
||||||
var url = document.location.protocol + "//" + document.location.host + location;
|
var url = document.location.protocol + "//" + document.location.host + location;
|
||||||
|
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + '={main::YAAHM_mode("' + name + '","' + targetmode + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + '={main::YAAHM_mode("' + name + '","' + targetmode + '")}');
|
||||||
}
|
}
|
||||||
|
|
||||||
function yaahm_state(name, targetstate) {
|
function yaahm_state(name, targetstate) {
|
||||||
@ -83,7 +99,7 @@ function yaahm_state(name, targetstate) {
|
|||||||
}
|
}
|
||||||
var url = document.location.protocol + "//" + document.location.host + location;
|
var url = document.location.protocol + "//" + document.location.host + location;
|
||||||
|
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + '={main::YAAHM_state("' + name + '","' + targetstate + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + '={main::YAAHM_state("' + name + '","' + targetstate + '")}');
|
||||||
}
|
}
|
||||||
|
|
||||||
function yaahm_setnext(name, i) {
|
function yaahm_setnext(name, i) {
|
||||||
@ -100,7 +116,7 @@ function yaahm_setnext(name, i) {
|
|||||||
nval = "undef";
|
nval = "undef";
|
||||||
}
|
}
|
||||||
|
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + '={main::YAAHM_nextWeeklyTime("' + name + '","next_' + i + '","' + nval + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + '={main::YAAHM_nextWeeklyTime("' + name + '","next_' + i + '","' + nval + '")}');
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------------------------
|
||||||
@ -287,11 +303,11 @@ function yaahm_startDayTimer(name) {
|
|||||||
aval2 = $("input[name='actid" + dailykeys[i] + "']:checked").map(function () {
|
aval2 = $("input[name='actid" + dailykeys[i] + "']:checked").map(function () {
|
||||||
return $(this).val();
|
return $(this).val();
|
||||||
}).get();
|
}).get();
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + '={main::YAAHM_setParm("' + name + '","dt","' + dailykeys[i] + '",' + '"' + sval + '","' + eval + '","' + xval + '","' + aval1 + ';' + aval2 + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + '={main::YAAHM_setParm("' + name + '","dt","' + dailykeys[i] + '",' + '"' + sval + '","' + eval + '","' + xval + '","' + aval1 + ';' + aval2 + '")}');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// really start it now
|
// really start it now
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + ' ={main::YAAHM_startDayTimer("' + name + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + ' ={main::YAAHM_startDayTimer("' + name + '")}');
|
||||||
|
|
||||||
// change link
|
// change link
|
||||||
$('#dtlink').html('<a href="/fhem?detail=' + name + '.dtimer.IF">' + name + '.dtimer.IF</a>');
|
$('#dtlink').html('<a href="/fhem?detail=' + name + '.dtimer.IF">' + name + '.dtimer.IF</a>');
|
||||||
@ -346,10 +362,10 @@ function yaahm_startWeeklyTimer(name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + '={main::YAAHM_setParm("' + name + '","wt","' + i + '","' + xval + '","' + nval + '","' + aval1 + '","' + aval2 + '","' + sval.join('","') + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + '={main::YAAHM_setParm("' + name + '","wt","' + i + '","' + xval + '","' + nval + '","' + aval1 + '","' + aval2 + '","' + sval.join('","') + '")}');
|
||||||
}
|
}
|
||||||
// really start it now
|
// really start it now
|
||||||
FW_cmd(url + '?XHR=1&cmd.' + name + ' ={main::YAAHM_startWeeklyTimer("' + name + '")}');
|
FW_cmd(url + '?XHR=1&fwcsrf=' + csrfToken + '&cmd.' + name + ' ={main::YAAHM_startWeeklyTimer("' + name + '")}');
|
||||||
|
|
||||||
// change links
|
// change links
|
||||||
for (var i = 0; i < weeklyno; i++) {
|
for (var i = 0; i < weeklyno; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user