Skip to content
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

Ble client fixes for proxy #6596

Merged
merged 5 commits into from
Apr 25, 2024
Merged

Conversation

elupus
Copy link
Contributor

@elupus elupus commented Apr 21, 2024

What does this implement/fix?

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Related issue or feature (if applicable): Related to #5277 and replaces #6590

Pull request in esphome-docs with documentation (if applicable): esphome/esphome-docs#

Test Environment

  • ESP32
  • ESP32 IDF
  • ESP8266
  • RP2040
  • BK72xx
  • RTL87xx

Example entry for config.yaml:

# Example config.yaml

Checklist:

  • The code change is tested and works locally.
  • Tests have been added to verify that the new code works (under tests/ folder).

If user exposed functionality or configuration variables are added/changed:

These checks where added to base class in esphome#5277
The disconnection event might not occure, if multiple
virtual connections are active to same device
The bluetooth proxy need to inform it's controller
of the fact that opening the connection failed.
@codecov-commenter
Copy link

codecov-commenter commented Apr 21, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.43%. Comparing base (4d8b5ed) to head (48104f2).
Report is 423 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #6596      +/-   ##
==========================================
- Coverage   53.70%   53.43%   -0.28%     
==========================================
  Files          50       50              
  Lines        9408     9537     +129     
  Branches     1654     1685      +31     
==========================================
+ Hits         5053     5096      +43     
- Misses       4056     4130      +74     
- Partials      299      311      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

error: switch has 2 consecutive identical branches [bugprone-branch-clone,-warnings-as-errors]
@clydebarrow
Copy link
Contributor

This all looks good to me, so I guess the question is what testing has/can be done?

Unsure if stack will trigger CLOSE events for all
type of disconnections. The samples all listen to
disconnect.
@elupus elupus marked this pull request as ready for review April 22, 2024 07:22
@elupus elupus requested a review from jesserockz as a code owner April 22, 2024 07:22
@probot-esphome
Copy link

Hey there @pasiz, mind taking a look at this pull request as it has been labeled with an integration (pvvx_mithermometer) you are listed as a code owner for? Thanks!
Hey there @jesserockz, mind taking a look at this pull request as it has been labeled with an integration (bluetooth_proxy) you are listed as a code owner for? Thanks!
Hey there @buxtronix, mind taking a look at this pull request as it has been labeled with an integration (am43) you are listed as a code owner for? Thanks!
Hey there @jesserockz, mind taking a look at this pull request as it has been labeled with an integration (esp32_ble_client) you are listed as a code owner for? Thanks!
Hey there @jan-hofmeier, mind taking a look at this pull request as it has been labeled with an integration (alpha3) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@elupus
Copy link
Contributor Author

elupus commented Apr 22, 2024

I have now tested with a "broken" config like below. Where both the proxy through HA connects to the device, as well as the ESP device itself connects to the device. Seems to work now. Previously the proxy would time out it's disconnections since no disconnection even would occure.

Admittedly, that is only a partial test of the changes here thou. The open failure indication i've not been able to figure out a testcase for.

substitutions:
  name: esp32-bluetooth-proxy-0b6900
  friendly_name: Bluetooth Proxy 0b6900
packages:
  esphome.bluetooth-proxy: github://esphome/bluetooth-proxies/esp32-generic.yaml@main
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: ...

external_components:
  - source: github://pr#6596
    components: [ bluetooth_proxy ]

ble_client:
  - mac_address: F0:5E:CD:31:37:3E
    id:  gardena_water_switch

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

Copy link
Contributor

@clydebarrow clydebarrow left a comment

Choose a reason for hiding this comment

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

All looks good to me.

@clydebarrow clydebarrow merged commit 2fa5846 into esphome:dev Apr 25, 2024
64 checks passed
@elupus elupus deleted the ble_proxy_cleanup branch April 25, 2024 10:52
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants