mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
36_LaCrosseGateway: fixed "== eq" error
git-svn-id: https://svn.fhem.de/fhem/trunk@21663 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2ecded0564
commit
4bf3fc1290
@ -6,6 +6,7 @@ use strict;
|
||||
use warnings;
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
use Time::Local;
|
||||
use DevIo;
|
||||
|
||||
my $clients = ":PCA301:EC3000:LaCrosse:Level:EMT7110:KeyValueProtocol:CapacitiveLevel";
|
||||
|
||||
@ -22,8 +23,6 @@ my %matchList = (
|
||||
sub LaCrosseGateway_Initialize($) {
|
||||
my ($hash) = @_;
|
||||
|
||||
require "$attr{global}{modpath}/FHEM/DevIo.pm";
|
||||
|
||||
$hash->{ReadFn} = "LaCrosseGateway_Read";
|
||||
$hash->{WriteFn} = "LaCrosseGateway_Write";
|
||||
$hash->{ReadyFn} = "LaCrosseGateway_Ready";
|
||||
@ -70,7 +69,8 @@ sub LaCrosseGateway_Notify($$) {
|
||||
}
|
||||
|
||||
#=======================================================================================
|
||||
sub LaCrosseGateway_Define($$) {my ($hash, $def) = @_;
|
||||
sub LaCrosseGateway_Define($$) {
|
||||
my ($hash, $def) = @_;
|
||||
my @a = split("[ \t][ \t]*", $def);
|
||||
|
||||
if(@a != 3) {
|
||||
@ -87,6 +87,8 @@ sub LaCrosseGateway_Define($$) {my ($hash, $def) = @_;
|
||||
$hash->{Clients} = $clients;
|
||||
$hash->{MatchList} = \%matchList;
|
||||
$hash->{TIMEOUT} = 0.5;
|
||||
###$hash->{TIMEOUT} = 1.0;
|
||||
###$hash->{devioLoglevel} = 4;
|
||||
|
||||
if( !defined( $attr{$name}{usbFlashCommand} ) ) {
|
||||
$attr{$name}{usbFlashCommand} = "./FHEM/firmware/esptool.py -b 921600 -p [PORT] write_flash -ff 80m -fm dio -fs 4MB-c1 0x00000 [BINFILE] > [LOGFILE] 2>&1"
|
||||
@ -517,7 +519,7 @@ sub LaCrosseGateway_HandleKVP($$) {
|
||||
readingsBulkUpdate($hash, "CPU-Temperature", $1);
|
||||
}
|
||||
|
||||
if(AttrVal($name, "loopTimeReadings", "0") == "1") {
|
||||
if(AttrVal($name, "loopTimeReadings", "0") eq '1') {
|
||||
if($kvp =~ m/LD\.Min=(.*?)(\,|\ ,)/) {
|
||||
readingsBulkUpdate($hash, "LD.Min", $1);
|
||||
}
|
||||
@ -741,12 +743,19 @@ sub LaCrosseGateway_Connect($;$) {
|
||||
my $name = $hash->{NAME};
|
||||
|
||||
DevIo_CloseDev($hash);
|
||||
###if(DevIo_IsOpen($hash)) {
|
||||
### DevIo_CloseDev($hash);
|
||||
###}
|
||||
|
||||
$mode = 0 if!($mode);
|
||||
my $enabled = AttrVal($name, "disable", "0") != "1" && !defined($hash->{helper}{FLASHING});
|
||||
if($enabled) {
|
||||
$hash->{nextOpenDelay} = 2;
|
||||
my $ret = DevIo_OpenDev($hash, $mode, "LaCrosseGateway_DoInit");
|
||||
###my $ret = DevIo_OpenDev($hash, $mode, "LaCrosseGateway_DoInit");
|
||||
my $ret = DevIo_OpenDev($hash, $mode, "LaCrosseGateway_DoInit", sub($$){
|
||||
my ($h, $e) = @_;
|
||||
####Log 3, "LGW: " . $h->{NAME} . " " . $e;
|
||||
});
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user