notofy event , get cookie
This commit is contained in:
@ -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 );
|
||||
|
Reference in New Issue
Block a user