2.8 KiB
2.8 KiB
Dead Functions Audit for TasmotaManager.py
Date: 2025-08-08 22:07 Scope: /home/mgeppert/git_work/scripts/TasmotaManager/TasmotaManager.py
Summary: No dead (unused) functions were found in TasmotaManager.py. All class methods and the top-level main() function are referenced either by other methods, the CLI entry flow, or the test suite.
Method usage highlights (non-exhaustive references):
-
UnifiClient
- init: Instantiated in main() via TasmotaDiscovery.setup_unifi_client()
- _login: Called by TasmotaDiscovery.setup_unifi_client() (line ~134)
- get_clients: Used in TasmotaDiscovery.get_tasmota_devices() and process_single_device()
-
TasmotaDiscovery
- init: Instantiated in main()
- load_config: Used in tests and main()
- setup_unifi_client: Used in main() and process_single_device()
- is_tasmota_device: Used in get_tasmota_devices()
- _match_pattern: Used by is_hostname_unknown, is_device_excluded, and hostname bug handling logic
- get_device_hostname: Used in get_device_details() and unknown-device logic; exercised by tests
- is_hostname_unknown: Used in multiple flows; exercised by tests
- is_device_excluded: Used in get_tasmota_devices(), get_device_details(), process_single_device(); exercised by tests
- get_tasmota_devices: Used in main(); exercised by tests
- save_tasmota_config: Used in main()
- get_unknown_devices: Used by process_unknown_devices()
- process_unknown_devices: Invoked when --process-unknown is provided; referenced in main() and docs
- check_and_update_template: Called via apply_config_other() and directly by tests
- configure_mqtt_settings: Called in get_device_details() (via check_mqtt_settings) and configure_unknown_device()
- apply_console_settings: Called from configure_mqtt_settings()
- apply_config_other: Called from get_device_details()
- configure_unknown_device: Called from unknown device flows and process_single_device()
- is_ip_in_network_filter: Used by process_single_device()
- process_single_device: Used by main() and tests (unknown device flows)
- get_device_details: Used by main() and process_single_device()
-
Module-level
- main(): Called by the if name == 'main' guard
Notes:
- Project-wide search across source and tests confirmed usage for each method. Example search hits include:
- is_hostname_unknown: test_pattern_matching.py, test_is_hostname_unknown.py, unifi_hostname_bug_* docs
- get_tasmota_devices: test_get_tasmota_devices.py and main()
- process_unknown_devices: main() and summary docs
- check_and_update_template: multiple tests including test_template_matching.py and test_blank_template_value.py
- get_device_hostname: test_get_device_hostname.py and internal flows
- is_device_excluded: test_is_device_excluded.py and internal flows
Conclusion: No dead functions identified; no removals performed.