Skip to content

Bootstrap main components repo with crow_alarm_panel and uv dev environment - #1

Merged
dan-s-github merged 5 commits into
devfrom
copilot/setup-components-folder
Apr 1, 2026
Merged

Bootstrap main components repo with crow_alarm_panel and uv dev environment#1
dan-s-github merged 5 commits into
devfrom
copilot/setup-components-folder

Conversation

Copilot AI commented Apr 1, 2026

Copy link
Copy Markdown

Establishes this repo as the canonical home for custom ESPHome components, with a components/ directory layout and a uv-managed Python environment for local compilation and validation.

Changes

Component: crow_alarm_panel

  • Ported all source files from dan-s-github/esphome-components-jallier into components/crow_alarm_panel/
  • Preserves full sub-component structure: alarm_control_panel, binary_sensor, button, switch, text_sensor
  • C++ sources: crow_alarm_panel.h, crow_alarm_panel.cpp, crow_alarm_control_panel.cpp

Build environment

  • pyproject.toml declares esphome>=2026.3.0 as a dependency, managed via uv
  • Local workflow: uv sync && source .venv/bin/activate then standard esphome CLI

Test configuration

  • crow_alarm_panel_test.yaml — sample ESP32 config exercising all sub-platforms for local esphome config / esphome compile validation

Repo hygiene

  • .gitignore — added .venv/ and uv.lock
  • README.md — documents setup steps and external_components usage pattern:
external_components:
  - source:
      type: git
      url: https://github.com/dan-s-github/esphome-components
      ref: main
    components: [crow_alarm_panel]

@dan-s-github

dan-s-github commented Apr 1, 2026

Copy link
Copy Markdown
Owner

@copilot change merge target to dev

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Bootstraps this repository as a home for custom ESPHome components by adding a components/ layout, a uv-managed Python environment for local validation, and an initial crow_alarm_panel external component with a sample compile/test configuration.

Changes:

  • Added repo documentation and a local uv-based workflow for running esphome config/compile.
  • Introduced components/crow_alarm_panel component with multiple sub-platforms (ACP, button, switch, binary_sensor, text_sensor) and C++ bus handling.
  • Added a sample crow_alarm_panel_test.yaml for local validation/compilation and updated repo hygiene (.gitignore).

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
README.md Documents repo purpose, uv workflow, and external_components usage.
pyproject.toml Defines a uv-managed Python environment with an ESPHome dependency.
crow_alarm_panel_test.yaml Provides a sample ESP32 configuration to validate/compile the component.
.gitignore Ignores .venv/ and uv.lock for the uv workflow.
components/crow_alarm_panel/init.py Core component schema/codegen for pins, keypad address, keypads list, and on_message trigger.
components/crow_alarm_panel/README.md Component-specific documentation and YAML example.
components/crow_alarm_panel/crow_alarm_panel.h Declares the main C++ component, ISR store, and platform integration hooks.
components/crow_alarm_panel/crow_alarm_panel.cpp Implements bus ISR receive logic, packet TX, message decoding, and arm/disarm sequencing.
components/crow_alarm_panel/crow_alarm_control_panel.cpp Implements ACP control() mapping to arm/disarm actions.
components/crow_alarm_panel/alarm_control_panel/init.py ESPHome ACP platform codegen wiring to the parent component.
components/crow_alarm_panel/binary_sensor/init.py ESPHome binary_sensor platform codegen for zone/bypass.
components/crow_alarm_panel/button/init.py ESPHome button platform codegen for arm/disarm actions.
components/crow_alarm_panel/button/crow_alarm_panel_button.h C++ button implementation mapping presses to parent actions.
components/crow_alarm_panel/switch/init.py ESPHome switch platform codegen for output control.
components/crow_alarm_panel/switch/crow_alarm_panel_switch.h C++ switch base/derived classes for Crow outputs.
components/crow_alarm_panel/switch/crow_alarm_panel_switch.cpp C++ switch implementations calling parent output control and logging config.
components/crow_alarm_panel/text_sensor/init.py ESPHome text_sensor platform codegen for armed state reporting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md
Comment on lines +7 to +9
| Component | Description |
|-----------|-------------|
| [crow_alarm_panel](components/crow_alarm_panel/README.md) | Integration for Arrowhead Crow alarm panels via the keypad bus |

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

The Markdown table has an extra leading | on the header/separator rows (|| ...), which prevents the table from rendering correctly. Replace || with a single | on those lines.

Copilot uses AI. Check for mistakes.

@dan-s-github dan-s-github Apr 1, 2026

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot I don't see an extra leading |

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

You're right — the table in README.md is correctly formatted with single | delimiters. The reviewer comment was incorrect; no change is needed here.

Comment thread components/crow_alarm_panel/README.md Outdated
Comment thread components/crow_alarm_panel/crow_alarm_panel.h
Comment thread components/crow_alarm_panel/__init__.py
Comment thread components/crow_alarm_panel/binary_sensor/__init__.py Outdated
Comment thread components/crow_alarm_panel/switch/__init__.py Outdated
Comment on lines +213 to +222
case ARMED_STATE: {
if (armed_state_ != nullptr) {
if (data[0] == 0x00 && data[1] == 0x01) {
this->armed_state_->publish_state("arming");
ESP_LOGD(TAG, "Arming [%02x.%s]", type, format_hex_pretty(data).c_str());
if (this->alarm_control_panel_ != nullptr) {
this->alarm_control_panel_->publish_state(alarm_control_panel::ACP_STATE_ARMING);
}
} else if (data[0] == 0x01 && data[1] == 0x00) {
this->armed_state_->publish_state("armed_away");

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

In the ARMED_STATE handler, the code reads data[0] and data[1] without checking data.size(). If a short/empty frame is received, this will read out of bounds. Add a length guard (e.g., require at least 2 bytes) before accessing.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot apply changes based on this feedback

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done in commit 5cae879. Added a data.size() < 2 guard at the top of the ARMED_STATE case — if the frame is too short, it logs a warning and breaks without accessing data[0]/data[1].

Comment thread components/crow_alarm_panel/crow_alarm_panel.cpp Outdated
Comment thread components/crow_alarm_panel/crow_alarm_panel.cpp
Comment thread components/crow_alarm_panel/crow_alarm_panel.cpp
Copilot AI requested a review from dan-s-github April 1, 2026 06:48
@dan-s-github
dan-s-github changed the base branch from main to dev April 1, 2026 07:03
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

Copilot AI commented Apr 1, 2026

Copy link
Copy Markdown
Author

@copilot change merge target to dev

The merge target is already set to dev — the PR base branch was updated in a previous session.

dan-s-github and others added 2 commits April 1, 2026 20:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dan-s-github

Copy link
Copy Markdown
Owner

@copilot in a follow-up session

@dan-s-github
dan-s-github marked this pull request as ready for review April 1, 2026 07:45
Copilot stopped work on behalf of dan-s-github due to an error April 1, 2026 07:45
@dan-s-github
dan-s-github merged commit 0fe42d5 into dev Apr 1, 2026
1 check failed
@dan-s-github
dan-s-github deleted the copilot/setup-components-folder branch April 1, 2026 07:48
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.

3 participants