setter test
This commit is contained in:
parent
46ab0c9b1d
commit
940c0d43af
@ -1,2 +1,2 @@
|
|||||||
UPD 2021-05-25_20:13:57 4394 FHEM/73_HailoLibero.pm
|
UPD 2021-05-25_20:13:57 4394 FHEM/73_HailoLibero.pm
|
||||||
UPD 2021-05-24_22:53:00 10892 lib/FHEM/Hailo/Libero.pm
|
UPD 2021-05-29_21:43:21 11674 lib/FHEM/Hailo/Libero.pm
|
||||||
|
@ -226,11 +226,21 @@ sub Set {
|
|||||||
getCookie($hash)
|
getCookie($hash)
|
||||||
if (ReadingsVal( $name, 'cookie', 'none' ) eq 'none');
|
if (ReadingsVal( $name, 'cookie', 'none' ) eq 'none');
|
||||||
|
|
||||||
# sende befehl
|
# cmd = setter, $aArg->[0] = value
|
||||||
|
if (lc $cmd ne 'open') {
|
||||||
|
$payload = 'led=' if (lc $cmd eq 'led_brightness');
|
||||||
|
$payload = 'pwr=' if (lc $cmd eq 'eject_power');
|
||||||
|
$payload = 'dist=' if (lc $cmd eq 'detection_area');
|
||||||
|
$payload = 'delay=' if (lc $cmd eq 'detection_sensitivity');
|
||||||
|
$payload = 'pdelay=' if (lc $cmd eq 'eject_delay');
|
||||||
|
|
||||||
|
write($hash, $payload)
|
||||||
|
|
||||||
# reade settings
|
|
||||||
getSettings($hash)
|
getSettings($hash)
|
||||||
if(lc $cmd ne 'open');
|
}
|
||||||
|
|
||||||
|
write($hash,undef)
|
||||||
|
if (lc $cmd eq 'open');
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -267,6 +277,23 @@ sub getCookie {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub openDoor {
|
||||||
|
#curl 'http://192.168.1.216:81/settings' \
|
||||||
|
# -H 'Referer: http://192.168.1.216:81/admin' \
|
||||||
|
# -H 'Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7' \
|
||||||
|
# -H 'Cookie: c=dm40qfdeulkw0phbl95rtcrt1sul4p66' \
|
||||||
|
# --data-raw 'led=6&pwr=5&dist=50&delay=1&pdelay=1&sbsettings=' \
|
||||||
|
# --compressed \
|
||||||
|
# --insecure
|
||||||
|
}
|
||||||
|
|
||||||
|
sub setSettings {
|
||||||
|
my $hash = shift;
|
||||||
|
my $name = $hash->{NAME};
|
||||||
|
|
||||||
|
Write( $hash, undef, undef, undef );
|
||||||
|
|
||||||
|
}
|
||||||
sub getSettings {
|
sub getSettings {
|
||||||
my $hash = shift;
|
my $hash = shift;
|
||||||
my $name = $hash->{NAME};
|
my $name = $hash->{NAME};
|
||||||
@ -357,6 +384,10 @@ sub createHttpValueStrings {
|
|||||||
if ( ReadingsVal( $name, 'cookie', 'none' ) eq 'none' ){
|
if ( ReadingsVal( $name, 'cookie', 'none' ) eq 'none' ){
|
||||||
$uri .= '/login';
|
$uri .= '/login';
|
||||||
readingsSingleUpdate( $hash, 'state', 'fetch cookie', 1 );
|
readingsSingleUpdate( $hash, 'state', 'fetch cookie', 1 );
|
||||||
|
} elsif ( defined($payload)){
|
||||||
|
$uri .= '/settings';
|
||||||
|
} elsif ( $payload eq '{}'){
|
||||||
|
uri .= '/open';
|
||||||
}else {
|
}else {
|
||||||
$uri .= '/admin';
|
$uri .= '/admin';
|
||||||
$method = 'GET';
|
$method = 'GET';
|
||||||
@ -364,17 +395,6 @@ sub createHttpValueStrings {
|
|||||||
return ( $payload, $header, $uri, $method );
|
return ( $payload, $header, $uri, $method );
|
||||||
}
|
}
|
||||||
|
|
||||||
sub WriteReadings {
|
|
||||||
my $hash = shift;
|
|
||||||
my $decode_json = shift;
|
|
||||||
|
|
||||||
my $name = $hash->{NAME};
|
|
||||||
|
|
||||||
Log3 $name, 4, "HailoLibero ($name) - readings would be written";
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
####################################
|
####################################
|
||||||
####################################
|
####################################
|
||||||
#### my little helpers Sub's #######
|
#### my little helpers Sub's #######
|
||||||
|
Loading…
x
Reference in New Issue
Block a user