Skip to content

Add the HVAC compressor sensor, fix the EasyStart notify subscription, and draft the upstream ble_client defect - #71

Merged
ptr727 merged 10 commits into
mainfrom
develop
Jul 29, 2026
Merged

ptr727 merged 10 commits into
mainfrom
develop

Conversation

@ptr727

@ptr727 ptr727 commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Promotes develop to main.

HVAC compressor sensor and the EasyStart notify fix

ee66905 adds the dedicated Unexpected Maker ProS3D host for the two Micro-Air EasyStart modules, and fixes the component's notify subscription. The component was setting node_state = ESTABLISHED during ESP_GATTC_SEARCH_CMPL_EVT, immediately after requesting the subscription and while the registration was still in flight. It now sets it inside ESP_GATTC_REG_FOR_NOTIFY_EVT after checking param->reg_for_notify.status.

That ordering matters because ble_client frees the peer's GATT cache once every node reports established, and ESPHome then walks that freed cache when the registration completes. On this hardware it produced esp_ble_gattc_get_descr_by_char_handle error, status=10 on every connection and an assert failed: list_end panic on one of five.

Reproduction harness for the upstream defect

The ESPHome defect survives the component fix, so it is being reported upstream. ble-notify-race-test.yaml and easystart/test/components/ble_notify_race/ reproduce it deterministically: a minimal BLEClientNode that registers for notifications and then reports established before the registration lands.

The component is wrong on purpose and says so in its header. Nothing else in the fleet should copy its pattern. CI compiles it alongside the existing easystart component test, gated on the same paths plus the root config.

Its reconnect churn uses a lambda calling disconnect() rather than the ble_client.disconnect action, because that action registers itself as a BLE node that never reports established, which suppresses the very release the harness exists to trigger.

Documentation

easystart/ESPHOME-BLE-ISSUE.md is rewritten as the upstream issue draft, covering two defects with the code linked by permalink throughout.

Governance additions in OPERATIONS.md:

  • How to build a device config against patched ESPHome core components, via an external_components override, and the check that makes the result trustworthy.
  • That a ble_client automation action registers as a BLE node which never reports established, suppressing the service release for its whole client.

easystart/AGENTS.md and easystart/README.md still named office-bluetooth-proxy.yaml as the working two-module config, which moved to the ProS3D in ee66905.

The easystart component header carried a file-header summary block and multi-sentence comment paragraphs, both of which AGENTS.md bans. Scrubbed.

Verification

  • esphome config and esphome compile clean for ble-notify-race-test.yaml, easystart/test/compile-test.yaml, and hvac-compressor-sensor.yaml.
  • Hardware A/B on the real device, three builds differing only in the ESPHome sources, with production firmware restored afterwards and both modules reporting live.
  • clang-format 13.0.1, markdownlint, cspell, editorconfig-checker, and actionlint all clean.

ptr727 and others added 6 commits July 28, 2026 13:53
Move the EasyStart modules off the office proxy onto a dedicated ProS3D
device sited beside the compressors, where they read -53 to -66 dBm
instead of the -85 dBm the office proxy managed. The new device is not a
Bluetooth proxy: it connects to two known addresses, so it runs no
bluetooth_proxy, scans passively, and takes two connection slots.

The component established its BLE node before its asynchronous notify
registration completed, which let ESPHome free the GATT cache mid
registration. The CCCD was never written and no frames arrived. It now
establishes in ESP_GATTC_REG_FOR_NOTIFY_EVT with a status check, matching
ESPHome's own ble_client sensor. The same race can abort the firmware
inside Bluedroid, written up for upstream in easystart/ESPHOME-BLE-ISSUE.md.

Also in this change:

- Share the MAX17048 gauge as templates/max17048.yaml across the ProS3D
  and Feather templates, adding a Battery Gauge Reset button, since the
  gauge fits its model once at its own power-on and no reboot re-fits it.
- Drop the GL-S10 scan parameter override, which upstream now advises
  against, and record that the board has no PSRAM despite the datasheet.
- Silence known strapping pin warnings where the pin schema allows it.
- Point every esphome.io link at its current page and fix three anchors
  that moved, verified against the live documentation.
- Resolve stale TODOs, and retire the unused n32r8v OTA test config.
The upstream issue draft claimed the race was occasional. Re-reading the
capture shows all five releases raced the notify registration: four returned
ESP_GATT_NOT_FOUND, leaving the characteristic silently unsubscribed, and one
asserted and panicked. Only the consequence varies, not the ordering.

ble_notify_race is a minimal node that reports ESTABLISHED with its
registration outstanding, which reproduces the release on every connection.
It drives ble-notify-race-test.yaml, a root config so the Device Builder
dashboard can flash it over USB, and CI compiles it alongside the easystart
component test.

Record two findings in the governance docs: how to build a device config
against patched ESPHome core components, and that a ble_client automation
action registers as a BLE node that never reports ESTABLISHED, which
suppresses the service release for its whole client.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
AGENTS.md bans file-header summary blocks and multi-sentence comment
paragraphs. The component header carried both.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Permalinks pinned to the branch point make each claim checkable, and the
action-node finding now points at its own fix rather than reading as an
observation nobody will act on.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
It was described only as an aside explaining why the crash is rarely hit, and
its fix was not described at all, which is not enough to file from.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The draft opened with the reduced repro node and left the real component and
config in a closing note, which is backwards for a defect report. The deployed
component and its YAML come first, the reduced node follows as a way to
reproduce without the soft-starter hardware.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 01:58
It is a utility sub-package included by the board templates, like
rgb-led-status, and requires an i2c bus from the including board, so it cannot
stand alone as an example device. The guard has failed since the template was
added.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

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

Promotes develop to main, carrying the EasyStart BLE notify-subscription fix, adding a dedicated ProS3D-based HVAC compressor sensor config, and introducing a deterministic reproduction harness plus an upstream issue draft for the underlying ESPHome ble_client GATT-cache race.

Changes:

  • Add the hvac-compressor-sensor.yaml device config and update secrets/docs to match the new host and naming.
  • Add a minimal “notify race” repro component + root test config, and wire it into CI compile coverage.
  • Refactor board/package templates (notably MAX17048 fuel gauge) and refresh ESPHome documentation links across templates/configs.

Reviewed changes

Copilot reviewed 56 out of 57 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
upstairs-hallway-plant-sensor.yaml Updates ESPHome docs links for substitutions/packages.
stairs-plant-sensor.yaml Updates ESPHome docs links for substitutions/packages.
patio-plant-sensor.yaml Updates ESPHome docs links for substitutions/packages.
music-room-plant-sensor.yaml Updates ESPHome docs links for substitutions/packages.
living-room-plant-sensor.yaml Updates ESPHome docs links for substitutions/packages.
recirculation-pump-controller.yaml Updates ESPHome docs links (components + filters + interval).
pantry-bluetooth-proxy.yaml Removes stale TODO block from the proxy config.
office-bluetooth-proxy.yaml Removes EasyStart module wiring from the office proxy now that HVAC moved to a dedicated host.
hvac-compressor-sensor.yaml New dedicated ProS3D device config hosting both EasyStart modules and BLE settings.
secrets._yaml Renames EasyStart MAC secret keys to downstairs/upstairs naming.
templates/common.yaml Updates ESPHome docs link for packages.
templates/basic.yaml Updates ESPHome docs link for button.
templates/wifi.yaml Updates ESPHome docs links for wifi_info and wifi_signal sensors.
templates/temperature.yaml Updates ESPHome docs link for internal_temperature sensor.
templates/apollo-plt-1b.yaml Updates ESPHome docs link for packages.
templates/aoycocr-x5p.yaml Updates ESPHome docs links for packages and gpio/status_led.
templates/sonoff-th10.yaml Updates device/docs links and normalizes ESPHome component links.
templates/sonoff-s31.yaml Normalizes ESPHome component links and pin-schema link.
templates/smarthome-ceilsense.yaml Updates ESPHome docs link for packages.
templates/rocket-astra.yaml Normalizes ESPHome docs links for packages and gpio/pulse_counter examples.
templates/rgb-led-status.yaml Normalizes ESPHome docs links and anchors.
templates/norvi-enet-ae06-r.yaml Normalizes ESPHome docs links (packages, external_components, display, sensors, gpio).
templates/kincony-kc868-asr.yaml Normalizes ESPHome docs links for packages, switch gpio, and light.
templates/wemos-lolin32-lite.yaml Updates ESPHome docs links for local packages and status_led.
templates/esp32-s3-devkitc.yaml Updates substitutions/packages docs links and clarifies logger UART comment.
templates/efun-sh331.yaml Normalizes ESPHome docs links and calibrate-linear anchor.
templates/easystart.yaml Tightens header guidance and updates internal references.
templates/gls10-bluetooth-proxy.yaml Updates hardware notes, removes non-default scan params, and improves strapping-pin handling.
templates/adafruit-esp32-s3-feather.yaml Switches MAX17048 content to a shared package include and normalizes docs links.
templates/unexpectedmaker-pros3d.yaml Switches MAX17048 content to a shared package include and normalizes docs links.
templates/konnected-blaq.yaml Updates ESPHome docs link for local packages.
templates/max17048.yaml New shared MAX17048 fuel-gauge package template (external component + sensors + reset button).
easystart/components/easystart/easystart.h Fixes notify subscription ordering by setting ESTABLISHED only after REG_FOR_NOTIFY success.
easystart/test/components/ble_notify_race/ble_notify_race.h New deliberately-racy node used to reproduce the upstream ble_client defect.
easystart/test/components/ble_notify_race/init.py New ESPHome codegen/config schema for the repro component.
ble-notify-race-test.yaml New root test config that deterministically reproduces the GATT-cache race via forced reconnects.
easystart/ESPHOME-BLE-ISSUE.md New upstream issue draft describing two related ble_client service-release defects with evidence.
easystart/README.md Updates the example config reference and documents follow-up target notes + new link.
easystart/AGENTS.md Updates working-config references and documents the new repro component harness.
README.md Documents the new HVAC compressor sensor host, introduces the MAX17048 template, and updates references.
OPERATIONS.md Adds operational guidance for DNS/FQDN, logs hygiene, BLE behavior notes, strapping pin warnings, and patched-core workflows.
cspell.json Adds new allowed terms used by the updated docs.
.gitignore Ignores local serial/API log captures directory.
.github/workflows/test-pull-request.yml Adds compile gating + dummy secrets creation and compiles the new repro config in CI.
archive/zigbee-coordinator.yaml Updates external component source and stream_server binary_sensor schema.
archive/wemos-lolin32-lite-test.yaml Normalizes substitutions/packages docs links.
archive/utility-pulse-counter.yaml Normalizes ESPHome docs links for esp32/status_led/sensors.
archive/rocket-astra-test.yaml Normalizes substitutions/packages/docs links.
archive/norvi-aeo6r-test.yaml Normalizes substitutions/packages/docs links (mostly commented examples).
archive/lolin32-btproxy-test.yaml Normalizes substitutions/packages/docs links for BLE tracker/proxy.
archive/kincony-kc868asr-test.yaml Normalizes substitutions/packages docs links.
archive/esp32-s3-feather-test.yaml Normalizes substitutions/packages docs links.
archive/esp32-s3-devkitc-test.yaml Normalizes substitutions/packages docs links.
archive/n32r8v-ota-test.yaml Removes obsolete OTA test config file.

Comment thread .github/workflows/test-pull-request.yml Resolved
Copilot AI review requested due to automatic review settings July 29, 2026 02:01

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

Copilot reviewed 56 out of 57 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

templates/max17048.yaml:10

  • The example showing how to remove the gauge uses an invalid YAML flow-sequence form (sensor: [- id: ...]). Since this is meant to be copy/pasted guidance, it should either be removed or rewritten as plain English so it is unambiguous and syntactically correct.
    easystart/test/components/ble_notify_race/ble_notify_race.h:7
  • PRIu32 requires an <inttypes.h> (or <cinttypes>) include. Adding it explicitly avoids relying on transitive includes from ESPHome headers, which can break with upstream refactors.
#include "esphome/core/component.h"
#include "esphome/core/log.h"
#include "esphome/components/ble_client/ble_client.h"

PRIu32 needs cinttypes rather than a transitive include from the ESPHome
headers, which an upstream refactor could remove.

The max17048 removal guidance was written as a YAML flow sequence that does not
parse, so it could not be copied as shown.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 02:11

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.

🟡 Not ready to approve

A couple of small but concrete correctness/clarity issues were found in newly added/updated config comments and metadata that should be fixed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Comments suppressed due to low confidence (2)

secrets._yaml:13

  • The comment still says these EasyStart MAC secrets are used by office-bluetooth-proxy.yaml, but this PR moves the primary consumer to hvac-compressor-sensor.yaml (and ble-notify-race-test.yaml also uses them). Updating the comment avoids confusing future setup.
    templates/max17048.yaml:28
  • Setting device_class to an empty string is non-idiomatic and can lead to confusing metadata downstream; omitting the field cleanly expresses "no device class".
  • Files reviewed: 56/57 changed files
  • Comments generated: 0 new
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

The EasyStart MAC comment still named office-bluetooth-proxy.yaml, which the
earlier sweep of the stale references missed.

ble-notify-race-test.yaml appears in the Device Builder dashboard beside the
real devices, so the README says plainly that it is not one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 29, 2026 02:20
@ptr727

ptr727 commented Jul 29, 2026

Copy link
Copy Markdown
Owner Author

Triage of the two low-confidence notes on 7f02454, neither of which had a review thread to reply to.

secrets._yaml:13 - accepted, fixed in 2c8e1af.

Correct, and a genuine miss. The comment named office-bluetooth-proxy.yaml as the consumer of the EasyStart MAC secrets, but the modules moved to hvac-compressor-sensor.yaml in ee66905. The same stale reference was corrected in easystart/AGENTS.md and easystart/README.md earlier in this PR and this file was skipped. It now names both current consumers.

templates/max17048.yaml:28 - declined.

device_class: "" is not a stray empty value, it clears an inherited default. The upstream component declares device_class=DEVICE_CLASS_BATTERY for the rate sensor:

cv.Optional(CONF_RATE): sensor.sensor_schema(
    ...
    device_class=DEVICE_CLASS_BATTERY,

Omitting the field would not express "no device class", it would restore battery on a sensor whose unit is %/h. Home Assistant treats device_class: battery as a percentage, so a discharge rate would be presented as a state of charge.

The resolved config confirms the override is doing its job:

name: Battery Discharge Rate
device_class: ''
unit_of_measurement: '%/h'
state_class: measurement

Also in 2c8e1af: README.md now states that ble-notify-race-test.yaml is a test harness rather than a device, since it sits at the config root and appears in the Device Builder dashboard alongside the real ones.

The harness was linked with repo-relative paths, which resolve while reading
the file here and break the moment the text is pasted into an issue on
esphome/esphome. They are absolute now, and the section presents the harness as
a checked-out, CI-compiled config that can be flashed as is rather than as a
snippet.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

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.

🟡 Human review recommended

It changes BLE component behavior and introduces new device/harness configs plus CI/doc updates that have hardware- and runtime-sensitive failure modes best validated by a final human review.

Review details
  • Files reviewed: 56/57 changed files
  • Comments generated: 0 new
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Copilot AI review requested due to automatic review settings July 29, 2026 02:24

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.

🟡 Human review recommended

It includes non-trivial BLE state-machine changes plus new CI-compiled repro harnesses and operational config changes that should receive final human review before approval.

Review details
  • Files reviewed: 56/57 changed files
  • Comments generated: 0 new
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@ptr727
ptr727 merged commit 05e1320 into main Jul 29, 2026
31 checks passed
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