Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Avoid sending wifi clients if there isn't any #148

Merged
merged 2 commits into from
Feb 11, 2025

Conversation

stargieg
Copy link
Contributor

@stargieg stargieg commented Feb 3, 2025

Invalid data in "#/interfaces/3/wireless/clients", validator says:

{} is not of type 'array'

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

```
Invalid data in "#/interfaces/3/wireless/clients", validator says:

{} is not of type 'array'
```
@stargieg
Copy link
Contributor Author

stargieg commented Feb 3, 2025

I'm working on an other fix for
This can Fix #101 and #102

Invalid data in "#/interfaces/4/wireless/clients/5/vht", validator says:

None is not of type 'boolean'

looks like this

diff --git a/openwisp-monitoring/files/lib/openwisp-monitoring/wifi.lua b/openwisp-monitoring/files/lib/openwisp-monitoring/wifi.lua
index b38d548..12fdd7c 100644
--- a/openwisp-monitoring/files/lib/openwisp-monitoring/wifi.lua
+++ b/openwisp-monitoring/files/lib/openwisp-monitoring/wifi.lua
@@ -30,6 +30,9 @@ function wifi.parse_hostapd_clients(clients)
   local data = {}
   for mac, properties in pairs(clients) do
     properties.mac = mac
+    if properties.ht and properties.ht == "None" then properties.ht = false end
+    if properties.vht and properties.vht == "None" then properties.vht = false end
+    if properties.he and properties.he == "None" then properties.he = false end
     table.insert(data, properties)
   end
   if #data > 0 then return data end

WIP Testing

@stargieg
Copy link
Contributor Author

stargieg commented Feb 7, 2025

The message in openwisp2.log:

[INFO 2025-02-07 13:56:57,767] module: views, process: 135817, thread: 139275812288320
Invalid data in "#/interfaces/3/wireless/clients/1/he", validator says:

None is not of type 'boolean'

[WARNING 2025-02-07 13:56:57,768] module: log, process: 135817, thread: 139275812288320
Bad Request: /api/v1/monitoring/device/d94***569/

correlate with logread message:

host: 'ap7.***.net'
d94***569
Fri Feb  7 13:56:57 2025 daemon.err openwisp-monitoring[9358]: cat: can't open '/tmp/openwisp/monitoring/07-02-2025_12:56:57': No such file or directory

and come from:

WIP

@nemesifier nemesifier merged commit ec8baa6 into openwisp:master Feb 11, 2025
1 of 2 checks passed
@nemesifier nemesifier changed the title fix Invalid data in openwisp2.log [fix] Avoid sending wifi clients if there isn't any Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants