Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New versioning #39

Merged
merged 11 commits into from
Dec 21, 2024
Merged

New versioning #39

merged 11 commits into from
Dec 21, 2024

Conversation

edwardtfn
Copy link
Owner

@edwardtfn edwardtfn commented Dec 21, 2024

Summary by CodeRabbit

  • New Features

    • Introduced a new versioning workflow to automate versioning and tagging.
    • Added new light entities for enhanced relay control in the lighting system.
    • Implemented a new light entity for advanced LED control.
  • Bug Fixes

    • Improved error handling for light index access.
  • Documentation

    • Updated contributing guidelines to reflect changes in branch management.
    • Added comprehensive documentation for the new versioning system.
  • Chores

    • Removed obsolete configuration files related to light effects and internal settings.

Using YAML anchors instead.
It makes it cleaner and easier to understand.
Clean up LED files & new versioning
Copy link
Contributor

coderabbitai bot commented Dec 21, 2024

Warning

Rate limit exceeded

@edwardtfn has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 27 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ce8b4e7 and 7727c96.

📒 Files selected for processing (3)
  • .github/workflows/versioning.yml (1 hunks)
  • versioning/README.md (1 hunks)
  • versioning/bump_version.sh (1 hunks)

Walkthrough

This pull request introduces comprehensive changes across multiple files in the ESPHome project, focusing on workflow improvements, versioning, and LED configuration. The modifications include updating GitHub Actions workflows for validation and versioning, restructuring LED configuration files, and implementing an automated versioning system. The changes aim to enhance project management, streamline configuration, and provide more flexible light control mechanisms.

Changes

File Change Summary
.github/workflows/validate_esphome_beta.yml Reformatted workflow file with minor formatting adjustments
.github/workflows/versioning.yml New workflow for automated version bumping and tagging
ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml Significant restructuring of light entities and configurations
ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml Added new light entities for relay outputs
README.md Updated contributing guidelines, changed branch references
versioning/README.md Added comprehensive documentation for new versioning system
versioning/bump_version.sh New script for automated version management
Deleted Files core_hw_leds_light_base.yaml, core_hw_leds_light_effects.yaml, core_hw_leds_light_internal.yaml

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Workflow as GitHub Actions
    participant Repo as Repository

    Dev->>Repo: Push changes to main branch
    Workflow->>Repo: Trigger versioning workflow
    Workflow->>Workflow: Read current version
    Workflow->>Workflow: Calculate new version
    Workflow->>Repo: Update VERSION files
    Workflow->>Repo: Commit and tag new version
Loading

Poem

🐰 Hop, hop, version's on the rise!
Workflows dance, LEDs shine bright
Automated magic fills the skies
Coding rabbits, our delight
Version bumped with pure finesse! 🚀


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🔭 Outside diff range comments (2)
ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml (2)

Line range hint 784-853: Enhance error handling and logging in light state management.

The light state management script could benefit from improved error handling and more appropriate log levels.

Consider these improvements:

  1. Add validation for brightness values
  2. Use appropriate log levels for different scenarios
  3. Add error recovery mechanism
          switch (light_group) {
            case 1:
              if (light_index >= id(gb_lights_1).size()) {
-               ESP_LOGE("core_hw_leds", "Invalid set with %s light for Relay %" PRIu8,
+               ESP_LOGW("core_hw_leds", "Skipping invalid %s light for Relay %" PRIu8,
                                          light_mode_group_1.c_str(), light_index);
                return;
              }
              if (state and !id(gb_lights_1)[light_index]->current_values.is_on()) {
-               ESP_LOGI("core_hw_leds", "Turn-on %s light for Relay %" PRIu8,
+               ESP_LOGD("core_hw_leds", "Turn-on %s light for Relay %" PRIu8,
                                          light_mode_group_1.c_str(), light_index);
                auto call = id(gb_lights_1)[light_index]->turn_on();
                if (LIGHT_TRANSITION_TURN_ON > 0)
                  call.set_transition_length(LIGHT_TRANSITION_TURN_ON);  // in ms
-               if (LIGHT_BRIGHTNESS_TURN_ON > 0 and LIGHT_BRIGHTNESS_TURN_ON <= 100)
+               if (LIGHT_BRIGHTNESS_TURN_ON > 0 and LIGHT_BRIGHTNESS_TURN_ON <= 100) {
                  call.set_brightness(LIGHT_BRIGHTNESS_TURN_ON / 100.0f);
+               } else if (LIGHT_BRIGHTNESS_TURN_ON != 0) {
+                 ESP_LOGW("core_hw_leds", "Invalid brightness value: %d", LIGHT_BRIGHTNESS_TURN_ON);
+               }
                call.perform();
+               if (!id(gb_lights_1)[light_index]->current_values.is_on()) {
+                 ESP_LOGW("core_hw_leds", "Failed to turn on light");
+               }

Consider using esp32_rmt_led_strip platform instead of neopixelbus

Based on the codebase analysis, I found that the project already uses the esp32_rmt_led_strip platform in other configurations, which is a more modern and optimized approach for ESP32 devices. Instead of adding performance settings to neopixelbus, consider migrating to this platform:

  - id: light_full
    name: Light - All
    internal: true
    platform: esp32_rmt_led_strip
    rgb_order: GRB
    rmt_channel: 0
    chipset: ws2812
    max_refresh_rate: 33ms
    num_leds: 32
    pin: GPIO13

This matches the project's existing patterns and provides better out-of-the-box performance for ESP32 devices.

🔗 Analysis chain

Line range hint 37-47: Consider adding performance and stability settings.

The neopixelbus configuration could benefit from additional settings for better performance and stability.

Consider adding these recommended settings:

  - id: light_full
    name: Light - All
    internal: true
    platform: neopixelbus
    type: GRB
    variant: WS2811
-   # method: esp32_rmt
+   method: esp32_rmt
+   # Add performance settings
+   chip: esp32
+   channel: 0
+   dma_channel: 1
    num_leds: 32
    pin: GPIO13

Also, please verify if the esp32_rmt method is required for your hardware setup.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for other neopixelbus configurations in the codebase
rg -l 'platform:\s*neopixelbus.*method:\s*esp32_rmt' --type yaml

Length of output: 66


Script:

#!/bin/bash
# Let's try a broader search for neopixelbus configurations
rg -A 10 'platform:\s*neopixelbus' --type yaml

# Also search for any ESP32 RMT method mentions
rg -i 'esp32.*rmt|rmt.*esp32' --type yaml

Length of output: 1062


Script:

#!/bin/bash
# Let's check the ESP32 RMT LED strip configuration for comparison
rg -A 10 'platform:\s*esp32_rmt_led_strip' --type yaml

# Also check if there are any other LED strip configurations that might provide insights
rg -A 10 'platform:.*led.*strip' --type yaml

Length of output: 1553

🧹 Nitpick comments (4)
.github/workflows/versioning.yml (1)

24-26: Use more specific git configuration

The current git configuration uses generic values.

-          git config user.name "GitHub Actions"
-          git config user.email "[email protected]"
+          git config user.name "github-actions[bot]"
+          git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
versioning/README.md (1)

33-38: Clarify YAML include syntax

The YAML include syntax shown in the example might be confusing.

-  version: <<: !include ../versioning/VERSION
+  version: !include ../versioning/VERSION_YAML

Also add a note explaining that VERSION_YAML contains the version in YAML format while VERSION contains it in plain text.

ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml (2)

24-26: Improve substitution value types and documentation.

The substitutions use string values ('0') for numeric settings and have inconsistent comment formatting.

Apply this diff to improve the configuration:

-  LIGHT_TRANSITION_TURN_ON: '0'   # Transition time in msec
-  LIGHT_TRANSITION_TURN_OFF: '0'  # Transition time in msec
-  LIGHT_BRIGHTNESS_TURN_ON: '0'   # Brightness (1 to 100%, 0 to not set it)
+  # Transition time in milliseconds (0 to disable)
+  LIGHT_TRANSITION_TURN_ON: 0
+  LIGHT_TRANSITION_TURN_OFF: 0
+  # Brightness level (0 to disable, 1-100 for percentage)
+  LIGHT_BRIGHTNESS_TURN_ON: 0

55-92: Consider optimizing effect parameters for better visual appeal.

The light effects configuration could be enhanced with additional customization options for better visual experience.

Consider these optimizations:

      - addressable_rainbow:
          name: "Rainbow"
+         speed: 30
+         width: 50
      - pulse:
          name: "Pulse"
          transition_length: 1s
          update_interval: 1s
+         min_brightness: 0.2
      - addressable_fireworks:
          name: "Fireworks"
          update_interval: 32ms
          spark_probability: 10%
          use_random_color: false
          fade_out_rate: 120
+         spark_brightness: 0.8
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61a5d67 and ce8b4e7.

📒 Files selected for processing (10)
  • .github/workflows/validate_esphome_beta.yml (1 hunks)
  • .github/workflows/versioning.yml (1 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml (8 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds_light_base.yaml (0 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds_light_effects.yaml (0 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds_light_internal.yaml (0 hunks)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml (1 hunks)
  • README.md (1 hunks)
  • versioning/README.md (1 hunks)
  • versioning/bump_version.sh (1 hunks)
💤 Files with no reviewable changes (3)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds_light_internal.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds_light_base.yaml
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds_light_effects.yaml
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/validate_esphome_beta.yml
👮 Files not reviewed due to content moderation or server errors (1)
  • ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_relays.yaml
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/versioning.yml

21-21: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🪛 LanguageTool
versioning/README.md

[uncategorized] ~14-~14: Loose punctuation mark.
Context: ...t as plain text. - bump_version.sh: A script to increment the version based...

(UNLIKELY_OPENING_PUNCTUATION)


[uncategorized] ~15-~15: Loose punctuation mark.
Context: ... and release sequence. - README.md: Documentation for the versioning proces...

(UNLIKELY_OPENING_PUNCTUATION)


[style] ~43-~43: This phrase is redundant. Consider writing “point” or “time”.
Context: ...y**: Each version is tied to a specific point in time, making it easy to track releases. 2. *...

(MOMENT_IN_TIME)

🔇 Additional comments (2)
versioning/bump_version.sh (1)

3-4: ⚠️ Potential issue

Verify file paths are relative to repository root

The script assumes VERSION files are in ./versioning/, but this might fail if the script is executed from a different directory.

Consider using absolute paths based on script location:

-VERSION_FILE="./versioning/VERSION"
-VERSION_YAML_FILE="./versioning/VERSION_YAML"
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+VERSION_FILE="${SCRIPT_DIR}/VERSION"
+VERSION_YAML_FILE="${SCRIPT_DIR}/VERSION_YAML"
README.md (1)

101-103: LGTM! Branch strategy change aligns with versioning objectives.

The change from using dev to main as the base branch simplifies the workflow and aligns with the new versioning system.

Let's verify that this branching strategy is consistently documented throughout the repository:

✅ Verification successful

Branch strategy is consistently documented across the repository

The search results confirm that all branch-related documentation consistently refers to main as the target branch. The references found in versioning/README.md and README.md are aligned with the new branching strategy, and there are no lingering references to the old dev branch.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining references to the old 'dev' branch
# that might need updating

rg -i "dev branch|branch.*dev" --type md

Length of output: 42


Script:

#!/bin/bash
# Let's try a broader search for 'dev' references in markdown files
rg -i "\bdev\b" --type md

# Also search for any branch-related instructions
rg -i "branch" --type md

Length of output: 408

versioning/bump_version.sh Outdated Show resolved Hide resolved
versioning/bump_version.sh Show resolved Hide resolved
versioning/bump_version.sh Outdated Show resolved Hide resolved
.github/workflows/versioning.yml Outdated Show resolved Hide resolved
.github/workflows/versioning.yml Outdated Show resolved Hide resolved
versioning/README.md Show resolved Hide resolved
edwardtfn and others added 7 commits December 21, 2024 10:28
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@edwardtfn edwardtfn merged commit 21720d8 into main Dec 21, 2024
10 checks passed
@edwardtfn edwardtfn deleted the dev branch December 21, 2024 17:11
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