Merge pull request 'fixes + fw info' (#3) from patch-device_info into master

Reviewed-on: #3
This commit is contained in:
Sebastian Schwaz 2021-06-05 19:46:40 +02:00
commit 381526d2fa
3 changed files with 18 additions and 6 deletions

View File

@ -190,7 +190,7 @@ sub Initialize {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v1.1.7",
"version": "v1.1.8",
"author": [
"Sebastian Schwarz <ema@il.local>"
],

View File

@ -1,2 +1,2 @@
UPD 2021-06-04_14:34:38 5174 FHEM/73_HailoLibero.pm
UPD 2021-06-04_21:35:27 12105 lib/FHEM/Hailo/Libero.pm
UPD 2021-06-05_19:18:40 5174 FHEM/73_HailoLibero.pm
UPD 2021-06-05_19:43:39 12804 lib/FHEM/Hailo/Libero.pm

View File

@ -325,8 +325,8 @@ sub Write {
Log3 $name, 4,
"HailoLibero ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method";
Log3($name, 3,
"HailoLibero ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
# Log3($name, 3,
# "HailoLibero ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
return;
}
@ -358,12 +358,23 @@ sub ErrorHandling {
if ($data eq 'OK'){
getSettings($hash);
}elsif (length($data) > 3 ){
my ($deviceid) = ($data =~ /Libero30_[[:xdigit:]]{6}/g);
my ($swversion) = ($data =~ /SW Version:(\d.\d.\d)/g);
my ($wifi_ssid) = ($data =~ /STA-SSID:(\w+)/g);
my ($wifi_ip) = ($data =~ /STA-IP:(\w+.\w+.\w+.\w+)/g);
my ($wifi_netmask) = ($data =~ /STA-Subnet Mask:(\w+.\w+.\w+.\w+)/g);
my ($led_brightness) = ($data =~ /led'>(\d*)/g);
my ($eject_power) = ($data =~ /pwr'>(\d*)/g);
my ($detection_area) = ($data =~ /dist'>(\d*)/g);
my ($detection_sensitivity) = ($data =~ /delay'>(\d*)/g);
my ($eject_delay) = ($data =~ /pdelay'>(\d*)/g);
readingsBeginUpdate($hash);
readingsBulkUpdateIfChanged($hash, 'device', $deviceid);
readingsBulkUpdateIfChanged($hash, 'firmware', $swversion);
readingsBulkUpdateIfChanged($hash, 'wifi-ssid', $wifi_ssid);
readingsBulkUpdateIfChanged($hash, 'wifi-ip', $wifi_ip);
readingsBulkUpdateIfChanged($hash, 'wifi-subnet', $wifi_netmask);
readingsBulkUpdateIfChanged($hash, 'led_brightness', $led_brightness);
readingsBulkUpdateIfChanged($hash, 'eject_power', $eject_power);
readingsBulkUpdateIfChanged($hash, 'detection_area', $detection_area);
@ -394,10 +405,11 @@ sub createHttpValueStrings {
&& $payload ne ''){
$uri .= '/settings';
} elsif ( $payload eq 'open'){
$method = 'GET';
$uri .= '/push';
}else {
$uri .= '/admin';
$method = 'GET';
$uri .= '/admin';
}
return ( $payload, $header, $uri, $method );
}