From 8b05031e2e7913cec9447c370c51f2577a985603 Mon Sep 17 00:00:00 2001 From: Mike Geppert Date: Tue, 28 Oct 2025 00:21:08 +0000 Subject: [PATCH] moving items around --- data/.gitkeep | 0 .../get_device_hostname_function_design.md | 0 .../summaries/code_refactoring_summary.md | 0 .../console_duplicate_template_fix_summary.md | 0 .../summaries/console_settings_summary.md | 0 .../summaries/dead_functions_summary.md | 0 .../summaries/debug_format_changes_summary.md | 0 .../summaries/exclude_patterns_analysis.md | 0 ...exclude_patterns_implementation_summary.md | 0 .../summaries/fulltopic_equals_fix_summary.md | 0 .../summaries/fulltopic_fix_summary.md | 0 ..._device_hostname_implementation_summary.md | 0 .../summaries/implementation_summary.md | 0 ...hostname_unknown_implementation_summary.md | 0 .../pattern_matching_changes_summary.md | 0 .../process_unknown_optimization_summary.md | 0 .../summaries/regex_dot_explanation.md | 0 .../rule1_device_mode_fix_summary.md | 0 .../summaries/rule_enable_fix_summary.md | 0 .../summaries/rule_writing_fix_summary.md | 0 .../template_activation_fix_summary.md | 0 .../summaries/template_no_match_summary.md | 0 .../unifi_hostname_bug_explanation.md | 0 .../unifi_hostname_bug_fix_summary.md | 0 .../unifi_hostname_bug_handling_summary.md | 0 .../unifi_hostname_tracking_fix_summary.md | 0 .../unknown_device_patterns_analysis.md | 0 test_hostname_bug_check.md | 81 ------------------- .../test_blank_template_value.py | 0 .../test_command_retry.py | 0 .../test_fulltopic_approaches.py | 0 .../test_fulltopic_equals_issue.py | 0 .../test_fulltopic_fix.py | 0 .../test_get_device_hostname.py | 0 .../test_get_tasmota_devices.py | 0 .../test_hostname_matching.py | 0 .../test_is_device_excluded.py | 0 .../test_is_hostname_unknown.py | 0 .../test_pattern_matching.py | 0 .../test_process_unknown_optimization.py | 0 .../test_retain_parameters.py | 0 .../test_rule1_device_mode.py | 0 .../test_rule1_encoding.py | 0 .../test_rule_auto_enable.py | 0 .../test_template_activation.py | 0 .../test_template_matching.py | 0 .../test_template_no_match.py | 0 .../test_unifi_hostname_bug_fix.py | 0 .../test_unifi_hostname_bug_flag.py | 0 .../test_unknown_device_console_settings.py | 0 .../test_unknown_device_toggle.py | 0 51 files changed, 81 deletions(-) create mode 100644 data/.gitkeep rename get_device_hostname_function_design.md => docs/get_device_hostname_function_design.md (100%) rename code_refactoring_summary.md => docs/summaries/code_refactoring_summary.md (100%) rename console_duplicate_template_fix_summary.md => docs/summaries/console_duplicate_template_fix_summary.md (100%) rename console_settings_summary.md => docs/summaries/console_settings_summary.md (100%) rename dead_functions_summary.md => docs/summaries/dead_functions_summary.md (100%) rename debug_format_changes_summary.md => docs/summaries/debug_format_changes_summary.md (100%) rename exclude_patterns_analysis.md => docs/summaries/exclude_patterns_analysis.md (100%) rename exclude_patterns_implementation_summary.md => docs/summaries/exclude_patterns_implementation_summary.md (100%) rename fulltopic_equals_fix_summary.md => docs/summaries/fulltopic_equals_fix_summary.md (100%) rename fulltopic_fix_summary.md => docs/summaries/fulltopic_fix_summary.md (100%) rename get_device_hostname_implementation_summary.md => docs/summaries/get_device_hostname_implementation_summary.md (100%) rename implementation_summary.md => docs/summaries/implementation_summary.md (100%) rename is_hostname_unknown_implementation_summary.md => docs/summaries/is_hostname_unknown_implementation_summary.md (100%) rename pattern_matching_changes_summary.md => docs/summaries/pattern_matching_changes_summary.md (100%) rename process_unknown_optimization_summary.md => docs/summaries/process_unknown_optimization_summary.md (100%) rename regex_dot_explanation.md => docs/summaries/regex_dot_explanation.md (100%) rename rule1_device_mode_fix_summary.md => docs/summaries/rule1_device_mode_fix_summary.md (100%) rename rule_enable_fix_summary.md => docs/summaries/rule_enable_fix_summary.md (100%) rename rule_writing_fix_summary.md => docs/summaries/rule_writing_fix_summary.md (100%) rename template_activation_fix_summary.md => docs/summaries/template_activation_fix_summary.md (100%) rename template_no_match_summary.md => docs/summaries/template_no_match_summary.md (100%) rename unifi_hostname_bug_explanation.md => docs/summaries/unifi_hostname_bug_explanation.md (100%) rename unifi_hostname_bug_fix_summary.md => docs/summaries/unifi_hostname_bug_fix_summary.md (100%) rename unifi_hostname_bug_handling_summary.md => docs/summaries/unifi_hostname_bug_handling_summary.md (100%) rename unifi_hostname_tracking_fix_summary.md => docs/summaries/unifi_hostname_tracking_fix_summary.md (100%) rename unknown_device_patterns_analysis.md => docs/summaries/unknown_device_patterns_analysis.md (100%) delete mode 100644 test_hostname_bug_check.md rename test_blank_template_value.py => tests/test_blank_template_value.py (100%) rename test_command_retry.py => tests/test_command_retry.py (100%) rename test_fulltopic_approaches.py => tests/test_fulltopic_approaches.py (100%) rename test_fulltopic_equals_issue.py => tests/test_fulltopic_equals_issue.py (100%) rename test_fulltopic_fix.py => tests/test_fulltopic_fix.py (100%) rename test_get_device_hostname.py => tests/test_get_device_hostname.py (100%) rename test_get_tasmota_devices.py => tests/test_get_tasmota_devices.py (100%) rename test_hostname_matching.py => tests/test_hostname_matching.py (100%) rename test_is_device_excluded.py => tests/test_is_device_excluded.py (100%) rename test_is_hostname_unknown.py => tests/test_is_hostname_unknown.py (100%) rename test_pattern_matching.py => tests/test_pattern_matching.py (100%) rename test_process_unknown_optimization.py => tests/test_process_unknown_optimization.py (100%) rename test_retain_parameters.py => tests/test_retain_parameters.py (100%) rename test_rule1_device_mode.py => tests/test_rule1_device_mode.py (100%) rename test_rule1_encoding.py => tests/test_rule1_encoding.py (100%) rename test_rule_auto_enable.py => tests/test_rule_auto_enable.py (100%) rename test_template_activation.py => tests/test_template_activation.py (100%) rename test_template_matching.py => tests/test_template_matching.py (100%) rename test_template_no_match.py => tests/test_template_no_match.py (100%) rename test_unifi_hostname_bug_fix.py => tests/test_unifi_hostname_bug_fix.py (100%) rename test_unifi_hostname_bug_flag.py => tests/test_unifi_hostname_bug_flag.py (100%) rename test_unknown_device_console_settings.py => tests/test_unknown_device_console_settings.py (100%) rename test_unknown_device_toggle.py => tests/test_unknown_device_toggle.py (100%) diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/get_device_hostname_function_design.md b/docs/get_device_hostname_function_design.md similarity index 100% rename from get_device_hostname_function_design.md rename to docs/get_device_hostname_function_design.md diff --git a/code_refactoring_summary.md b/docs/summaries/code_refactoring_summary.md similarity index 100% rename from code_refactoring_summary.md rename to docs/summaries/code_refactoring_summary.md diff --git a/console_duplicate_template_fix_summary.md b/docs/summaries/console_duplicate_template_fix_summary.md similarity index 100% rename from console_duplicate_template_fix_summary.md rename to docs/summaries/console_duplicate_template_fix_summary.md diff --git a/console_settings_summary.md b/docs/summaries/console_settings_summary.md similarity index 100% rename from console_settings_summary.md rename to docs/summaries/console_settings_summary.md diff --git a/dead_functions_summary.md b/docs/summaries/dead_functions_summary.md similarity index 100% rename from dead_functions_summary.md rename to docs/summaries/dead_functions_summary.md diff --git a/debug_format_changes_summary.md b/docs/summaries/debug_format_changes_summary.md similarity index 100% rename from debug_format_changes_summary.md rename to docs/summaries/debug_format_changes_summary.md diff --git a/exclude_patterns_analysis.md b/docs/summaries/exclude_patterns_analysis.md similarity index 100% rename from exclude_patterns_analysis.md rename to docs/summaries/exclude_patterns_analysis.md diff --git a/exclude_patterns_implementation_summary.md b/docs/summaries/exclude_patterns_implementation_summary.md similarity index 100% rename from exclude_patterns_implementation_summary.md rename to docs/summaries/exclude_patterns_implementation_summary.md diff --git a/fulltopic_equals_fix_summary.md b/docs/summaries/fulltopic_equals_fix_summary.md similarity index 100% rename from fulltopic_equals_fix_summary.md rename to docs/summaries/fulltopic_equals_fix_summary.md diff --git a/fulltopic_fix_summary.md b/docs/summaries/fulltopic_fix_summary.md similarity index 100% rename from fulltopic_fix_summary.md rename to docs/summaries/fulltopic_fix_summary.md diff --git a/get_device_hostname_implementation_summary.md b/docs/summaries/get_device_hostname_implementation_summary.md similarity index 100% rename from get_device_hostname_implementation_summary.md rename to docs/summaries/get_device_hostname_implementation_summary.md diff --git a/implementation_summary.md b/docs/summaries/implementation_summary.md similarity index 100% rename from implementation_summary.md rename to docs/summaries/implementation_summary.md diff --git a/is_hostname_unknown_implementation_summary.md b/docs/summaries/is_hostname_unknown_implementation_summary.md similarity index 100% rename from is_hostname_unknown_implementation_summary.md rename to docs/summaries/is_hostname_unknown_implementation_summary.md diff --git a/pattern_matching_changes_summary.md b/docs/summaries/pattern_matching_changes_summary.md similarity index 100% rename from pattern_matching_changes_summary.md rename to docs/summaries/pattern_matching_changes_summary.md diff --git a/process_unknown_optimization_summary.md b/docs/summaries/process_unknown_optimization_summary.md similarity index 100% rename from process_unknown_optimization_summary.md rename to docs/summaries/process_unknown_optimization_summary.md diff --git a/regex_dot_explanation.md b/docs/summaries/regex_dot_explanation.md similarity index 100% rename from regex_dot_explanation.md rename to docs/summaries/regex_dot_explanation.md diff --git a/rule1_device_mode_fix_summary.md b/docs/summaries/rule1_device_mode_fix_summary.md similarity index 100% rename from rule1_device_mode_fix_summary.md rename to docs/summaries/rule1_device_mode_fix_summary.md diff --git a/rule_enable_fix_summary.md b/docs/summaries/rule_enable_fix_summary.md similarity index 100% rename from rule_enable_fix_summary.md rename to docs/summaries/rule_enable_fix_summary.md diff --git a/rule_writing_fix_summary.md b/docs/summaries/rule_writing_fix_summary.md similarity index 100% rename from rule_writing_fix_summary.md rename to docs/summaries/rule_writing_fix_summary.md diff --git a/template_activation_fix_summary.md b/docs/summaries/template_activation_fix_summary.md similarity index 100% rename from template_activation_fix_summary.md rename to docs/summaries/template_activation_fix_summary.md diff --git a/template_no_match_summary.md b/docs/summaries/template_no_match_summary.md similarity index 100% rename from template_no_match_summary.md rename to docs/summaries/template_no_match_summary.md diff --git a/unifi_hostname_bug_explanation.md b/docs/summaries/unifi_hostname_bug_explanation.md similarity index 100% rename from unifi_hostname_bug_explanation.md rename to docs/summaries/unifi_hostname_bug_explanation.md diff --git a/unifi_hostname_bug_fix_summary.md b/docs/summaries/unifi_hostname_bug_fix_summary.md similarity index 100% rename from unifi_hostname_bug_fix_summary.md rename to docs/summaries/unifi_hostname_bug_fix_summary.md diff --git a/unifi_hostname_bug_handling_summary.md b/docs/summaries/unifi_hostname_bug_handling_summary.md similarity index 100% rename from unifi_hostname_bug_handling_summary.md rename to docs/summaries/unifi_hostname_bug_handling_summary.md diff --git a/unifi_hostname_tracking_fix_summary.md b/docs/summaries/unifi_hostname_tracking_fix_summary.md similarity index 100% rename from unifi_hostname_tracking_fix_summary.md rename to docs/summaries/unifi_hostname_tracking_fix_summary.md diff --git a/unknown_device_patterns_analysis.md b/docs/summaries/unknown_device_patterns_analysis.md similarity index 100% rename from unknown_device_patterns_analysis.md rename to docs/summaries/unknown_device_patterns_analysis.md diff --git a/test_hostname_bug_check.md b/test_hostname_bug_check.md deleted file mode 100644 index 8776c49..0000000 --- a/test_hostname_bug_check.md +++ /dev/null @@ -1,81 +0,0 @@ -# Testing the UniFi OS Hostname Bug Check - -This document provides steps to test the changes made to remove the requirement to only look for the UniFi OS hostname bug in Device mode. - -## What Changed - -The code has been modified to check for the UniFi OS hostname bug whenever a device matches an unknown_device_pattern, regardless of whether it's in Device mode or not. This ensures more consistent behavior and better detection of devices affected by the UniFi OS hostname bug. - -## Test Plan - -### Test 1: Discovery Mode (get_tasmota_devices) - -1. Run TasmotaManager in discovery mode with debug logging: - ```bash - python TasmotaManager.py --debug - ``` - -2. Check the logs for messages about checking device's self-reported hostname: - - Look for log entries like: "Checking device's self-reported hostname for [device_name]" - - Look for log entries like: "UniFi OS hostname bug detected for [device_name]: self-reported hostname '[hostname]' doesn't match unknown patterns" - -3. Examine the current.json file to verify that devices have the `unifi_hostname_bug_detected` flag set correctly: - ```bash - grep -A 5 "unifi_hostname_bug_detected" current.json - ``` - -### Test 2: Device Mode (process_single_device) - -1. Find a device that matches an unknown_device_pattern but has a proper self-reported hostname: - - This could be a device that was recently renamed but UniFi still shows the old name - - Or a device that has a generic name in UniFi but a proper hostname on the device itself - -2. Run TasmotaManager in Device mode with the device's hostname or IP and debug logging: - ```bash - python TasmotaManager.py --Device [hostname_or_ip] --debug - ``` - -3. Check the logs for messages about checking device's self-reported hostname: - - Look for log entries like: "Checking device's self-reported hostname before declaring unknown" - - Look for log entries like: "Device NOT declared as unknown: self-reported hostname doesn't match unknown patterns (possible UniFi OS bug)" - -4. Examine the TasmotaDevices.json file to verify that the device has the `unifi_hostname_bug_detected` flag set correctly: - ```bash - grep -A 5 "unifi_hostname_bug_detected" TasmotaDevices.json - ``` - -### Test 3: Hostname Mode (process_single_device with hostname) - -1. Find a device that matches an unknown_device_pattern but has a proper self-reported hostname. - -2. Run TasmotaManager in Device mode with the device's hostname (not IP) and debug logging: - ```bash - python TasmotaManager.py --Device [hostname] --debug - ``` - -3. Check the logs to verify that the hostname bug check is still performed even though we're not using an IP address directly: - - Look for log entries like: "Checking device's self-reported hostname before declaring unknown" - -4. Examine the TasmotaDevices.json file to verify that the device has the `unifi_hostname_bug_detected` flag set correctly. - -## Expected Results - -- The hostname bug check should be performed for all devices that match unknown_device_patterns, regardless of whether they're processed in discovery mode or device mode. -- The `unifi_hostname_bug_detected` flag should be set to `true` for devices where: - 1. The UniFi-reported name matches an unknown_device_pattern - 2. The device's self-reported hostname does NOT match any unknown_device_pattern -- The device should NOT be declared as unknown if its self-reported hostname doesn't match any unknown_device_pattern, even if its UniFi-reported name does. - -## Troubleshooting - -If the tests don't produce the expected results: - -1. Verify that the device actually matches an unknown_device_pattern in UniFi: - - Check the device's name and hostname in UniFi - - Compare with the patterns in network_configuration.json - -2. Verify that the device's self-reported hostname doesn't match any unknown_device_pattern: - - You can manually check this by accessing the device's web interface - - Or by running: `curl http://[device_ip]/cm?cmnd=Status%205` - -3. Check for any errors in the logs that might indicate issues with connecting to the device or parsing its response. \ No newline at end of file diff --git a/test_blank_template_value.py b/tests/test_blank_template_value.py similarity index 100% rename from test_blank_template_value.py rename to tests/test_blank_template_value.py diff --git a/test_command_retry.py b/tests/test_command_retry.py similarity index 100% rename from test_command_retry.py rename to tests/test_command_retry.py diff --git a/test_fulltopic_approaches.py b/tests/test_fulltopic_approaches.py similarity index 100% rename from test_fulltopic_approaches.py rename to tests/test_fulltopic_approaches.py diff --git a/test_fulltopic_equals_issue.py b/tests/test_fulltopic_equals_issue.py similarity index 100% rename from test_fulltopic_equals_issue.py rename to tests/test_fulltopic_equals_issue.py diff --git a/test_fulltopic_fix.py b/tests/test_fulltopic_fix.py similarity index 100% rename from test_fulltopic_fix.py rename to tests/test_fulltopic_fix.py diff --git a/test_get_device_hostname.py b/tests/test_get_device_hostname.py similarity index 100% rename from test_get_device_hostname.py rename to tests/test_get_device_hostname.py diff --git a/test_get_tasmota_devices.py b/tests/test_get_tasmota_devices.py similarity index 100% rename from test_get_tasmota_devices.py rename to tests/test_get_tasmota_devices.py diff --git a/test_hostname_matching.py b/tests/test_hostname_matching.py similarity index 100% rename from test_hostname_matching.py rename to tests/test_hostname_matching.py diff --git a/test_is_device_excluded.py b/tests/test_is_device_excluded.py similarity index 100% rename from test_is_device_excluded.py rename to tests/test_is_device_excluded.py diff --git a/test_is_hostname_unknown.py b/tests/test_is_hostname_unknown.py similarity index 100% rename from test_is_hostname_unknown.py rename to tests/test_is_hostname_unknown.py diff --git a/test_pattern_matching.py b/tests/test_pattern_matching.py similarity index 100% rename from test_pattern_matching.py rename to tests/test_pattern_matching.py diff --git a/test_process_unknown_optimization.py b/tests/test_process_unknown_optimization.py similarity index 100% rename from test_process_unknown_optimization.py rename to tests/test_process_unknown_optimization.py diff --git a/test_retain_parameters.py b/tests/test_retain_parameters.py similarity index 100% rename from test_retain_parameters.py rename to tests/test_retain_parameters.py diff --git a/test_rule1_device_mode.py b/tests/test_rule1_device_mode.py similarity index 100% rename from test_rule1_device_mode.py rename to tests/test_rule1_device_mode.py diff --git a/test_rule1_encoding.py b/tests/test_rule1_encoding.py similarity index 100% rename from test_rule1_encoding.py rename to tests/test_rule1_encoding.py diff --git a/test_rule_auto_enable.py b/tests/test_rule_auto_enable.py similarity index 100% rename from test_rule_auto_enable.py rename to tests/test_rule_auto_enable.py diff --git a/test_template_activation.py b/tests/test_template_activation.py similarity index 100% rename from test_template_activation.py rename to tests/test_template_activation.py diff --git a/test_template_matching.py b/tests/test_template_matching.py similarity index 100% rename from test_template_matching.py rename to tests/test_template_matching.py diff --git a/test_template_no_match.py b/tests/test_template_no_match.py similarity index 100% rename from test_template_no_match.py rename to tests/test_template_no_match.py diff --git a/test_unifi_hostname_bug_fix.py b/tests/test_unifi_hostname_bug_fix.py similarity index 100% rename from test_unifi_hostname_bug_fix.py rename to tests/test_unifi_hostname_bug_fix.py diff --git a/test_unifi_hostname_bug_flag.py b/tests/test_unifi_hostname_bug_flag.py similarity index 100% rename from test_unifi_hostname_bug_flag.py rename to tests/test_unifi_hostname_bug_flag.py diff --git a/test_unknown_device_console_settings.py b/tests/test_unknown_device_console_settings.py similarity index 100% rename from test_unknown_device_console_settings.py rename to tests/test_unknown_device_console_settings.py diff --git a/test_unknown_device_toggle.py b/tests/test_unknown_device_toggle.py similarity index 100% rename from test_unknown_device_toggle.py rename to tests/test_unknown_device_toggle.py