Use JSON bool in unifi scripts
This commit is contained in:
parent
f46a580f90
commit
4e50e2b2d4
|
@ -162,7 +162,7 @@ if ($unifi){
|
|||
}
|
||||
|
||||
foreach my $entry (@{from_json($resp->decoded_content)->{data}}){
|
||||
next if (not $entry->{ap_mac} or $entry->{ap_mac} ne $dev or $entry->{is_wired} == JSON::PP::true);
|
||||
next if (not $entry->{ap_mac} or $entry->{ap_mac} ne $dev or $entry->{is_wired} == JSON::true);
|
||||
foreach (@radio_proto){
|
||||
if ($entry->{radio_proto} eq $_){
|
||||
$json->{'num_sta_' . $_}++;
|
||||
|
@ -202,7 +202,7 @@ if ($unifi){
|
|||
$json->{last_seen} = time - $json->{last_seen};
|
||||
|
||||
# For wireless stations, we gather some more info
|
||||
if ($obj->{is_wired} == JSON::PP::false){
|
||||
if ($obj->{is_wired} == JSON::false){
|
||||
my @client_wireless = qw/rx_rate tx_rate essid ap_mac tx_power radio_proto signal noise satisfaction/;
|
||||
foreach (@client_wireless){
|
||||
$json->{$_} = $obj->{$_} || 0;
|
||||
|
|
|
@ -107,8 +107,8 @@ if ($what eq 'devices'){
|
|||
foreach my $entry (@{from_json($resp->decoded_content)->{data}}){
|
||||
# Ignore other sites
|
||||
next if ($entry->{site_id} ne $site_id);
|
||||
next if ($type eq 'wireless' and $entry->{is_wired} eq 'true');
|
||||
next if ($type eq 'wired' and $entry->{is_wired} eq 'false');
|
||||
next if ($type eq 'wireless' and $entry->{is_wired} == JSON::true);
|
||||
next if ($type eq 'wired' and $entry->{is_wired} == JSON::false);
|
||||
push @{$json->{data}}, {
|
||||
'{#UNIFI_STA_ID}' => $entry->{_id},
|
||||
'{#UNIFI_STA_NAME}' => (defined $entry->{hostname}) ? $entry->{hostname} : $entry->{mac},
|
||||
|
|
Loading…
Reference in New Issue