forked from bradleywehmeier/esphome-native-api
-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: Add methods for all BLE interactions #10
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
richardhopton
commented
Mar 29, 2023
@@ -1218,19 +1218,19 @@ message BluetoothGATTGetServicesRequest { | |||
} | |||
|
|||
message BluetoothGATTDescriptor { | |||
repeated uint64 uuid = 1; | |||
repeated uint64 uuid = 1 [jstype=JS_STRING]; |
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.
this is needed because esp sends 64-bit integers, but JS can only handle 53-bit precision. protocolbuffers/protobuf#3666 (comment)
twocolors
reviewed
Mar 30, 2023
twocolors
reviewed
Mar 30, 2023
ESPHome will always return a response even if the `response` value is set to false. It only appears to control how the characteristic is written.
Thanks for the help and code. |
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR contains connection logic to call all relevant BLE interactions on the ESP native API.
BLE Advertisements:-
Note: Unsubscribing has been added to ESPHome & AIOESPHomeApi but it hasn't been released yet so will be hard to test. To unsubscribe you'd want to do this:-
In the examples I've included below, you will need an address to pass in. The address is the decimal encoded MAC address of the device but is also returned in the BluetoothLEAdvertisementResponse.
Connect to connectable BLE device:-
Disconnect from connectable BLE device:-
For all the following examples you MUST be connected or they will fail.
BLE list GATT services:-
In the following examples, you will need a handle that can be retrieved from the GATT services list.
BLE read GATT Characteristic:-
BLE notify GATT Characteristic:-
BLE write GATT Characteristic:-
BLE write GATT Descriptor:-