2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-19 18:56:03 +00:00

88_xs1Bridge.pm: fix Filelog check

git-svn-id: https://svn.fhem.de/fhem/trunk@16162 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
HomeAuto_User 2018-02-12 21:14:10 +00:00
parent 111f69a30a
commit b8d387addd
2 changed files with 38 additions and 38 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it.
- bugfix: 88_xs1Bridge: fix Filelog check
- new: 39_Talk2Fhem: new module for language control
- feature: 70_BRAVIA: TV input select for all active tuners
Channel selection by channel uri

View File

@ -75,7 +75,7 @@ sub xs1Bridge_Define($$) {
if (&xs1Bridge_Ping == 1) { ## IP - Check
$hash->{STATE} = "Initialized"; ## Der Status des Modules nach Initialisierung.
$hash->{TIME} = time(); ## Zeitstempel, derzeit vom anlegen des Moduls
$hash->{VERSION} = "1.11"; ## Version
$hash->{VERSION} = "1.12"; ## Version
$hash->{BRIDGE} = 1;
# Attribut gesetzt
@ -89,15 +89,17 @@ sub xs1Bridge_Define($$) {
Log3 $name, 3, "$typ: Modul defined with xs1_ip: $xs1_ip";
fhem("define FileLog_xs1Bridge FileLog ./log/xs1Bridge-%Y-%m.log ".$arg[0]); ## Logfil define
if(!defined($defs{'FileLog_xs1Bridge'})) { ## Logfile existent check
fhem("define FileLog_xs1Bridge FileLog ./log/xs1Bridge-%Y-%m.log ".$arg[0]); ## Logfile define
fhem("attr FileLog_xs1Bridge room xs1"); ## Logfile in xs1 room
}
return undef;
}
else
{
return "ERROR - Host IP $xs1_ip is not reachable. Please check!";
return "ERROR - Host IP $xs1_ip is not reachable. Please check!" if(!defined($defs{$name}));
return undef; "$typ: ERROR - Host IP $xs1_ip is not reachable. Please check!" if(defined($defs{$name}));
}
}
sub xs1Bridge_Attr(@) {
@ -282,26 +284,23 @@ sub xs1Bridge_GetUpDate() {
my $adress = "http://".$hash->{xs1_ip}.$cmd.$cmdtyp[$i];
Debug " $typ: GetUpDate | Adresse: $adress" if($debug);
my $ua = LWP::UserAgent->new; ## CHECK JSON Adresse -> JSON-query, sonst FHEM shutdown
my $resp = $ua->request(HTTP::Request->new(GET => $adress));
Debug " $typ: GetUpDate | Adresse HTTP request Code: ".$resp->code if($debug);
if ($resp->code != "200") { ## http://search.cpan.org/~oalders/HTTP-Message-6.13/lib/HTTP/Status.pm
Log3 $name, 3, "$typ: GetUpDate | cmdtyp=".$cmdtyp[$i]." - HTTP GET error code ".$resp->code." -> no Data";
$xs1_security++;
last; ## ERROR JSON-query -> Abbruch schleife
}
my $json;
my $json_utf8;
my $decoded;
my $ua = LWP::UserAgent->new; ## CHECK JSON Adresse -> JSON-query, sonst FHEM shutdown
my $resp = $ua->request(HTTP::Request->new(GET => $adress));
if (defined($adress)) {
Debug " $typ: GetUpDate | Adresse HTTP request Code: ".$resp->code if($debug);
## Get $adress Antwort, OK dann ARRAY Verarbeitung, n.iO ABBRUCH
if ($resp->code == "200") { ## http://search.cpan.org/~oalders/HTTP-Message-6.13/lib/HTTP/Status.pm
($json) = get( $adress ) =~ /[^(]*[}]/g; ## cut cname( + ) am Ende von Ausgabe -> ARRAY Struktur als Antwort vom xs1
$json_utf8 = eval {encode_utf8( $json )}; ## UTF-8 character Bearbeitung, da xs1 TempSensoren ERROR
$decoded = eval {decode_json( $json_utf8 )}; ## auswertbares ARAAY
} else {
Log3 $name, 3, "$typ: Adresse:$adress undefined";
last;
Log3 $name, 3, "$typ: GetUpDate | cmdtyp=".$cmdtyp[$i]." - HTTP GET error code ".$resp->code." -> no Data";
$xs1_security++;
last; ## ERROR JSON-query -> Abbruch schleife
}
if ($i <= 1 ) { ### xs1 Aktoren / Sensoren