- Implemented the REST Import plugin (rest_import.py) to handle importing data from REST APIs.
- Added functionality for configurable HTTP methods, authentication types, and custom headers.
- Included error handling for various HTTP response statuses and connection issues.
- Created unit tests for the plugin covering header building, path resolution, MAC validation, record mapping, and authentication methods.
- Ensured that module-level side effects are patched during tests to prevent live interactions.
Use 'l' instead of 'lease' (I see you little rabbit)
Use [] over get in most places, if expected fields are missing an error is an acceptable outcome.
Include 'text' field in logging.
Add logging for result '3'
- Use PEP 440-compliant parsing and comparison
- Fix issues with non-numeric segments (e.g. "beta", "rc")
- Add safe fallback for invalid version strings
- On failed controller version retrieval, attempt to use the v2 clients endpoint first and automatically fallback to the v1 endpoint if the v2 request fails.
- Improves compatibility with controllers where version detection is unreliable or unavailable.
The previous implementation derived the guest WiFi device MAC using a
custom MD5 hash of the Fritz!Box hardware MAC, producing a
locally-administered address with a 02: prefix. This was inconsistent
with the project-wide convention of using string_to_fake_mac() from
crypto_utils, which produces a fa:ce: prefixed address and is used by
all other plugins (nmap_dev_scan, adguard_import, pihole_api_scan, etc.).
A naive switch to string_to_fake_mac(host) would have introduced a
stability problem: if the user reconfigures FRITZBOX_HOST from an IP
address (e.g. 192.168.178.1) to a hostname (e.g. fritz.box), the fake
MAC would change and the guest device would re-appear as a new unknown
device in NetAlertX. The Fritz!Box hardware MAC is a stable identifier
that does not change with the configured host string.
Requested by reviewer jokob-sk in PR #1592.
Changes:
- Remove import hashlib (fritzbox.py:3) — no longer needed
- Add import string_to_fake_mac from utils.crypto_utils (fritzbox.py:15)
- Replace custom MD5-based MAC derivation in create_guest_wifi_device()
with string_to_fake_mac(normalize_mac(fritzbox_mac)) (fritzbox.py:178)
The Fritz!Box hardware MAC is fetched via TR-064 as before, but is now
passed to the shared project utility instead of a custom hash.
- Add host parameter to create_guest_wifi_device(fc, host) (fritzbox.py:169)
Used as fallback input to string_to_fake_mac() if the hardware MAC
cannot be retrieved.
- Update call site in main() to pass host (fritzbox.py:224)
The guest WiFi device MAC is now stable across host configuration changes
and consistent with the fa:ce: prefix convention used across the project.
Requested by reviewer jokob-sk in PR #1592.
Changes:
- Replace generic author "NetAlertX Community" with @sebingel
(README.md:204)
- Update release date from January 2026 to April 2026
(README.md:205)
- Remove license field from version section (README.md:206)
Project license is defined at repository level and does not need
to be repeated in individual plugin READMEs.
- Update repository link from jokob-sk/NetAlertX to netalertx/NetAlertX
(README.md:211)
The project was transferred to the netalertx organisation; the
canonical URL is now github.com/netalertx/NetAlertX.
The fritzconnection imports were originally placed inside the function
bodies as a defensive pattern: by catching ImportError locally,
get_fritzbox_connection() and get_connected_devices() could each return
None or an empty list with a user-friendly log message instead of
crashing at import time. This kept the plugin runnable even when the
dependency was missing.
Requested by reviewer jokob-sk in PR #1592: move all imports to the top
of the module, treating fritzconnection as a required dependency that is
assumed to be installed via requirements.txt.
Changes:
- Add top-level imports for FritzConnection and FritzHosts
(fritzbox.py:16-17)
- Remove inline import and ImportError handler from
get_fritzbox_connection() (fritzbox.py:48, 64-67)
- Remove inline import and ImportError handler from
get_connected_devices() (fritzbox.py:79, 133-134)
Functional behavior of the plugin is unchanged.
The device information table in README.md incorrectly stated that the
Connection Status field ("Active"/"Inactive") maps to devVendor in the
devices table. In reality, watchedValue2 has no mapped_to_column entry
in config.json, meaning the value is stored only in the plugin's own
Plugins_FRITZBOX table and never promoted to the Devices table. A user
following the documentation to filter or display Connection Status via
devVendor would find no data there.
Changes:
- Correct the "Mapped To" column for Connection Status (README.md:86)
Changed from "`devVendor` (shown as vendor field)" to "Plugin table
only (not mapped to device fields)" to accurately reflect config.json
behavior.
Users now have a correct expectation: Connection Status is visible in
the Fritz!Box plugin view but not in standard device columns. No
functional code was changed.