Conversation
sync: main back into develop
docs: add hardware preflight check
ha-llm-bot
left a comment
There was a problem hiding this comment.
Reviewed for develop to main promotion.
ha-llm-bot
left a comment
There was a problem hiding this comment.
Reviewed for develop to main promotion.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a hardware preflight check to ensure proper configuration and connectivity before performing OTA uploads to HiveTech devices. It also updates documentation to reflect the new preflight process and clarifies current limitations. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a useful hardware preflight check script and updates the documentation accordingly. The script is well-structured, but I've found a logic issue in how it validates the config.h file and checks for MQTT broker connectivity. The current implementation can lead to confusing or incomplete results if multiple configuration issues are present. I've suggested a refactoring to make these checks more robust and independent. The documentation changes are clear and accurate.
| else: | ||
| values = _read_config_values(config_path) | ||
| missing_keys = [key for key in ("ssid", "password", "mqtt_server") if key not in values] | ||
| if missing_keys: | ||
| results.append(CheckResult("config.h", False, f"missing keys: {', '.join(missing_keys)}")) | ||
| else: | ||
| placeholders = [key for key, value in values.items() if value in PLACEHOLDER_VALUES] | ||
| if placeholders: | ||
| results.append(CheckResult("config.h", False, f"placeholder values still set: {', '.join(placeholders)}")) | ||
| else: | ||
| results.append(CheckResult("config.h", True, "real local credentials/config detected")) | ||
|
|
||
| mqtt_host = values.get("mqtt_server", "") | ||
| if mqtt_host: | ||
| results.append(_check_host(mqtt_host, 1883)) |
There was a problem hiding this comment.
The logic for checking config.h and the MQTT host can be improved. The current nested structure has a few issues:
- If some keys are missing from
config.h(e.g.,ssid), the check for MQTT host connectivity is skipped, even ifmqtt_serveris correctly defined. This can lead to incomplete diagnostics. - If
mqtt_serveris set to a placeholder value, the script reports it as a placeholder but then still attempts a connection to that placeholder value, resulting in a redundant failure message.
I suggest refactoring this block to flatten the logic. This will ensure that all relevant checks are performed independently and that error messages are not duplicated.
| else: | |
| values = _read_config_values(config_path) | |
| missing_keys = [key for key in ("ssid", "password", "mqtt_server") if key not in values] | |
| if missing_keys: | |
| results.append(CheckResult("config.h", False, f"missing keys: {', '.join(missing_keys)}")) | |
| else: | |
| placeholders = [key for key, value in values.items() if value in PLACEHOLDER_VALUES] | |
| if placeholders: | |
| results.append(CheckResult("config.h", False, f"placeholder values still set: {', '.join(placeholders)}")) | |
| else: | |
| results.append(CheckResult("config.h", True, "real local credentials/config detected")) | |
| mqtt_host = values.get("mqtt_server", "") | |
| if mqtt_host: | |
| results.append(_check_host(mqtt_host, 1883)) | |
| else: | |
| values = _read_config_values(config_path) | |
| missing_keys = {key for key in ("ssid", "password", "mqtt_server") if key not in values} | |
| placeholders = {key for key, value in values.items() if value in PLACEHOLDER_VALUES} | |
| if missing_keys: | |
| results.append(CheckResult("config.h", False, f"missing keys: {', '.join(sorted(missing_keys))}")) | |
| elif placeholders: | |
| results.append(CheckResult("config.h", False, f"placeholder values still set: {', '.join(sorted(placeholders))}")) | |
| else: | |
| results.append(CheckResult("config.h", True, "real local credentials/config detected")) | |
| # Check MQTT host if it is defined and not a placeholder value. | |
| mqtt_host = values.get("mqtt_server") | |
| if mqtt_host and "mqtt_server" not in placeholders: | |
| results.append(_check_host(mqtt_host, 1883)) |
Summary
Verification