Initial version
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@3 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
150
webfrontend/pgm3/docs/misc/99_ALARM.pm
Executable file
150
webfrontend/pgm3/docs/misc/99_ALARM.pm
Executable file
@@ -0,0 +1,150 @@
|
||||
##############################################
|
||||
# Low Budget ALARM System
|
||||
##############################################
|
||||
# ATTENTION! This is more a toy than a professional alarm system!
|
||||
# You must know what you do!
|
||||
##############################################
|
||||
#
|
||||
# Concept:
|
||||
# 1x Signal Light (FS20 allight) to show the status (activated/deactivated)
|
||||
# 2x Sirene (in/out) (FS20 alsir1 alsir2 )
|
||||
# 2x PIRI-2 (FS20 piriu pirio)
|
||||
# 1x Sender (FS20 alsw) to activate/deactivate the system.
|
||||
# Tip: use the KeyMatic CAC with pin code or
|
||||
# optional a normal sender (FS20 alsw2)
|
||||
#
|
||||
# Add something like the following lines to the configuration file :
|
||||
# notifyon alsw {MyAlsw()}
|
||||
# notifyon alsw2 {MyAlswNoPin()}
|
||||
# notifyon piriu {MyAlarm()}
|
||||
# notifyon pirio {MyAlarm()}
|
||||
# and put this file in the <modpath>/FHZ1000 directory.
|
||||
#
|
||||
# Martin Haas
|
||||
##############################################
|
||||
|
||||
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub
|
||||
ALARM_Initialize($$)
|
||||
{
|
||||
my ($hash, $init) = @_;
|
||||
$hash->{Type} = "none";
|
||||
}
|
||||
|
||||
|
||||
##############################################
|
||||
# Switching Alarm System on or off
|
||||
sub
|
||||
MyAlsw()
|
||||
{
|
||||
my $ON="set allight on; setstate alsw on";
|
||||
my $OFF="set allight off; set alsir1 off; set alsir2 off; setstate alsw off";
|
||||
|
||||
if ( -e "/var/tmp/alertsystem")
|
||||
{
|
||||
unlink "/var/tmp/alertsystem";
|
||||
#Paranoia
|
||||
for (my $i = 0; $i < 2; $i++ )
|
||||
{
|
||||
fhz "$OFF";
|
||||
};
|
||||
Log 2, "alarm system is OFF";
|
||||
} else {
|
||||
system "touch /var/tmp/alertsystem";
|
||||
#Paranoia
|
||||
for (my $i = 0; $i < 2; $i++ )
|
||||
{
|
||||
fhz "$ON"
|
||||
}
|
||||
Log 2, "alarm system is ON";
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
##############################################
|
||||
# If you have no Keymatic then use this workaround:
|
||||
# After 4x pushing a fs20-button within some seconds it will activate/deactivate the alarm system.
|
||||
sub
|
||||
MyAlswNoPin()
|
||||
{
|
||||
|
||||
my $timedout=5;
|
||||
|
||||
## first time
|
||||
if ( ! -e "/var/tmp/alontest1")
|
||||
{
|
||||
for (my $i = 1; $i < 4; $i++ )
|
||||
{
|
||||
system "touch -t 200601010101 /var/tmp/alontest$i";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## test 4 times
|
||||
my $now= `date +%s`;
|
||||
for (my $i = 1; $i < 4; $i++ )
|
||||
{
|
||||
my $tagx=`date -r /var/tmp/alontest$i +%s`;
|
||||
my $testx=$now-$tagx;
|
||||
|
||||
if ( $testx > $timedout )
|
||||
{
|
||||
system "touch /var/tmp/alontest$i";
|
||||
die "test$i: more than $timedout sec";
|
||||
}
|
||||
}
|
||||
system "touch -t 200601010101 /var/tmp/alontest*";
|
||||
Log 2, "ok, let's switch the alarm system...";
|
||||
|
||||
#if you only allow to activate (and not deactivate) with this script:
|
||||
# if ( -e "/var/tmp/alertsystem") { die "deactivating alarm system not allowed"};
|
||||
|
||||
MyAlsw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
##############################################
|
||||
# ALARM! Do what you want!
|
||||
sub
|
||||
MyAlarm()
|
||||
{
|
||||
|
||||
#alarm-system activated??
|
||||
if ( -e "/var/tmp/alertsystem")
|
||||
{
|
||||
|
||||
my $timer=180; # time until the sirene will be quiet
|
||||
my $ON1="set alsir1 on-for-timer $timer";
|
||||
my $ON2="set alsir2 on-for-timer $timer";
|
||||
|
||||
|
||||
#Paranoia
|
||||
for (my $i = 0; $i < 2; $i++ )
|
||||
{
|
||||
fhz "$ON1";
|
||||
fhz "$ON2";
|
||||
}
|
||||
Log 2, "ALARM! #################" ;
|
||||
|
||||
|
||||
# have fun
|
||||
my @lights=("stuwz1", "stuwz2", "nachto", "nachtu", "stoliba" ,"stlileo");
|
||||
my @rollos=("rolu4", "rolu5", "roloadi", "rololeo", "roloco", "rolowz", "rolunik1", "rolunik2");
|
||||
|
||||
foreach my $light (@lights) {
|
||||
fhz "set $light on"
|
||||
}
|
||||
|
||||
foreach my $rollo (@rollos) {
|
||||
fhz "set $rollo on"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
80
webfrontend/pgm3/docs/misc/99_FHTswitch.pm
Normal file
80
webfrontend/pgm3/docs/misc/99_FHTswitch.pm
Normal file
@@ -0,0 +1,80 @@
|
||||
##############################################
|
||||
# Switching the FHTs with e.g. a Button
|
||||
##############################################
|
||||
|
||||
# This is only an example.
|
||||
|
||||
# After pressing e.g. a button it will change the values
|
||||
# of desired-temp against the value of windowopen-temp
|
||||
|
||||
# With small changes it is possible to change e.g. all FHTs to
|
||||
# 2 degrees less if you are leaving the house and activating
|
||||
# the alarm system.
|
||||
|
||||
# Don't change the values very often within a time because the FHT seems
|
||||
# to hang if there are too much values within a time.
|
||||
#
|
||||
# Add something like the following lines to the configuration file :
|
||||
# notifyon NameOfButton {MyFHTswitch("NameOfFHT")}
|
||||
# and put this file in the <modpath>/FHZ1000 directory.
|
||||
|
||||
|
||||
# Martin Haas
|
||||
##############################################
|
||||
|
||||
|
||||
package main;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
|
||||
|
||||
sub
|
||||
FHTswitch_Initialize($)
|
||||
{
|
||||
# my ($hash) = @_; ## for fhz1000 >3.0
|
||||
# $hash->{Category} = "none"; ## for fhz1000 >3.0
|
||||
|
||||
my ($hash, $init) = @_; ## for fhz1000 <=3.0
|
||||
$hash->{Type} = "none"; ## for fhz1000 <=3.0
|
||||
}
|
||||
|
||||
|
||||
|
||||
###### ok, let's learn perl ;-)...
|
||||
sub
|
||||
MyFHTswitch($)
|
||||
{
|
||||
my $str;
|
||||
my $fhtorder;
|
||||
my @a = @_;
|
||||
my $fht=$a[0];
|
||||
my @windowopentemp;
|
||||
my @desiredtemp;
|
||||
|
||||
no strict "refs";
|
||||
$str = &{$devmods{$defs{$a[0]}{TYPE}}{ListFn}}($defs{$a[0]});
|
||||
my @lines = split("\n", $str);
|
||||
use strict "refs";
|
||||
|
||||
foreach my $l (@lines) {
|
||||
my ($date, $time, $attr, $val) = split(" ", $l, 4);
|
||||
if($attr eq "desired-temp")
|
||||
{
|
||||
Log 3, "old $attr of $a[0]: $val";
|
||||
@desiredtemp = split(" ", $val);
|
||||
}
|
||||
if($attr eq "windowopen-temp")
|
||||
{
|
||||
Log 3, "old $attr of $a[0]: $val";
|
||||
@windowopentemp = split(" ", $val);
|
||||
}
|
||||
}
|
||||
$fhtorder="set $fht desired-temp $windowopentemp[0] ";
|
||||
fhz "$fhtorder";
|
||||
$fhtorder="set $fht windowopen-temp $desiredtemp[0] ";
|
||||
fhz "$fhtorder";
|
||||
fhz "set $fht refreshvalues";
|
||||
}
|
||||
|
||||
1;
|
||||
4
webfrontend/pgm3/docs/misc/README
Normal file
4
webfrontend/pgm3/docs/misc/README
Normal file
@@ -0,0 +1,4 @@
|
||||
These are some Modules for the fhz1000.pl.
|
||||
Read the docu from fhz1000 howto intall them.
|
||||
|
||||
They are intended as an example.
|
||||
Reference in New Issue
Block a user