mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 10:46:53 +00:00
70_DoorPi.pm: Neue Version mit verbesserten Features
git-svn-id: https://svn.fhem.de/fhem/trunk@14169 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3faf8b1e48
commit
fc6a7cb8a0
@ -41,7 +41,7 @@ use vars qw{%attr %defs};
|
|||||||
sub Log($$);
|
sub Log($$);
|
||||||
|
|
||||||
#-- globals on start
|
#-- globals on start
|
||||||
my $version = "2.0alpha9";
|
my $version = "2.0alpha10";
|
||||||
|
|
||||||
#-- these we may get on request
|
#-- these we may get on request
|
||||||
my %gets = (
|
my %gets = (
|
||||||
@ -223,10 +223,12 @@ sub DoorPi_Set ($@) {
|
|||||||
#-- if only hash as parameter, this is acting as timer callback
|
#-- if only hash as parameter, this is acting as timer callback
|
||||||
if( !@a ){
|
if( !@a ){
|
||||||
Log 5,"[DoorPi_Set] delayed action started with ".$hash->{DELAYED};
|
Log 5,"[DoorPi_Set] delayed action started with ".$hash->{DELAYED};
|
||||||
|
#-- delayed switching off light
|
||||||
if( $hash->{DELAYED} eq "light"){
|
if( $hash->{DELAYED} eq "light"){
|
||||||
@a=($hash->{NAME},"light","off");
|
@a=($hash->{NAME},"light","off");
|
||||||
|
#-- delayed door opening
|
||||||
}elsif( $hash->{DELAYED} eq "door_time"){
|
}elsif( $hash->{DELAYED} eq "door_time"){
|
||||||
@a=($hash->{NAME},"door","opened");
|
@a=($hash->{NAME},"door","open");
|
||||||
}
|
}
|
||||||
$hash->{DELAYED} = "";
|
$hash->{DELAYED} = "";
|
||||||
}
|
}
|
||||||
@ -236,7 +238,7 @@ sub DoorPi_Set ($@) {
|
|||||||
|
|
||||||
#-- commands
|
#-- commands
|
||||||
my $door = AttrVal($name, "doorbutton", "door");
|
my $door = AttrVal($name, "doorbutton", "door");
|
||||||
my $doorsubs = "opened";
|
my $doorsubs = "open,opened";
|
||||||
$doorsubs .= ",locked"
|
$doorsubs .= ",locked"
|
||||||
if(AttrVal($name, "doorlockcmd",undef));
|
if(AttrVal($name, "doorlockcmd",undef));
|
||||||
$doorsubs .= ",unlocked"
|
$doorsubs .= ",unlocked"
|
||||||
@ -259,6 +261,7 @@ sub DoorPi_Set ($@) {
|
|||||||
$newkeys = join(" ",@{ $hash->{HELPER}->{CMDS} });
|
$newkeys = join(" ",@{ $hash->{HELPER}->{CMDS} });
|
||||||
#Log3 $name, 1,"=====> newkeys before subs $newkeys";
|
#Log3 $name, 1,"=====> newkeys before subs $newkeys";
|
||||||
$newkeys =~ s/$door/$door:$doorsubs/; # FHEMWEB sugar
|
$newkeys =~ s/$door/$door:$doorsubs/; # FHEMWEB sugar
|
||||||
|
$newkeys =~ s/,opened//; # FHEMWEB sugar
|
||||||
$newkeys =~ s/\s$light/ $light:on,on-for-timer,off/; # FHEMWEB sugar
|
$newkeys =~ s/\s$light/ $light:on,on-for-timer,off/; # FHEMWEB sugar
|
||||||
$newkeys =~ s/$dashlight/$dashlight:on,off/; # FHEMWEB sugar
|
$newkeys =~ s/$dashlight/$dashlight:on,off/; # FHEMWEB sugar
|
||||||
$newkeys =~ s/$stream/$stream:on,off/; # FHEMWEB sugar
|
$newkeys =~ s/$stream/$stream:on,off/; # FHEMWEB sugar
|
||||||
@ -434,18 +437,23 @@ sub DoorPi_Door {
|
|||||||
my $door = AttrVal($name, "doorbutton", "door");
|
my $door = AttrVal($name, "doorbutton", "door");
|
||||||
my $lockstate = DoorPi_GetLockstate($hash);
|
my $lockstate = DoorPi_GetLockstate($hash);
|
||||||
|
|
||||||
#-- BRANCH 1: opened from FHEM, door opening, forward to DoorPi
|
#-- "opened" => BRANCH 1.1: opening confirmation from DoorPi
|
||||||
if( (($cmd) && ($cmd eq "opened")) || ((!$cmd) && ($hash->{DELAYED} =~ /^open.*/)) ){
|
if( ($cmd) && ($cmd eq "opened") ){
|
||||||
|
Log3 $name, 1,"[DoorPi_Door 1.1] received 'door opened' confirmation from DoorPi";
|
||||||
|
readingsSingleUpdate($hash,$door,"opened",1);
|
||||||
|
|
||||||
|
#-- "open" => BRANCH 1.0: door opening from FHEM, forward to DoorPi
|
||||||
|
}elsif( (($cmd) && ($cmd eq "open")) || ((!$cmd) && ($hash->{DELAYED} =~ /^open.*/)) ){
|
||||||
$hash->{DELAYED} = "";
|
$hash->{DELAYED} = "";
|
||||||
#-- doit
|
#-- doit
|
||||||
$v=DoorPi_Cmd($hash,"dooropen");
|
$v=DoorPi_Cmd($hash,"dooropen");
|
||||||
Log3 $name, 1,"[DoorPi_Door 1] sent 'dooropen' command to DoorPi";
|
Log3 $name, 1,"[DoorPi_Door 1.0] sent 'dooropen' command to DoorPi";
|
||||||
readingsSingleUpdate($hash,$door,"opened",1);
|
readingsSingleUpdate($hash,$door,"opened (pending)",0);
|
||||||
#-- extra fhem command
|
#-- extra fhem command
|
||||||
$fhemcmd = AttrVal($name, "dooropencmd",undef);
|
$fhemcmd = AttrVal($name, "dooropencmd",undef);
|
||||||
fhem($fhemcmd)
|
fhem($fhemcmd)
|
||||||
if($fhemcmd);
|
if($fhemcmd);
|
||||||
|
|
||||||
#-- BRANCH 2: unlockandopen from DoorPi: door has to be unlocked if necessary
|
#-- BRANCH 2: unlockandopen from DoorPi: door has to be unlocked if necessary
|
||||||
}elsif( $cmd eq "unlockandopen" ){
|
}elsif( $cmd eq "unlockandopen" ){
|
||||||
#-- unlocking the door now, delayed opening
|
#-- unlocking the door now, delayed opening
|
||||||
@ -478,10 +486,10 @@ sub DoorPi_Door {
|
|||||||
}elsif ($lockstate =~ /^unlocked.*/){
|
}elsif ($lockstate =~ /^unlocked.*/){
|
||||||
Log3 $name, 1,"[DoorPi_Door] BRANCH 2.2 cmd=$cmd lockstate=$lockstate";
|
Log3 $name, 1,"[DoorPi_Door] BRANCH 2.2 cmd=$cmd lockstate=$lockstate";
|
||||||
#-- doit
|
#-- doit
|
||||||
$v=DoorPi_Cmd($hash,"doorunlocked");
|
|
||||||
$v=DoorPi_Cmd($hash,"dooropen");
|
$v=DoorPi_Cmd($hash,"dooropen");
|
||||||
|
$v=DoorPi_Cmd($hash,"doorunlocked");
|
||||||
Log3 $name, 1,"[DoorPi_Door 2.2] reset DoorPi to proper state and sent 'dooropen' command";
|
Log3 $name, 1,"[DoorPi_Door 2.2] reset DoorPi to proper state and sent 'dooropen' command";
|
||||||
readingsSingleUpdate($hash,$door,"opened",1);
|
readingsSingleUpdate($hash,$door,"opened (pending)",1);
|
||||||
#-- extra fhem command
|
#-- extra fhem command
|
||||||
$fhemcmd = AttrVal($name, "dooropencmd",undef);
|
$fhemcmd = AttrVal($name, "dooropencmd",undef);
|
||||||
fhem($fhemcmd)
|
fhem($fhemcmd)
|
||||||
@ -1455,6 +1463,8 @@ sub DoorPi_list($;$){
|
|||||||
<br/>
|
<br/>
|
||||||
If the third parameter is a nonempty string, this additional command is skipped. Can be useful, if the
|
If the third parameter is a nonempty string, this additional command is skipped. Can be useful, if the
|
||||||
locked/unlocked command comes from the door itself.
|
locked/unlocked command comes from the door itself.
|
||||||
|
<br/>
|
||||||
|
DoorPi will confirm reception of the dooropen command by calling <code>set <DoorPi-Device> door <b>opened</b></code>
|
||||||
</li>
|
</li>
|
||||||
<li><a name="doorpi_snapshot">
|
<li><a name="doorpi_snapshot">
|
||||||
<code>set <DoorPi-Device> snapshot </code></a><br />
|
<code>set <DoorPi-Device> snapshot </code></a><br />
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#
|
#
|
||||||
# Script file to perform various external tasks for DoorPi
|
# Script file to perform various external tasks for DoorPi
|
||||||
#
|
#
|
||||||
# Prof. Dr. Peter A. Henning, 2016
|
# Prof. Dr. Peter A. Henning, 2017
|
||||||
#
|
#
|
||||||
# $Id: FHEMHelper 2016-05 - pahenning $
|
# $Id: FHEMHelper 2017-05 - pahenning $
|
||||||
#
|
#
|
||||||
########################################################################################
|
########################################################################################
|
||||||
#
|
#
|
||||||
@ -41,16 +41,16 @@ checkstream() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FHEMDP="A.Door.Pi" # FHEM Devicename for DoorPi
|
FHEMDP="A.Door.Pi" # FHEM Devicename for DoorPi
|
||||||
FHEMIP="192.168.x.y" # IP address for DoorPi
|
FHEMIP="XX.XX.XX.XX" # IP address for DoorPi
|
||||||
FHEMPORT="8083" # Port number for DoorPi
|
FHEMPORT="8083" # Port number for DoorPi
|
||||||
FHEMHTTPS="false" # true for HTTPS, false without HTTPS
|
FHEMHTTPS="false" # true for HTTPS, false without HTTPS
|
||||||
curlprog="curl"
|
curlprog="curl"
|
||||||
curlargs="" # -k to disable HTTPS certificate check,
|
curlargs="" # -k to disable HTTPS certificate check,
|
||||||
# -u user:password for user and password
|
# -u user:password for user and password
|
||||||
HOME="/home/doorpi" # Doorpi Standard /usr/local/etc/DoorPi/
|
HOME="/home/doorpi" # Doorpi Standard /usr/local/etc/DoorPi/
|
||||||
default_target="yyyyy" # default telephone number to be called
|
default_target="xxxxxx" # default telephone number to be called
|
||||||
FHEMTTS="true" # true for TTS output, false without TTS
|
FHEMTTS="true" # true for TTS output, false without TTS
|
||||||
FHEMTTSDEVICE="GalaxyTab" # FHEM Devicename for TTS device
|
FHEMTTSDEVICE="AllTablets" # FHEM Devicename for TTS device
|
||||||
|
|
||||||
### FHEM path ###
|
### FHEM path ###
|
||||||
if [ $FHEMHTTPS = "true" ]; then
|
if [ $FHEMHTTPS = "true" ]; then
|
||||||
@ -62,7 +62,7 @@ if [ $FHEMHTTPS = "true" ]; then
|
|||||||
### execute commands ##
|
### execute commands ##
|
||||||
case $1 in
|
case $1 in
|
||||||
|
|
||||||
init) #-- send current target to FHEM
|
init) #-- send current target to FHEM
|
||||||
target=`cat $HOME/calltarget`
|
target=`cat $HOME/calltarget`
|
||||||
$curlprog $curlargs "$FHEM=setreading%20$FHEMDP%20call_target%20$target" &
|
$curlprog $curlargs "$FHEM=setreading%20$FHEMDP%20call_target%20$target" &
|
||||||
#-- send state of mjpg_streamer to FHEM
|
#-- send state of mjpg_streamer to FHEM
|
||||||
@ -75,17 +75,21 @@ init) #-- send current target to FHEM
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
doorunlockandopen)
|
doorunlockandopen)
|
||||||
if [ $FHEMTTS = "true" ]; then
|
|
||||||
$curlprog $curlargs "$FHEM=set%20$FHEMTTSDEVICE%20ttsSay%20Ein%20Bewohner%20betritt%20das%20Haus" &
|
|
||||||
fi
|
|
||||||
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20door%20unlockandopen" &
|
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20door%20unlockandopen" &
|
||||||
|
if [ $FHEMTTS = "true" ]; then
|
||||||
|
$curlprog $curlargs "$FHEM=set%20$FHEMTTSDEVICE%20audioPlay%20Music/066_zutrittbewohner.mp3" &
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
|
dooropened)
|
||||||
|
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20door%20opened" &
|
||||||
;;
|
;;
|
||||||
|
|
||||||
wrongid)
|
wrongid)
|
||||||
if [ $FHEMTTS = "true" ]; then
|
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20call%20wrong_id" &
|
||||||
$curlprog $curlargs "$FHEM=set%20FHEMTTSDEVICE%20ttsSay%20Unerlaubter%20Zutrittsversuch" &
|
if [ $FHEMTTS = "true" ]; then
|
||||||
fi
|
$curlprog $curlargs "$FHEM=set%20$FHEMTTSDEVICE%20audioPlay%20Music/065_zutrittsversuch.mp3" &
|
||||||
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20door%20wrong_id" &
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
softlock)
|
softlock)
|
||||||
@ -101,15 +105,20 @@ init) #-- send current target to FHEM
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
purge)
|
purge)
|
||||||
find $HOME/records/ -type f -ctime 1 -delete
|
find $HOME/records/ -type f -ctime +1 -delete
|
||||||
;;
|
;;
|
||||||
|
|
||||||
movement)
|
movement)
|
||||||
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20door%20movement" &
|
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20call%20movement" &
|
||||||
;;
|
;;
|
||||||
|
|
||||||
sabotage)
|
sabotage)
|
||||||
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20door%20sabotage" &
|
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20call%20sabotage" &
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
alive)
|
||||||
|
$curlprog $curlargs "$FHEM=set%20$FHEMDP%20call%20alive" &
|
||||||
|
;;
|
||||||
|
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
@ -1,3 +1,30 @@
|
|||||||
|
#
|
||||||
|
# doorpi.ini
|
||||||
|
#
|
||||||
|
# Configuration file for DoorPi
|
||||||
|
#
|
||||||
|
# Prof. Dr. Peter A. Henning, 2017
|
||||||
|
#
|
||||||
|
# $Id: doorpi.ini 2017-05 - pahenning $
|
||||||
|
#
|
||||||
|
########################################################################################
|
||||||
|
#
|
||||||
|
# This programm is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# The GNU General Public License can be found at
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
# A copy is found in the textfile GPL.txt and important notices to the license
|
||||||
|
# from the author is found in LICENSE.txt distributed with these scripts.
|
||||||
|
#
|
||||||
|
# This script is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
#########################################################################################
|
||||||
[DoorPi]
|
[DoorPi]
|
||||||
base_path = /usr/local/etc/DoorPi
|
base_path = /usr/local/etc/DoorPi
|
||||||
snapshot_path = /home/doorpi/records
|
snapshot_path = /home/doorpi/records
|
||||||
@ -9,7 +36,7 @@ last_snapshot =
|
|||||||
[DoorPiWeb]
|
[DoorPiWeb]
|
||||||
indexfile = index.html
|
indexfile = index.html
|
||||||
loginfile = login.html
|
loginfile = login.html
|
||||||
#online_fallback = http://192.168.x.y:8083/fhem?detail=A.Door.Pi
|
#online_fallback = URLURL:8083/fhem?detail=A.Door.Pi
|
||||||
port = 80
|
port = 80
|
||||||
public = AREA_public
|
public = AREA_public
|
||||||
www = /home/doorpi/records
|
www = /home/doorpi/records
|
||||||
@ -49,7 +76,7 @@ administrators = dashboard,status,config
|
|||||||
guests = dashboard
|
guests = dashboard
|
||||||
|
|
||||||
[AdminNumbers]
|
[AdminNumbers]
|
||||||
**xxx = active
|
**621 = active
|
||||||
|
|
||||||
[DTMF]
|
[DTMF]
|
||||||
"#" = out:door,1,0,3
|
"#" = out:door,1,0,3
|
||||||
@ -61,10 +88,10 @@ local_port = 5060
|
|||||||
firewallpolicy = PolicyNoFirewall
|
firewallpolicy = PolicyNoFirewall
|
||||||
#
|
#
|
||||||
sipphonetyp = linphone
|
sipphonetyp = linphone
|
||||||
sipserver_password = xxxxxxxxx
|
sipserver_password = XXXXXXXXXXXXX
|
||||||
sipserver_realm = fritz.box
|
sipserver_realm = fritz.box
|
||||||
sipserver_server = 192.168.x.y
|
sipserver_server = IPIPIP
|
||||||
sipserver_username = yyy
|
sipserver_username = 620
|
||||||
stun_server =
|
stun_server =
|
||||||
#
|
#
|
||||||
max_call_time = 300
|
max_call_time = 300
|
||||||
@ -92,14 +119,13 @@ video_size = vga
|
|||||||
10 = sleep:1
|
10 = sleep:1
|
||||||
20 = os_execute:/home/doorpi/FHEMHelper.sh init
|
20 = os_execute:/home/doorpi/FHEMHelper.sh init
|
||||||
20 = os_execute:/home/doorpi/FHEMHelper.sh call init
|
20 = os_execute:/home/doorpi/FHEMHelper.sh call init
|
||||||
#30 = out:audio,1
|
|
||||||
|
|
||||||
[EVENT_BeforeSipPhoneMakeCall]
|
[EVENT_BeforeSipPhoneMakeCall]
|
||||||
10 = out:irlight,1
|
10 = out:irlight,1
|
||||||
20 = take_snapshot
|
20 = take_snapshot
|
||||||
30 = os_execute:/home/doorpi/FHEMHelper.sh call started
|
30 = os_execute:/home/doorpi/FHEMHelper.sh call started
|
||||||
40 = out:irlight,0
|
40 = out:irlight,0
|
||||||
#30 = mailto:haus271828@henning-weingarten.de,DoorPi,DoorPi initiating call
|
50 = os_execute:/home/doorpi/sendphoto call
|
||||||
|
|
||||||
#[EVENT_OnCallStateConnect]
|
#[EVENT_OnCallStateConnect]
|
||||||
#10 = out:audio,0
|
#10 = out:audio,0
|
||||||
@ -118,7 +144,7 @@ video_size = vga
|
|||||||
|
|
||||||
[EVENT_OnTimeMinuteEvery5]
|
[EVENT_OnTimeMinuteEvery5]
|
||||||
10 = statuswatchdog:/tmp/doorpi.watchdog
|
10 = statuswatchdog:/tmp/doorpi.watchdog
|
||||||
#20 = out:audio,1
|
20 = os_execute:/home/doorpi/FHEMHelper.sh alive
|
||||||
|
|
||||||
####################### Keyboards ##############################
|
####################### Keyboards ##############################
|
||||||
[keyboards]
|
[keyboards]
|
||||||
@ -132,14 +158,13 @@ base_path_output = /home/doorpi/keyboard/outputs/
|
|||||||
reset_input=false
|
reset_input=false
|
||||||
|
|
||||||
[webservice_InputPins]
|
[webservice_InputPins]
|
||||||
dooropen = out:door,1,0,3
|
dooropen = sleep:0
|
||||||
doorlocked = out:hardlock,1
|
doorlocked = out:hardlock,1
|
||||||
doorunlocked = out:hardlock,0
|
doorunlocked = out:hardlock,0
|
||||||
snapshot = sleep:0
|
snapshot = sleep:0
|
||||||
streamon = sleep:0
|
streamon = sleep:0
|
||||||
streamoff = sleep:0
|
streamoff = sleep:0
|
||||||
lighton = out:light,1
|
lighton = out:light,1
|
||||||
#lightonfortimer = out:light,1,0,60
|
|
||||||
lightoff = out:light,0
|
lightoff = out:light,0
|
||||||
dashlighton = out:dashlight,1
|
dashlighton = out:dashlight,1
|
||||||
dashlightoff = out:dashlight,0
|
dashlightoff = out:dashlight,0
|
||||||
@ -149,12 +174,18 @@ clear = sleep:0
|
|||||||
button1 = sleep:0
|
button1 = sleep:0
|
||||||
button2 = sleep:0
|
button2 = sleep:0
|
||||||
|
|
||||||
#-- communicate to FHEM that a snapshot has been taken
|
#-- open door and communicate to FHEM that door has been opened
|
||||||
|
[EVENT_OnKeyPressed_webservice.dooropen]
|
||||||
|
10 = out:door,1,0,3
|
||||||
|
20 = os_execute:/home/doorpi/FHEMHelper.sh dooropened
|
||||||
|
|
||||||
|
#-- taks snapshot and communicate to FHEM that a snapshot has been taken
|
||||||
[EVENT_OnKeyPressed_webservice.snapshot]
|
[EVENT_OnKeyPressed_webservice.snapshot]
|
||||||
10 = out:irlight,1
|
10 = out:irlight,1
|
||||||
20 = os_execute:/home/doorpi/FHEMHelper.sh call snapshot
|
20 = os_execute:/home/doorpi/FHEMHelper.sh call snapshot
|
||||||
30 = take_snapshot
|
30 = take_snapshot
|
||||||
40 = out:irlight,0
|
40 = out:irlight,0
|
||||||
|
50 = os_execute:/home/doorpi/sendphoto.sh snapshot
|
||||||
|
|
||||||
#-- start video stream
|
#-- start video stream
|
||||||
[EVENT_OnKeyPressed_webservice.streamon]
|
[EVENT_OnKeyPressed_webservice.streamon]
|
||||||
@ -203,16 +234,18 @@ pull_up_down = PUD_UP
|
|||||||
6 = sleep:0
|
6 = sleep:0
|
||||||
7 = sleep:0
|
7 = sleep:0
|
||||||
|
|
||||||
#-- RING THE BELL
|
#-- Ring the bell
|
||||||
[EVENT_OnKeyPressed_onboardpins.0]
|
[EVENT_OnKeyPressed_onboardpins.0]
|
||||||
20 = file_call_value:/home/doorpi/calltarget
|
10 = file_call_value:/home/doorpi/calltarget
|
||||||
|
|
||||||
#-- DoorOpen pin from Arduino
|
#-- DoorOpen pin from Arduino
|
||||||
[EVENT_OnKeyPressed_onboardpins.1]
|
[EVENT_OnKeyPressed_onboardpins.1]
|
||||||
#10 = out:audio,0
|
10 = os_execute:/home/doorpi/FHEMHelper.sh doorunlockandopen
|
||||||
20 = os_execute:/home/doorpi/FHEMHelper.sh doorunlockandopen
|
20 = os_execute:aplay -D plughw:1,0 /home/doorpi/sounds/067_willkommen.wav
|
||||||
30 = os_execute:aplay -D plughw:1,0 /home/doorpi/sounds/067_willkommen.wav
|
|
||||||
#40 = out:audio,1
|
#-- Open the door
|
||||||
|
#[EVENT_OnKeyPressed_onboardpins.2]
|
||||||
|
#10 = out:door,1,0,5
|
||||||
|
|
||||||
#-- WrongID pin from Arduino
|
#-- WrongID pin from Arduino
|
||||||
[EVENT_OnKeyPressed_onboardpins.4]
|
[EVENT_OnKeyPressed_onboardpins.4]
|
||||||
@ -220,6 +253,7 @@ pull_up_down = PUD_UP
|
|||||||
20 = os_execute:/home/doorpi/FHEMHelper.sh wrongid
|
20 = os_execute:/home/doorpi/FHEMHelper.sh wrongid
|
||||||
30 = take_snapshot
|
30 = take_snapshot
|
||||||
40 = out:irlight,0
|
40 = out:irlight,0
|
||||||
|
50 = os_execute:/home/doorpi/sendphoto.sh wrongid
|
||||||
|
|
||||||
#-- LockState pin from Arduino - FHEM will transform softlock into hardlock
|
#-- LockState pin from Arduino - FHEM will transform softlock into hardlock
|
||||||
[EVENT_OnKeyPressed_onboardpins.5]
|
[EVENT_OnKeyPressed_onboardpins.5]
|
||||||
|
35
fhem/contrib/DoorPi/sendphoto.sh.safe
Normal file
35
fhem/contrib/DoorPi/sendphoto.sh.safe
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# sendphoto.sh
|
||||||
|
#
|
||||||
|
# Script file to send a doorpi photo per telegram
|
||||||
|
#
|
||||||
|
# Prof. Dr. Peter A. Henning, 2017
|
||||||
|
#
|
||||||
|
# $Id: sendphoto.sh 2017-05 - pahenning $
|
||||||
|
#
|
||||||
|
########################################################################################
|
||||||
|
#
|
||||||
|
# This programm is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# The GNU General Public License can be found at
|
||||||
|
# http://www.gnu.org/copyleft/gpl.html.
|
||||||
|
# A copy is found in the textfile GPL.txt and important notices to the license
|
||||||
|
# from the author is found in LICENSE.txt distributed with these scripts.
|
||||||
|
#
|
||||||
|
# This script is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
#########################################################################################
|
||||||
|
last=`ls -tr /home/doorpi/records/*.jpg | tail -1`
|
||||||
|
Token=TELEGRAMTOKEN
|
||||||
|
ChatId=CHATID
|
||||||
|
echo "Sending photo $last" > /home/doorpi/sendphoto.log
|
||||||
|
curl -s -k "https://api.telegram.org/bot${Token}/sendPhoto" -d photo="http://URLURLURL/doorpi/$last" -d chat_id=$ChatId >> /home/doorpi/sendphoto.log
|
||||||
|
exit 0
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user