Skip to content

Add combined Presence binary sensor#51

Open
bharvey88 wants to merge 2 commits intobetafrom
add-combined-presence-sensor
Open

Add combined Presence binary sensor#51
bharvey88 wants to merge 2 commits intobetafrom
add-combined-presence-sensor

Conversation

@bharvey88
Copy link
Contributor

@bharvey88 bharvey88 commented Mar 7, 2026

Summary

  • Adds a template binary sensor named `Presence` with `device_class: occupancy`
  • Combines LD2450 and LD2412 presence detection via OR logic — if either radar detects someone, the sensor is `on`
  • Provides a single clean presence entity to use in automations and dashboards

Test plan

  • Flash firmware and confirm `Presence` entity appears in HA under the device
  • Verify sensor turns `on` when either LD2450 or LD2412 detects presence
  • Verify sensor turns `off` when both radars report no presence

Summary by CodeRabbit

  • New Features
    • Added a new combined Presence sensor that consolidates occupancy detection from multiple presence sources into a single unified indicator.

@coderabbitai
Copy link

coderabbitai bot commented Mar 7, 2026

Warning

Rate limit exceeded

@bharvey88 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 19 minutes and 51 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e0f334bf-ad1c-4e3f-8062-7a32f6f3322b

📥 Commits

Reviewing files that changed from the base of the PR and between dc5bf95 and 1879612.

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

Walkthrough

A new template binary_sensor called Presence (id: combined_presence) was added to the ESPHome configuration. It uses device_class: occupancy and returns the logical OR of ld2450_presence and ld2412_presence to provide a unified occupancy signal.

Changes

Cohort / File(s) Summary
Combined Presence Sensor
Integrations/ESPHome/Core.yaml
Added a template binary_sensor named Presence (id: combined_presence) with device_class: occupancy; implements logical OR of ld2450_presence and ld2412_presence.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐇 I stitched two beacons into one bright tune,

When either wakes, I sing beneath the moon,
One hop, one beep, then both lights gleam,
A cozy signal, soft as cream,
Together they guard the quiet room,
I nibble joy — new presence blooms.

🚥 Pre-merge checks | ✅ 3
✅ 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 combined Presence binary sensor' directly and accurately summarizes the main change in the pull request, which adds a new template binary sensor that combines two presence detection sources.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 add-combined-presence-sensor

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

@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 `@Integrations/ESPHome/Core.yaml`:
- Around line 388-394: The new template binary_sensor "Presence" (id:
combined_presence) just adds an aggregate but does not suppress the original
sources, so Home Assistant will still log id(ld2450_presence) and
id(ld2412_presence); update the earlier definitions of ld2450_presence and
ld2412_presence to be internal/hidden (or set their internal: true / hidden:
true / restore: false as appropriate for ESPHome) or disable their Home
Assistant exposure so only combined_presence is exposed to HA and the logbook
noise is eliminated. Ensure you modify the existing binary_sensor declarations
for ld2450_presence and ld2412_presence (not the new combined_presence block) to
add the chosen hide/internal flag so those sensors stop emitting state changes
to Home Assistant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c54ab769-39d8-4ae8-974b-d0c7373e2cb9

📥 Commits

Reviewing files that changed from the base of the PR and between 4682c77 and 722629b.

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

Adds a template binary sensor that combines LD2450 and LD2412 presence
into a single occupancy entity. This gives users one clean logbook entry
for presence events instead of noise from both individual radar sensors.
@bharvey88 bharvey88 force-pushed the add-combined-presence-sensor branch from 722629b to dc5bf95 Compare March 7, 2026 19:39
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.

2 participants