Skip to content

Conversation

@paradox460
Copy link

@paradox460 paradox460 commented Nov 20, 2025

Version: 25.8.6.1

What does this implement/fix?

Adds a general purpose Occupancy sensor, that aggregates the three zones into a single sensor.

This makes it easier to write automations that check "is there a person in this room?"

Using the radar target sensor isn't great, because it reports a lot of positives that don't trigger the various zone settings.

Types of changes

  • Bugfix (fixed change that fixes an issue)
  • New feature (thanks!)
  • Breaking change (repair/feature that breaks existing functionality)
  • Dependency Update - Does not publish
  • Other - Does not publish
  • Website of github readme file update - Does not publish
  • Github workflows - Does not publish

Checklist / Checklijst:

  • The code change has been tested and works locally
  • The code change has not yet been tested

If user-visible functionality or configuration variables are added/modified:

  • Added/updated documentation for the web page

Summary by CodeRabbit

  • New Features
    • Added a consolidated Radar Zone Occupancy sensor that combines occupancy detection from multiple radar zones into a single unified sensor.

✏️ Tip: You can customize this high-level summary in your review settings.

Adds a general occupancy sensor that serves as a union of all three zone sensors
@paradox460 paradox460 changed the base branch from main to beta November 20, 2025 20:42
@coderabbitai
Copy link

coderabbitai bot commented Dec 7, 2025

Walkthrough

A new binary_sensor template named "Radar Zone Occupancy" is added to the ESPHome configuration that aggregates three existing zone occupancy sensors using logical OR, providing a unified occupancy state across all radar zones.

Changes

Cohort / File(s) Summary
Binary Sensor Template Addition
Integrations/ESPHome/Core.yaml
Added new binary_sensor template "Radar Zone Occupancy" (id: radar_zone_occupancy) with device_class occupancy and icon mdi:motion-sensor. Returns true if any of the three radar zone occupancy sensors (radar_zone_1_occupancy, radar_zone_2_occupancy, radar_zone_3_occupancy) are active via logical OR operation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

🐰 Three zones now dance as one,
A rabbit's trick—OR finds the sum!
When motion stirs in any place,
One sensor shows the occupant's trace. ✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add general occupancy sensor' directly describes the main change—a new aggregated occupancy sensor combining three zone sensors into a single general-purpose sensor.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Copy link

@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: 0

🧹 Nitpick comments (1)
Integrations/ESPHome/Core.yaml (1)

323-332: Simple, effective aggregation logic — minor style suggestion for consistency.

The new Radar Zone Occupancy sensor correctly implements OR-aggregation of the three zone occupancy sensors. The lambda logic is sound and will update reactively when any zone state changes (no explicit update_interval needed).

One small consistency note: the id field is quoted as "radar_zone_occupancy" (line 325), while all other sensor IDs in the file are unquoted (e.g., line 257: radar_zone_1_occupancy). For consistency with the rest of the config, consider removing the quotes.

Optionally, a brief inline comment above the lambda could clarify the intent (e.g., # Aggregated occupancy: true if any zone has motion), but this is a nice-to-have rather than necessary.

Apply this diff for consistency:

  - platform: template
    name: "Radar Zone Occupancy"
-   id: "radar_zone_occupancy"
+   id: radar_zone_occupancy
    device_class: occupancy
    icon: mdi:motion-sensor
    lambda: |-
      bool zone1 = id(radar_zone_1_occupancy).state;
      bool zone2 = id(radar_zone_2_occupancy).state;
      bool zone3 = id(radar_zone_3_occupancy).state;
      return zone1 || zone2 || zone3;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d8e37d9 and 2aa81ee.

📒 Files selected for processing (1)
  • Integrations/ESPHome/Core.yaml (1 hunks)

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