Skip to content

feat: BrewOS cloud integration via espresso_machine_brewos component - #73

Draft
shaggitza with Copilot wants to merge 9 commits into
mainfrom
copilot/integrate-brewos-espresso-machine
Draft

feat: BrewOS cloud integration via espresso_machine_brewos component#73
shaggitza with Copilot wants to merge 9 commits into
mainfrom
copilot/integrate-brewos-espresso-machine

Conversation

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor
  • Create components/espresso_machine_brewos/ component
  • Add unit tests (tests/cpp/test_brewos.cpp) — 269 tests, all passing
  • Update example and test YAML files
  • Update FEATURES.md, README.md, docs/brewos.md
  • Fix UnknownPackageError: removed cg.add_library() calls; WebSockets added via platformio_options
  • Fix host compile error: brewos_connector.cpp wrong include path fixed to "../espresso_machine/espresso_machine.h"
  • Fix GPIO34 pulldown: changed to mode: INPUT
  • Fix cleanup_script validator: changed cv.Any()lambda v: v in both brew and steam schemas
  • Fix CI source patching: replaced fragile Python heredoc with sed one-liner
  • Fix DEPENDENCIES = ["wifi"]: removed — wifi is optional; the connector degrades gracefully when cloud is unreachable, and test YAMLs (native host, test_brewos.yaml) don't configure wifi
  • Fix cg.add_library() re-introduced by user commits: removed again — libraries must be declared in platformio_options by the user
  • Fix #include "esphome/core/defines.h": removed from brewos_connector.cpp — this header is not present in the CMake test mock directory, causing C++ unit test build failure
Original prompt

This section details on the original issue you should resolve

<issue_title>Please integrate brewos into this espresso machine</issue_title>
<issue_description>Please integrate brewos into this espresso machine

have something like:

brewos:
url:
......
espresso_machine: my_machine

Make sure you propperly read their docs, make a propper plan, implement testing and all that is needed to do this

Implement it inside mock machine and real machine

Comprehensive documentation is available in the docs/ directory:

Cloud Service Guide - Complete architecture and setup documentation
Deployment Guide - Deployment instructions for various platforms
ESP32 Integration - How ESP32 devices connect to cloud
Pairing & Sharing - Device pairing and sharing flows
Database Storage - Database schema and storage patterns
Push Notifications - Push notification implementation
Latency & Performance - Performance considerations</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: shaggitza <82771482+shaggitza@users.noreply.github.com>
Copilot AI changed the title [WIP] Integrate brewos into espresso machine functionality feat: BrewOS cloud integration via espresso_machine_brewos component Feb 25, 2026
@shaggitza

Copy link
Copy Markdown
Owner

@copilot please see why the tests fail

…I for example YAML validation

Co-authored-by: shaggitza <82771482+shaggitza@users.noreply.github.com>

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please see why the tests fail

There were two separate failures, both fixed in commit 21e7ceb:

1. UnknownPackageError: Could not find the package 'links2004/WebSockets @ 2.4.0'
The cg.add_library() calls in __init__.py were being emitted unconditionally for every build target (including host/test). Since all WebSocket code is guarded by #ifdef ARDUINO, those library declarations should never be in the Python schema. Removed both cg.add_library() calls. For ESP32 production builds, users add it via platformio_options — now documented in both example YAMLs and docs/brewos.md:

esphome:
  platformio_options:
    lib_deps:
      - links2004/WebSockets@^2.4.0

2. CI example YAML jobs failing (pre-existing on main too)
Two root causes: (a) examples/secrets.yaml doesn't exist in the repo, and (b) the example YAMLs reference github://...@main which doesn't have the new component until the PR is merged. Fixed in the workflow: the Prepare example config for CI step now generates a proper dummy secrets.yaml (with a valid base64 API key) and patches the external_components source to local:../components for CI runs. Also added tests/test_brewos.yaml as a dedicated schema-validation test and added the brewos component to tests/test_compile.yaml for host-platform C++ coverage.

@shaggitza

Copy link
Copy Markdown
Owner

@copilot pipeline still failing

…idator, and CI source patching

Co-authored-by: shaggitza <82771482+shaggitza@users.noreply.github.com>

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot pipeline still failing

Fixed in commit b805614. There were four separate issues:

  1. Wrong include pathbrewos_connector.cpp used #include "espresso_machine/espresso_machine.h" but every other component uses relative paths like #include "../espresso_machine/...". Fixed.

  2. GPIO34 pulldownexamples/philips_barista_brew.yaml had mode: INPUT_PULLDOWN on GPIO34, which the ESP32 doesn't support (GPIO34–39 are input-only with no internal pull resistors). Changed to mode: INPUT.

  3. cv.Any() with no arguments — both cleanup_script entries in BREW_SCHEMA and STEAM_SCHEMA used cv.Any() with no validators, which is a voluptuous anti-pattern that rejects every value with "no valid value found". Changed to lambda v: v (passthrough). This was masking the GPIO34 error in the brew: section and causing the steam: section to fail entirely.

  4. CI source patching — you're right that the example configs point to github://...@main. The workflow already patches this to use local components for CI runs, but the previous implementation used a fragile Python heredoc. Replaced with a clean sed one-liner:

    sed 's|source: github://shaggitza/test_espresso_esphome@main|source:\n      type: local\n      path: ../components|' \
      "$YAML" > "examples/ci_$(basename "$YAML")"

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /home/REDACTED/.local/bin/esphome esphome config examples/ci_philips_barista_brew.yaml owner --uid-owner 0 -j ACCEPT (dns block)
    • Triggering command: /home/REDACTED/.local/bin/esphome esphome config examples/ci_philips_barista_brew.yaml (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@shaggitza

Copy link
Copy Markdown
Owner

@copilot please fix the failing tests

…core/defines.h from brewos connector

Co-authored-by: shaggitza <82771482+shaggitza@users.noreply.github.com>

Copilot AI commented Feb 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please fix the failing tests

Fixed in commit fbf9869. Three issues introduced by the recent commits:

  1. DEPENDENCIES = ["wifi"] — blocked test_brewos.yaml and test_compile.yaml with "Component espresso_machine_brewos requires component wifi". Removed — the connector degrades gracefully when cloud is unreachable and wifi is not a hard requirement.

  2. cg.add_library() calls re-introduced — these break the host/native platform build. Libraries must stay in platformio_options in the user YAML, not emitted from the Python schema.

  3. #include "esphome/core/defines.h" — this header doesn't exist in the CMake test mock directory (tests/cpp/mock/esphome/core/), causing the C++ unit test build to fail with fatal error: esphome/core/defines.h: No such file or directory. Removed the include.

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.

Please integrate brewos into this espresso machine

2 participants