mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-01 20:20:10 +00:00
70_BRAVIA.pm: fix registration renewal
git-svn-id: https://svn.fhem.de/fhem/trunk@24219 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
95e6d34865
commit
b654b832fc
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# 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.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- bugfix: 70_BRAVIA: fix registration renewal
|
||||||
- change: 49_IPCAM: imageWithCallback wrapped in internalTimer with 0 delay
|
- change: 49_IPCAM: imageWithCallback wrapped in internalTimer with 0 delay
|
||||||
- bugfix: 47_OBIS: Reintegrate buggy DZG meters support
|
- bugfix: 47_OBIS: Reintegrate buggy DZG meters support
|
||||||
- change: 49_IPCAM: introduced attribute httpTimeout
|
- change: 49_IPCAM: introduced attribute httpTimeout
|
||||||
|
@ -2214,8 +2214,10 @@ sub CheckRegistration {
|
|||||||
my ( $hash, $service, $cmd, $param, @successor ) = @_;
|
my ( $hash, $service, $cmd, $param, @successor ) = @_;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
if (ReadingsVal($name, "authCookie", "") ne "" and
|
my $authCookie = ReadingsVal($name, "authCookie", "");
|
||||||
ReadingsTimestamp($name, "authCookie", "") =~ m/^(\d{4})-(\d{2})-(\d{2}) ([0-2]\d):([0-5]\d):([0-5]\d)$/xms) {
|
my $authCookieTS = ReadingsTimestamp($name, "authCookie", "");
|
||||||
|
if ($authCookie ne "" and
|
||||||
|
$authCookieTS =~ m/^(\d{4})-(\d{2})-(\d{2})\ ([0-2]\d):([0-5]\d):([0-5]\d)$/xms) {
|
||||||
|
|
||||||
my $time = fhemTimeLocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
|
my $time = fhemTimeLocal($6, $5, $4, $3, $2 - 1, $1 - 1900);
|
||||||
# max age defaults to 14 days
|
# max age defaults to 14 days
|
||||||
@ -2235,12 +2237,16 @@ sub CheckRegistration {
|
|||||||
$msg .= " $i: ";
|
$msg .= " $i: ";
|
||||||
$msg .= join(",", map { defined($_) ? $_ : '' } @succ_item);
|
$msg .= join(",", map { defined($_) ? $_ : '' } @succ_item);
|
||||||
}
|
}
|
||||||
Log3($name, 4, "BOTVAC created".$msg);
|
Log3($name, 4, "BRAVIA $name: created".$msg);
|
||||||
|
|
||||||
SendCommand( $hash, "register", "renew", undef, @successor );
|
SendCommand( $hash, "register", "renew", undef, @successor );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
} else {
|
||||||
|
Log3($name, 5, "BRAVIA $name: registration valid until $authCookieTS");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log3($name, 4, "BRAVIA $name: authCookie not valid '$authCookie $authCookieTS'");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
40
fhem/t/FHEM/70_BRAVIA/CheckRegistration.t
Normal file
40
fhem/t/FHEM/70_BRAVIA/CheckRegistration.t
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
################################################
|
||||||
|
# test Set
|
||||||
|
################################################
|
||||||
|
package FHEM::BRAVIA;
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
use Test::More;
|
||||||
|
|
||||||
|
# used to import of FHEM functions from fhem.pl
|
||||||
|
use GPUtils qw(:all);
|
||||||
|
BEGIN {
|
||||||
|
GP_Import(
|
||||||
|
qw(
|
||||||
|
fhem
|
||||||
|
FhemTestUtils_gotLog
|
||||||
|
FhemTestUtils_resetLogs
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
# execute checkRegistration
|
||||||
|
{
|
||||||
|
CheckRegistration($::defs{tv});
|
||||||
|
}
|
||||||
|
is(FhemTestUtils_gotLog("BRAVIA tv: authCookie not valid ' '"), 1, "Registration missing");
|
||||||
|
|
||||||
|
FhemTestUtils_resetLogs();
|
||||||
|
|
||||||
|
fhem('setreading tv authCookie test');
|
||||||
|
{
|
||||||
|
CheckRegistration($::defs{tv});
|
||||||
|
}
|
||||||
|
is(FhemTestUtils_gotLog("BRAVIA tv: authCookie not valid '.*'"), 0, "Registration valid");
|
||||||
|
is(FhemTestUtils_gotLog("BRAVIA tv: registration valid until .*"), 1, "Registration period");
|
||||||
|
|
||||||
|
done_testing;
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
1;
|
Loading…
x
Reference in New Issue
Block a user