-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
FREEBOX Plugin unable to parse data #927
Comments
Hi @brissou , Thanks for the report. I've tried to implement a fix. It would be great if you could test this. Can you please switch to the FYI @KayJay7 @Lucide this was the error.
The fix hopefully is: for host in hosts:
# Check if 'l3connectivities' exists and is a list
if "l3connectivities" in host and isinstance(host["l3connectivities"], list):
for ip in [ip for ip in host["l3connectivities"] if ip.get("reachable")]:
mac: str = host.get("l2ident", {}).get("id", "(unknown)")
if mac != '(unknown)':
plugin_objects.add_object(
primaryId=mac,
secondaryId=ip.get("addr", "0.0.0.0"),
watched1=host.get("primary_name", "(unknown)"),
watched2=host.get("vendor_name", "(unknown)"),
watched3=map_device_type(host.get("host_type", "")),
watched4=datetime.fromtimestamp(ip.get("last_time_reachable", 0)),
extra="",
foreignKey=mac,
)
else:
# Optional: Log or handle hosts without 'l3connectivities'
mylog("verbose", [f"[{pluginName}] Host missing 'l3connectivities': {host}"]) |
Hy @jokob-sk it works perfecty now ;) 12:56:59 [FREEBOX] In script |
Thanks for testing it! Glad it's working. |
The fix will ignore devices without If some devices have the field and some do not, I suppose this is an intended behaviour, not just an api version incompatibility. But I don't get when that would be the case: a device found by the box but without ip (be v4 or v6) connectivity🤔. @brissou The freebox api wrapper library supports v6 and ignores minor releases. In my case my box reports v For this purpose 6 is still ok. |
Hi @Lucide, Thanks for checking! Not sure what you mean by returning an empty array. Happy for you to submit a PR to improve on it further. |
Oh! my bad I meant missing field, not empty array. I've edited for clarity. I was wondering in what situation this would happen (and what it would mean). Your fix is correct! There's not much to do in this situation 🤷🏻♂️ |
Haha, all good - my brain was like "what am I missing here" 🤔😄 As always, thanks for all the help and support @Lucide |
Is there an existing issue for this?
The issue occurs in the following browsers. Select at least 2.
Current Behavior
Hy and thank for netalert x ;)
I'm not able to get devices names from freebox
FREEBOX Plugin add is OK
Pairing freebox with netalertX is OK
I tried to set the good version of API wich is 12.2 with my french Freebox Ultra but :
The data are well retrieved (you can see data in app/log)
But there is a parsing error
-> KeyError: 'l3connectivities'
Expected Behavior
Retrieve device name from freebox
Steps To Reproduce
No response
app.conf
docker-compose.yml
What branch are you running?
Production
app.log
app (3).log
Debug enabled
The text was updated successfully, but these errors were encountered: