mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-16 10:46:03 +00:00
70_DoorPi.pm: Bugfix bei GetHistory
git-svn-id: https://svn.fhem.de/fhem/trunk@12694 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
157dc52e61
commit
64768bd635
@ -2,12 +2,12 @@
|
|||||||
#
|
#
|
||||||
# DoorPi.pm
|
# DoorPi.pm
|
||||||
#
|
#
|
||||||
# FHEM module to communicate with a Raspberry Pi door station
|
# FHEM module to communicate with a Raspberry Pi door station running DoorPi
|
||||||
#
|
|
||||||
# Prof. Dr. Peter A. Henning, 2016
|
# Prof. Dr. Peter A. Henning, 2016
|
||||||
#
|
#
|
||||||
# $Id: 70_DoorPi.pm 2016-05 - pahenning $
|
# $Id: 70_DoorPi.pm 2016-05 - pahenning $
|
||||||
#
|
#
|
||||||
|
# TODO: Link /xx weglassen beim letzten Call
|
||||||
#
|
#
|
||||||
########################################################################################
|
########################################################################################
|
||||||
#
|
#
|
||||||
@ -41,7 +41,7 @@ use vars qw{%attr %defs};
|
|||||||
sub Log($$);
|
sub Log($$);
|
||||||
|
|
||||||
#-- globals on start
|
#-- globals on start
|
||||||
my $version = "1.42";
|
my $version = "1.6";
|
||||||
|
|
||||||
#-- these we may get on request
|
#-- these we may get on request
|
||||||
my %gets = (
|
my %gets = (
|
||||||
@ -121,7 +121,7 @@ sub DoorPi_Define($$) {
|
|||||||
my $oid = $init_done;
|
my $oid = $init_done;
|
||||||
$init_done = 1;
|
$init_done = 1;
|
||||||
readingsBeginUpdate($hash);
|
readingsBeginUpdate($hash);
|
||||||
readingsBulkUpdate($hash,"state","Initialized");
|
readingsBulkUpdate($hash,"state","initialized");
|
||||||
readingsBulkUpdate($hash,"lockstate","Unknown");
|
readingsBulkUpdate($hash,"lockstate","Unknown");
|
||||||
readingsBulkUpdate($hash,"door","Unknown");
|
readingsBulkUpdate($hash,"door","Unknown");
|
||||||
readingsEndUpdate($hash,1);
|
readingsEndUpdate($hash,1);
|
||||||
@ -274,11 +274,14 @@ sub DoorPi_Set ($@) {
|
|||||||
|
|
||||||
#-- hidden command "call" to be used by DoorPi for communicating with this module
|
#-- hidden command "call" to be used by DoorPi for communicating with this module
|
||||||
if( $key eq "call" ){
|
if( $key eq "call" ){
|
||||||
Log3 $name,1,"[DoorPi] call $value received";
|
#Log3 $name,1,"[DoorPi] call $value received";
|
||||||
#-- call init
|
#-- call init
|
||||||
if( $value eq "init" ){
|
if( $value eq "init" ){
|
||||||
DoorPi_GetConfig($hash);
|
DoorPi_GetConfig($hash);
|
||||||
InternalTimer(gettimeofday()+10, "DoorPi_GetHistory", $hash,0);
|
InternalTimer(gettimeofday()+10, "DoorPi_GetHistory", $hash,0);
|
||||||
|
#-- alive
|
||||||
|
}elsif( $value eq "alive" ){
|
||||||
|
readingsSingleUpdate($hash,"state","alive",1);
|
||||||
#-- call start
|
#-- call start
|
||||||
}elsif( $value =~ "start.*" ){
|
}elsif( $value =~ "start.*" ){
|
||||||
readingsSingleUpdate($hash,"call","started",1);
|
readingsSingleUpdate($hash,"call","started",1);
|
||||||
@ -626,7 +629,7 @@ sub DoorPi_GetConfig {
|
|||||||
$hash->{HELPER}->{wwwpath} = $jhash0->{"config"}->{"DoorPiWeb"}->{"www"};
|
$hash->{HELPER}->{wwwpath} = $jhash0->{"config"}->{"DoorPiWeb"}->{"www"};
|
||||||
|
|
||||||
#-- put into READINGS
|
#-- put into READINGS
|
||||||
readingsSingleUpdate($hash,"state","Initialized",1);
|
readingsSingleUpdate($hash,"state","initialized",1);
|
||||||
readingsSingleUpdate($hash,"config","ok",1);
|
readingsSingleUpdate($hash,"config","ok",1);
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
@ -703,8 +706,8 @@ sub DoorPi_GetHistory {
|
|||||||
my ($hash,$err1,$status1,$err2,$status2) = @_;
|
my ($hash,$err1,$status1,$err2,$status2) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
my $url;
|
my $url;
|
||||||
|
my $state= $hash->{READINGS}{state}{VAL};
|
||||||
if( $hash->{READINGS}{state}{VAL} ne "Initialized"){
|
if( ( $state ne "initialized") && ($state ne "alive") ){
|
||||||
Log 1,"[DoorPi_GetHistory] cannot be called, no connection";
|
Log 1,"[DoorPi_GetHistory] cannot be called, no connection";
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -946,10 +949,10 @@ sub DoorPi_GetHistory {
|
|||||||
sub DoorPi_Cmd {
|
sub DoorPi_Cmd {
|
||||||
my ($hash, $cmd, $err, $data) = @_;
|
my ($hash, $cmd, $err, $data) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
my $url;
|
my $url;
|
||||||
|
my $state = $hash->{READINGS}{state}{VAL};
|
||||||
|
|
||||||
if( $hash->{READINGS}{state}{VAL} ne "Initialized"){
|
if( ($state ne "initialized") && ($state ne "alive") ){
|
||||||
Log 1,"[DoorPi_Cmd] cannot be called, no connection";
|
Log 1,"[DoorPi_Cmd] cannot be called, no connection";
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -1289,6 +1292,8 @@ sub DoorPi_list($;$){
|
|||||||
1;
|
1;
|
||||||
|
|
||||||
=pod
|
=pod
|
||||||
|
=item device
|
||||||
|
=item summary to communicate with a Raspberry Pi door station running DoorPi
|
||||||
=begin html
|
=begin html
|
||||||
|
|
||||||
<a name="DoorPi"></a>
|
<a name="DoorPi"></a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user