Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions content/components/dfrobot_c4001.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: "DFRobot C4001 Radar Sensor"
description: "Support for the DFRobot C4001 mmWave radar sensor in ESPHome."
---

## Example configuration

```yaml
uart:
id: uart_bus
tx_pin: GPIO1
rx_pin: GPIO3
baud_rate: 9600

external_components:
- source:
type: git
url: https://github.com/96liuzhixin/esphome
ref: dev
components:
dfrobot_c4001

Comment on lines +15 to +22
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

❓ Verification inconclusive

Fix YAML list for external_components; pin to a commit or remove before publish.

  • components must be a list.
  • For published docs, avoid pointing to personal forks. Either remove external_components (once the component is merged) or pin ref to a specific commit for reproducibility.

Apply this minimal fix now:

 external_components:
   - source:
       type: git
       url: https://github.com/96liuzhixin/esphome
       ref: dev
     components:
-      dfrobot_c4001
+      - dfrobot_c4001

Before merge to next, please:

  • Remove the entire external_components block, or
  • Change ref: dev to a specific commit SHA.

Fix YAML list for external_components; pin to a commit or remove before publish.

File: content/components/dfrobot_c4001.md (lines ~15-22)

  • components must be a YAML list; apply the diff below.
 external_components:
   - source:
       type: git
       url: https://github.com/96liuzhixin/esphome
       ref: dev
     components:
-      dfrobot_c4001
+      - dfrobot_c4001
  • For published docs, remove the external_components block once merged, or change ref: dev to a specific commit SHA (do not point to a personal fork/branch).
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
external_components:
- source:
type: git
url: https://github.com/96liuzhixin/esphome
ref: dev
components:
dfrobot_c4001
external_components:
- source:
type: git
url: https://github.com/96liuzhixin/esphome
ref: dev
components:
- dfrobot_c4001
🤖 Prompt for AI Agents
In content/components/dfrobot_c4001.md around lines 15 to 22, the
external_components block is invalid because components is not a YAML list;
change it so components is a proper list (e.g., components: followed by a dash
entry for dfrobot_c4001), and before publishing either remove the entire
external_components block or replace ref: dev with a specific commit SHA (do not
point to a personal fork/branch).

dfrobot_c4001:
id: my_c4001
uart_id: uart_bus

select:
- platform: dfrobot_c4001
operating_mode:
name: "Mode Select"

Comment on lines +27 to +31
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add dfrobot_c4001_id to the select block for consistency and clarity.

Explicitly linking to the parent avoids ambiguity if multiple sensors are present.

Apply this diff:

 select:
   - platform: dfrobot_c4001
+    dfrobot_c4001_id: my_c4001
     operating_mode:
       name: "Mode Select"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
select:
- platform: dfrobot_c4001
operating_mode:
name: "Mode Select"
select:
- platform: dfrobot_c4001
dfrobot_c4001_id: my_c4001
operating_mode:
name: "Mode Select"
🤖 Prompt for AI Agents
In content/components/dfrobot_c4001.md around lines 27 to 31, the select block
lacks the dfrobot_c4001_id attribute which can cause ambiguity when multiple
sensors are present; update the select entry to include dfrobot_c4001_id
pointing to the parent sensor's id (e.g., dfrobot_c4001_id: <parent_id>) so the
select is explicitly associated with the correct sensor, preserving the existing
name and operating_mode structure.

number:
- platform: dfrobot_c4001
max_range:
name: "Max detection distance"
trig_range:
name: "Trigger range"
keep_sensitivity:
name: "Keep sensitivity"
trig_sensitivity:
name: "Trigger sensitivity"
confirm_delay:
name: "Confirm delay"
disappear_delay:
name: "Disappear delay"
threshold_factor:
name: "Threshold factor"
min_range:
name: "Min detection distance"
Comment on lines +33 to +49
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add dfrobot_c4001_id to the number block; consider exposing ranges/steps.

  • Add the component id for consistency.
  • Optionally document min/max/step for each number to guide users.

Apply this diff for the id:

 number:
   - platform: dfrobot_c4001
+    dfrobot_c4001_id: my_c4001
     max_range:
       name: "Max detection distance"

If available, please append min/max/step under each number (e.g., min: 0, max: 600, step: 1).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- platform: dfrobot_c4001
max_range:
name: "Max detection distance"
trig_range:
name: "Trigger range"
keep_sensitivity:
name: "Keep sensitivity"
trig_sensitivity:
name: "Trigger sensitivity"
confirm_delay:
name: "Confirm delay"
disappear_delay:
name: "Disappear delay"
threshold_factor:
name: "Threshold factor"
min_range:
name: "Min detection distance"
number:
- platform: dfrobot_c4001
dfrobot_c4001_id: my_c4001
max_range:
name: "Max detection distance"
trig_range:
name: "Trigger range"
keep_sensitivity:
name: "Keep sensitivity"
trig_sensitivity:
name: "Trigger sensitivity"
confirm_delay:
name: "Confirm delay"
disappear_delay:
name: "Disappear delay"
threshold_factor:
name: "Threshold factor"
min_range:
name: "Min detection distance"
🤖 Prompt for AI Agents
In content/components/dfrobot_c4001.md around lines 33 to 49, the number entity
block is missing a component id and lacks min/max/step metadata; add an id field
with value dfrobot_c4001_id directly under the platform: dfrobot_c4001 block for
consistency, and for each number entry (max_range, trig_range, keep_sensitivity,
trig_sensitivity, confirm_delay, disappear_delay, threshold_factor, min_range)
append appropriate min:, max:, and step: keys (use sensible values — e.g.,
distances 0–600 step 1, sensitivities 0–100 step 1, delays 0–60 step 1 — or
replace with correct device limits) so users see ranges and increments.


switch:
- platform: dfrobot_c4001
motion_switch:
name: "Motion Switch"

Comment on lines +52 to +55
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add dfrobot_c4001_id to the switch block.

Keep the pattern consistent across all platforms.

Apply this diff:

 switch:
   - platform: dfrobot_c4001
+    dfrobot_c4001_id: my_c4001
     motion_switch:
       name: "Motion Switch"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- platform: dfrobot_c4001
motion_switch:
name: "Motion Switch"
- platform: dfrobot_c4001
dfrobot_c4001_id: my_c4001
motion_switch:
name: "Motion Switch"
🤖 Prompt for AI Agents
In content/components/dfrobot_c4001.md around lines 52 to 55, the switch block
is missing the dfrobot_c4001_id field which breaks consistency with other
platforms; add a dfrobot_c4001_id entry under the motion_switch block (using the
same id naming convention used elsewhere — e.g. dfrobot_c4001_id:
"<your_device_id>" or the appropriate unique identifier for this device) so the
switch includes both name and dfrobot_c4001_id matching the project's pattern.

sensor:
- platform: dfrobot_c4001
c4001_id: my_c4001
speed:
name: "Speed"
id: c4001_speed
distance:
name: "Distance"
id: c4001_distance
Comment on lines +56 to +64
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix incorrect link property: use dfrobot_c4001_id instead of c4001_id.

Platform entities should reference the parent component’s id consistently. Replace c4001_id with dfrobot_c4001_id.

Apply this diff:

 sensor:
   - platform: dfrobot_c4001
-    c4001_id: my_c4001
+    dfrobot_c4001_id: my_c4001
     speed:
       name: "Speed"
       id: c4001_speed
     distance:
       name: "Distance"
       id: c4001_distance
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sensor:
- platform: dfrobot_c4001
c4001_id: my_c4001
speed:
name: "Speed"
id: c4001_speed
distance:
name: "Distance"
id: c4001_distance
sensor:
- platform: dfrobot_c4001
dfrobot_c4001_id: my_c4001
speed:
name: "Speed"
id: c4001_speed
distance:
name: "Distance"
id: c4001_distance
🤖 Prompt for AI Agents
In content/components/dfrobot_c4001.md around lines 56 to 64, the sensor
platform example uses the wrong link property name `c4001_id`; replace it with
`dfrobot_c4001_id` so platform entities reference the parent component id
consistently (update the key only, preserving the rest of the YAML structure and
values).


binary_sensor:
- platform: dfrobot_c4001
exist_state:
name: "Presence"
Comment on lines +66 to +69
Copy link
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add dfrobot_c4001_id to the binary_sensor block.

Aligns with other platform sections and supports multi-device configs.

Apply this diff:

 binary_sensor:
   - platform: dfrobot_c4001
+    dfrobot_c4001_id: my_c4001
     exist_state:
       name: "Presence"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
binary_sensor:
- platform: dfrobot_c4001
exist_state:
name: "Presence"
binary_sensor:
- platform: dfrobot_c4001
dfrobot_c4001_id: my_c4001
exist_state:
name: "Presence"
🤖 Prompt for AI Agents
In content/components/dfrobot_c4001.md around lines 66 to 69, the binary_sensor
example is missing the required dfrobot_c4001_id field which is needed to match
other platform examples and support multi-device configuration; update the YAML
snippet to include a dfrobot_c4001_id entry (e.g., dfrobot_c4001_id:
your_device_id) alongside the platform and exist_state:name keys so each sensor
instance can be associated with the correct device.