Skip to content

red#5420

Closed
shaulbarlev wants to merge 14 commits intowled:mainfrom
shaulbarlev:https
Closed

red#5420
shaulbarlev wants to merge 14 commits intowled:mainfrom
shaulbarlev:https

Conversation

@shaulbarlev
Copy link

@shaulbarlev shaulbarlev commented Mar 12, 2026

Summary by CodeRabbit

  • New Features
    • Added a Red Alert usermod for ESP32 that integrates with the Israeli Oref alerts API, automatically switching presets based on alert state (pre-alert, alert, clear)
    • Supports area-based filtering with configurable alert-state preset mappings and idle fallback timeout

shaulbarlev and others added 14 commits March 11, 2026 12:29
- Introduced new alert states: STATE_OK, STATE_PRE_ALERT, STATE_ALERT, STATE_END.
- Added configurable parameters for alert presets and idle timeout handling.
- Updated polling logic to determine alert state based on received JSON data.
- Removed deprecated alert rendering logic and replaced it with state-based updates.
- Improved JSON configuration handling for new alert parameters.
- Introduced new alert state handling for STATE_OK and improved JSON parsing for alert categories.
- Added support for additional alert presets and refined polling logic.
- Updated platformio.ini to include WLED_DEBUG for enhanced debugging capabilities.
- Added support for an "all areas" mode, allowing alerts to be triggered regardless of specific city names.
- Implemented area matching logic to compare city names against configured areas, improving alert accuracy.
- Updated JSON handling to accommodate new area matching requirements and ensure proper state transitions based on alerts.
- Introduced a normalized area name to streamline area matching logic.
- Updated area comparison to use the normalized name for improved accuracy.
- Added a method to refresh the normalized area name when necessary.
- Adjusted conditions to ensure proper handling of alerts based on the normalized area text.
- Introduced a new boolean parameter for verbose logging to enhance debugging capabilities.
- Updated logging statements to conditionally print detailed information based on the verboseLogs setting.
- Refactored JSON configuration handling to include the new verboseLogs parameter, ensuring it is properly saved and loaded.
- Introduced a new boolean parameter to enable or disable idle fallback handling.
- Updated JSON configuration to include new pretty labels for core, area, states, and idle settings.
- Refactored JSON loading and saving to maintain backward compatibility with legacy keys.
- Improved clarity of code comments and structure for better maintainability.
- Changed area name from "תל אביב - מזרח" to "תל אביב - מרכז" for better accuracy.
- Reduced default polling interval to 100 ms for more frequent updates.
- Enabled pre-alert and end alerts by default to enhance notification capabilities.
- Updated alert presets for better configuration options.
- Added support for HTTPS requests using WiFiClientSecure, allowing secure communication with the alert API.
- Implemented logic to handle potential non-JSON characters in API responses, improving robustness.
- Added logic to ignore alerts with category 0 or missing category, preventing unnecessary state changes.
- Updated handling for category 10 to treat it as an end/clear state, alongside category 13.
- Enhanced verbose logging for better debugging of ignored alerts based on category.
- Implemented logic to ignore alerts with category 0 or missing category, reducing unnecessary state changes.
- Updated handling for category 10 to function as an end/clear state, in addition to category 13.
- Enhanced verbose logging to improve debugging for ignored alerts based on category.
…unctionality

- Updated the README to clarify HTTPS requirements and installation steps.
- Added a section on live logging over WebSocket, detailing usermod and client-side implementation.
- Removed the reset URL button and associated logic from the usermod, streamlining the code and improving maintainability.
- Updated alert state logic to differentiate between pre-alert and end states based on the API title for category 10.
- Removed unused OK state handling and associated parameters to streamline the code.
- Enhanced documentation in the README to reflect changes in alert state definitions and configurations.
- Updated the alert state handling to utilize raw JSON payloads for distinguishing between pre-alert and end states in category 10.
- Introduced UTF-8 support for alert titles to improve compatibility with various payload formats.
- Enhanced documentation in the README to clarify the changes in alert state definitions and the rationale behind the new implementation.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 24440efb-342b-4076-8f4f-34c15b54f757

📥 Commits

Reviewing files that changed from the base of the PR and between e4cd730 and 5f2feb8.

📒 Files selected for processing (6)
  • platformio.ini
  • usermods/redalert/CATEGORY10_TITLE_MATCHING.md
  • usermods/redalert/library.json
  • usermods/redalert/readme.md
  • usermods/redalert/redalert.cpp
  • usermods/redalert/redalert_text_utils.h

Walkthrough

Adds a new WLED usermod "redalert" (Pikud Haoref) with polling, area-matching, and preset switching; supporting utilities and docs. Also updates platformio.ini to set esp32dev as default and introduces a typo (buiwd_unflags) in several env sections.

Changes

Cohort / File(s) Summary
PlatformIO config
platformio.ini
Switches default_envs to esp32dev, replaces audioreactive with redalert in custom_usermods, adds -D WLED_DEBUG build flag; multiple sections contain a typographical rename buiwd_unflags (should be build_unflags).
Redalert docs
usermods/redalert/readme.md, usermods/redalert/CATEGORY10_TITLE_MATCHING.md
Adds user-facing README and detailed technical note on distinguishing category 10 alerts via raw JSON Unicode-escaped substring matching and maintenance guidance.
Usermod implementation
usermods/redalert/redalert.cpp, usermods/redalert/redalert_text_utils.h, usermods/redalert/library.json
New UsermodPikudHaoref class with AlertState enum, HTTPS polling, JSON parsing (special handling for category 10), area matching, preset application, idle fallback, config IO, status reporting; plus Unicode escape decoding utilities and package manifest.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • custom_usermod improvements #5403 — Related redalert usermod registration and PlatformIO custom_usermods handling changes; touches usermod registration/build integration.

Suggested reviewers

  • softhack007
  • DedeHai
  • willmmiles
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@shaulbarlev shaulbarlev changed the title Https red Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant