-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
add c4001 sensor #5349
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
base: current
Are you sure you want to change the base?
add c4001 sensor #5349
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dfrobot_c4001: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: my_c4001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uart_id: uart_bus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| select: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - platform: dfrobot_c4001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| operating_mode: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "Mode Select" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
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., 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| switch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - platform: dfrobot_c4001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| motion_switch: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "Motion Switch" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+52
to
+55
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix incorrect link property: use dfrobot_c4001_id instead of c4001_id. Platform entities should reference the parent component’s id consistently. Replace 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| binary_sensor: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - platform: dfrobot_c4001 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exist_state: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: "Presence" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+66
to
+69
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
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.
componentsmust be a list.external_components(once the component is merged) or pinrefto 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_c4001Before merge to
next, please:external_componentsblock, orref: devto 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)
componentsmust 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_c4001external_componentsblock once merged, or changeref: devto a specific commit SHA (do not point to a personal fork/branch).📝 Committable suggestion
🤖 Prompt for AI Agents