Skip to content

Climate chip visibility control & inverted Kelvin color temperature fix#36

Merged
edwardtfn merged 4 commits intomainfrom
v9999.99.9
Mar 4, 2026
Merged

Climate chip visibility control & inverted Kelvin color temperature fix#36
edwardtfn merged 4 commits intomainfrom
v9999.99.9

Conversation

@edwardtfn
Copy link
Copy Markdown
Owner

@edwardtfn edwardtfn commented Mar 4, 2026

Improvements

  • Climate chip visibility control: The previous "Always Show Chip" toggle has been replaced by a three-option selector — Active only (default), Always, or Never — giving more granular control over when the climate chip is shown on the home screen

Bug Fixes

  • Inverted Kelvin color temperature slider: Corrected the slider range mapping for accurate Kelvin scale control

Other Changes

  • Temperature display now includes the Kelvin unit indicator (K)
  • Updated minimum version requirements from 4 to 5 for Kelvin-based light color temperature

⚠️ Migration Note

The climate_chip_always_visible boolean input has been removed. Please update your blueprint automation:

Previous setting New setting
climate_chip_always_visible: false (default) climate_chip_visibility: active_only
climate_chip_always_visible: true climate_chip_visibility: always

If you haven't customized this setting, no action is needed — the new default (active_only) preserves the previous behaviour.

Summary by CodeRabbit

  • New Features

    • Kelvin temperatures now display with "K"
    • New climate visibility setting: Active only / Always / Never
  • Bug Fixes

    • Fixed Kelvin temperature slider mapping (inverted to match Kelvin scale)
  • Chores

    • Minimum blueprint/home assistant requirement bumped (release/version increased)

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 4, 2026

Warning

Rate limit exceeded

@edwardtfn has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 6 minutes and 54 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.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8f235a63-7f3e-4393-9823-b186dc021abd

📥 Commits

Reviewing files that changed from the base of the PR and between fd8077a and f7f7a82.

📒 Files selected for processing (1)
  • esphome/nspanel_esphome_addon_climate_base.yaml
📝 Walkthrough

Walkthrough

Minimum blueprint/TFT versions bumped to 5; HMI boot files' version Text updated to 5; tempslider bounds swapped (inverted) across light configs; blueprint adds climate_chip_visibility selector and Kelvin "K" suffixes; addon introduces visibility enum and visibility-based icon rendering and restore.

Changes

Cohort / File(s) Summary
ESPhome version file
esphome/nspanel_esphome_version.yaml
Minimum blueprint and TFT version requirements increased from 45.
Blueprint changes
nspanel_easy_blueprint.yaml
Blueprint release and public blueprint_version bumped 45; homeassistant.min_version -> 2026.1.0; climate_chip_always_visible replaced by climate_chip_visibility (select with Active/Always/Never); Kelvin temp displays append "K"; Kelvin tempslider min/max mapping inverted; references updated across pages and actions.
New enum & addon logic
components/nspanel_easy/addon_climate.h, esphome/nspanel_esphome_addon_climate_base.yaml
Added ClimateChipVisibility enum; added climate_chip_visibility global (restore/default); action handler to accept visibility on boot (page "mem"); visibility gating and logging applied to climate icon rendering and state-change paths.
HMI boot files
hmi/dev/*/boot.txt
hmi/dev/nspanel_CJK_eu_code/boot.txt, hmi/dev/nspanel_CJK_us_code/boot.txt, hmi/dev/nspanel_CJK_us_land_code/boot.txt, hmi/dev/nspanel_eu_code/boot.txt, hmi/dev/nspanel_us_code/boot.txt, hmi/dev/nspanel_us_land_code/boot.txt
Global Variable (string) version) Text attribute updated from 45 in all locale variants.
HMI light files (tempslider)
hmi/dev/*/light.txt
hmi/dev/nspanel_CJK_eu_code/light.txt, hmi/dev/nspanel_CJK_us_code/light.txt, hmi/dev/nspanel_CJK_us_land_code/light.txt, hmi/dev/nspanel_eu_code/light.txt, hmi/dev/nspanel_us_code/light.txt, hmi/dev/nspanel_us_land_code/light.txt
Temperature slider tempslider bounds swapped: previous upper 6535 / lower 2000 → now upper 2000 / lower 6535 (inverted range) across all variants.

Sequence Diagram(s)

sequenceDiagram
    participant Nextion as NSPanel UI
    participant Blueprint as Blueprint (nspanel_easy)
    participant ESPHome as ESPhome addon (addon_climate)
    participant Storage as Global Restore

    Note over Blueprint,ESPHome: Boot / initialization flow for climate visibility

    Blueprint->>ESPHome: send action_component_val(page:"mem", key:"climate_chip_visibility", val)
    ESPHome->>ESPHome: parse value -> set global climate_chip_visibility
    ESPHome->>Storage: store climate_chip_visibility (restore)
    Nextion->>ESPHome: request update_climate_icon / render
    ESPHome->>ESPHome: evaluate climate_chip_visibility (NEVER/ALWAYS/ACTIVE_ONLY)
    alt Visible
        ESPHome->>Nextion: send icon/color update
    else Hidden
        ESPHome->>Nextion: send NONE / BLACK (no icon)
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 I hopped in code with tiny paws,
Tucked a "K" behind the Kelvin laws,
Flipped sliders, set visibility to three,
Restored preferences safe as can be —
A little rabbit's dev-time applause!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix inverted light temperature slider in Kelvin' accurately describes the main change: correcting an inverted Kelvin temperature slider range mapping.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch v9999.99.9

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.

Copy link
Copy Markdown
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: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hmi/dev/nspanel_CJK_us_code/light.txt`:
- Around line 687-688: The tempslider bounds are inverted: swap the two numeric
values so the Upper range limit is 6535 and the Lower range limit is 2000;
update the "Upper range limit" and "Lower range limit" entries for the
tempslider block (currently showing 2000 and 6535) to the corrected values to
restore proper slider/Kelvin behavior.

In `@hmi/dev/nspanel_CJK_us_land_code/light.txt`:
- Around line 687-688: The tempslider bounds are inverted: the "Upper range
limit" and "Lower range limit" lines currently put Upper at 2000 and Lower at
6535; update the tempslider bounds so the upper bound is 6535 and the lower
bound is 2000 by swapping the values on the existing "Upper range limit" and
"Lower range limit" entries (look for the tempslider/kelvin slider block
containing those two lines) so the slider domain is valid and interactive.

In `@hmi/dev/nspanel_eu_code/light.txt`:
- Around line 687-688: The tempslider's Kelvin bounds are inverted (Upper range
limit is 2000 and Lower range limit is 6535) which breaks color_temp_kelvin
forwarded to esphome/nspanel_esphome_page_light.yaml; fix by swapping the values
so the Upper range limit is 6535 and the Lower range limit is 2000 (restore
normal min/max for tempslider to match the color_temp_kelvin domain).

In `@hmi/dev/nspanel_us_land_code/light.txt`:
- Around line 687-688: The tempslider range was inverted (Upper and Lower values
swapped), making the slider invalid; locate the tempslider configuration where
"Upper range limit" and "Lower range limit" are set and restore them to
Upper=6535 and Lower=2000 so the min→max ordering is correct (i.e., swap the
current values back to Upper 6535, Lower 2000).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6a0958c-1ca4-4cf4-832c-338f2ab872dc

📥 Commits

Reviewing files that changed from the base of the PR and between 2c8c4bc and 928bdeb.

📒 Files selected for processing (26)
  • esphome/nspanel_esphome_version.yaml
  • hmi/dev/nspanel_CJK_eu_code/boot.txt
  • hmi/dev/nspanel_CJK_eu_code/light.txt
  • hmi/dev/nspanel_CJK_us_code/boot.txt
  • hmi/dev/nspanel_CJK_us_code/light.txt
  • hmi/dev/nspanel_CJK_us_land_code/boot.txt
  • hmi/dev/nspanel_CJK_us_land_code/light.txt
  • hmi/dev/nspanel_eu_code/boot.txt
  • hmi/dev/nspanel_eu_code/light.txt
  • hmi/dev/nspanel_us_code/boot.txt
  • hmi/dev/nspanel_us_code/light.txt
  • hmi/dev/nspanel_us_land_code/boot.txt
  • hmi/dev/nspanel_us_land_code/light.txt
  • hmi/nspanel_CJK_eu.HMI
  • hmi/nspanel_CJK_eu.tft
  • hmi/nspanel_CJK_us.HMI
  • hmi/nspanel_CJK_us.tft
  • hmi/nspanel_CJK_us_land.HMI
  • hmi/nspanel_CJK_us_land.tft
  • hmi/nspanel_eu.HMI
  • hmi/nspanel_eu.tft
  • hmi/nspanel_us.HMI
  • hmi/nspanel_us.tft
  • hmi/nspanel_us_land.HMI
  • hmi/nspanel_us_land.tft
  • nspanel_easy_blueprint.yaml

Copy link
Copy Markdown
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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@esphome/nspanel_esphome_addon_climate_base.yaml`:
- Around line 394-397: The visibility check erroneously treats
CLIMATE_ACTION_IDLE as "active"; update the active-range logic used with
id(climate_chip_visibility) and the is_active boolean so
CLIMATE_CHIP_ACTIVE_ONLY excludes CLIMATE_ACTION_IDLE (value
CLIMATE_ACTION_IDLE) — i.e., consider only heating/cooling/drying/fan actions
between CLIMATE_ACTION_COOLING and CLIMATE_ACTION_FAN but skip the idle action
when computing is_active; make the same change for the other occurrence handling
visibility (the block around the second check). Ensure you reference
nspanel_easy::ClimateChipVisibility, CLIMATE_CHIP_ACTIVE_ONLY, is_active,
CLIMATE_ACTION_COOLING, CLIMATE_ACTION_IDLE, and CLIMATE_ACTION_FAN when
updating the conditions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ed5b64c4-3c12-4d1d-a626-0e9d39b746c7

📥 Commits

Reviewing files that changed from the base of the PR and between 928bdeb and bca5f16.

📒 Files selected for processing (3)
  • components/nspanel_easy/addon_climate.h
  • esphome/nspanel_esphome_addon_climate_base.yaml
  • nspanel_easy_blueprint.yaml

@edwardtfn edwardtfn changed the title Fix inverted light temperature slider in Kelvin Climate chip visibility control & inverted Kelvin color temperature fix Mar 4, 2026
Copy link
Copy Markdown
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: 1

🧹 Nitpick comments (1)
esphome/nspanel_esphome_addon_climate_base.yaml (1)

103-105: Sanitize incoming climate_chip_visibility before storing.

Line 104 currently trusts val and casts directly to uint8_t. Clamping to known enum range avoids invalid persisted/runtime states.

Proposed refactor
           if (component == "climate_chip_visibility") {
-            id(climate_chip_visibility) = static_cast<uint8_t>(val);
+            const bool valid = (val >= static_cast<int>(nspanel_easy::CLIMATE_CHIP_ACTIVE_ONLY) &&
+                                val <= static_cast<int>(nspanel_easy::CLIMATE_CHIP_NEVER));
+            id(climate_chip_visibility) = valid
+              ? static_cast<uint8_t>(val)
+              : static_cast<uint8_t>(nspanel_easy::CLIMATE_CHIP_ACTIVE_ONLY);
+            if (!valid) {
+              ESP_LOGW("${TAG_ADDON_CLIMATE}", "Invalid climate_chip_visibility: %d. Falling back to ACTIVE_ONLY.", val);
+            }
             ESP_LOGV("${TAG_ADDON_CLIMATE}", "climate_chip_visibility: %" PRIu8, id(climate_chip_visibility));
           }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@esphome/nspanel_esphome_addon_climate_base.yaml` around lines 103 - 105, The
code directly casts val into id(climate_chip_visibility) without validation;
validate and clamp val to the allowed enum range before assigning to
id(climate_chip_visibility) to avoid invalid persisted/runtime states — e.g.,
compute a sanitized_value = std::max(min_enum_value, std::min(max_enum_value,
val)) using the known enum bounds for climate_chip_visibility and then assign
id(climate_chip_visibility) = static_cast<uint8_t>(sanitized_value), updating
the ESP_LOGV call to log the sanitized_value; locate this logic where component
== "climate_chip_visibility" and replace the direct static_cast with the
clamping step.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@esphome/nspanel_esphome_addon_climate_base.yaml`:
- Around line 415-426: The code only sets icon/color when action ==
nspanel_easy::CLIMATE_ACTION_OFF or is_active, so when visible == ALWAYS and
action is IDLE the chip is left as Icons::NONE; update the branch in the visible
handling to also assign icon/color for idle (or any non-active non-OFF action)
by using climate_action_icons[action].icon and .color (or specifically handle
nspanel_easy::CLIMATE_ACTION_IDLE) so IDLE renders correctly; look for the
visible check and the action/is_active logic to add this assignment.

---

Nitpick comments:
In `@esphome/nspanel_esphome_addon_climate_base.yaml`:
- Around line 103-105: The code directly casts val into
id(climate_chip_visibility) without validation; validate and clamp val to the
allowed enum range before assigning to id(climate_chip_visibility) to avoid
invalid persisted/runtime states — e.g., compute a sanitized_value =
std::max(min_enum_value, std::min(max_enum_value, val)) using the known enum
bounds for climate_chip_visibility and then assign id(climate_chip_visibility) =
static_cast<uint8_t>(sanitized_value), updating the ESP_LOGV call to log the
sanitized_value; locate this logic where component == "climate_chip_visibility"
and replace the direct static_cast with the clamping step.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ce5d98dc-e237-453e-bfe9-ce82e4906ce0

📥 Commits

Reviewing files that changed from the base of the PR and between bca5f16 and fd8077a.

📒 Files selected for processing (1)
  • esphome/nspanel_esphome_addon_climate_base.yaml

@edwardtfn edwardtfn merged commit 649d38f into main Mar 4, 2026
29 checks passed
@edwardtfn edwardtfn deleted the v9999.99.9 branch March 4, 2026 23:03
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