notofy event , get cookie
This commit is contained in:
parent
e064c7f57f
commit
53b59fb296
@ -63,13 +63,12 @@ sub Initialize {
|
||||
$hash->{UndefFn} = 'FHEM::Hailo::Libero::Undef';
|
||||
$hash->{DeleteFn} = 'FHEM::Hailo::Libero::Delete';
|
||||
$hash->{RenameFn} = 'FHEM::Hailo::Libero::Rename';
|
||||
$hash->{NotifyFn} = 'FHEM::Hailo::Libero::Notify';
|
||||
$hash->{NotifyFn} = 'FHEM::Hailo::Libero::Notify';
|
||||
|
||||
|
||||
$hash->{AttrFn} = 'FHEM::Hailo::Libero::Attr';
|
||||
$hash->{AttrList} =
|
||||
'debugJSON:0,1 '
|
||||
. 'disable:1 '
|
||||
'disable:1 '
|
||||
. 'LiberoIP '
|
||||
. $readingFnAttributes;
|
||||
$hash->{parseParams} = 1;
|
||||
@ -191,7 +190,7 @@ sub Initialize {
|
||||
],
|
||||
"release_status": "stable",
|
||||
"license": "GPL_2",
|
||||
"version": "v1.1.5",
|
||||
"version": "v1.1.7",
|
||||
"author": [
|
||||
"Sebastian Schwarz <ema@il.local>"
|
||||
],
|
||||
|
@ -1,2 +1,2 @@
|
||||
UPD 2021-05-29_23:25:02 5197 FHEM/73_HailoLibero.pm
|
||||
UPD 2021-05-29_23:28:10 11675 lib/FHEM/Hailo/Libero.pm
|
||||
UPD 2021-05-30_22:16:22 5174 FHEM/73_HailoLibero.pm
|
||||
UPD 2021-06-02_19:59:03 11968 lib/FHEM/Hailo/Libero.pm
|
||||
|
@ -152,6 +152,7 @@ sub Notify {
|
||||
my $devname = $dev->{NAME};
|
||||
my $devtype = $dev->{TYPE};
|
||||
my $events = deviceEvents( $dev, 1 );
|
||||
|
||||
return if ( !$events );
|
||||
|
||||
getCookie($hash)
|
||||
@ -183,6 +184,9 @@ sub Notify {
|
||||
grep /^cookie:.*$/,
|
||||
@{$events}
|
||||
)
|
||||
&& (
|
||||
ReadingsVal( $name, 'cookie', 'none' ) ne 'none'
|
||||
)
|
||||
)
|
||||
{
|
||||
getSettings($hash);
|
||||
@ -216,6 +220,7 @@ sub Set {
|
||||
return q{password successfully saved}
|
||||
if ( defined($passResp)
|
||||
and !defined($passErr) );
|
||||
getCookie($hash);
|
||||
}
|
||||
elsif ( lc $cmd =~ /open|led_brightness|eject_power|eject_delay|detection_area|detection_sensitivity/ ) {
|
||||
return "please set Attribut LiberoIP first"
|
||||
@ -310,7 +315,7 @@ sub Write {
|
||||
method => $method,
|
||||
header => $header,
|
||||
ignoreredirects => 1,
|
||||
#doTrigger => 1,
|
||||
doTrigger => 1,
|
||||
callback => \&ErrorHandling
|
||||
}
|
||||
);
|
||||
@ -333,8 +338,12 @@ sub ErrorHandling {
|
||||
my $name = $hash->{NAME};
|
||||
my $dhash = $hash;
|
||||
|
||||
|
||||
Log3 $name, 4, "HailoLibero ($name) - ErrorHandling ".Dumper($param);
|
||||
if ( ReadingsVal( $name, 'cookie', 'none' ) eq 'none' ){
|
||||
|
||||
my ($logintry) = ($data =~ /(Invalid.+)<p/g);
|
||||
readingsSingleUpdate( $hash, 'state', $logintry, 1 );
|
||||
|
||||
my (@cookies) = ($param->{httpheader} =~ /Set-Cookie: (.*)\s/g);
|
||||
foreach my $cookie (@cookies){
|
||||
readingsSingleUpdate( $hash, 'state', 'connected', 1 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user