-
Notifications
You must be signed in to change notification settings - Fork 25
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
Identifying service/characteristics uuid #20
Comments
Hello, If you need to query multiple services/characteristics you should write extra independent item of myhomeiot_ble_client with different services/characteristics. Some examples of usage of component you can find here. In your case usage of myhomeiot_ble_client should looks something like this: esp32_ble_tracker:
myhomeiot_ble_host:
myhomeiot_ble_client:
- mac_address: FF:D1:01:5E:87:70
service_uuid: '2BE32DB1-5F6B-4CBD-8803-38D6DFB16490'
characteristic_uuid: '2BE32DB1-5F6B-4CBD-8873-8D6DFB164900'
update_interval: 300s
on_value:
then:
lambda: |-
unsigned long int totConsumption = x[0];
totConsumption += x[1] << 8;
totConsumption += x[2] << 16;
totConsumption += x[3] << 24;
//id(oras_totConsumption).publish_state(totConsumption);
id(oras_totConsumption_m3).publish_state((float)totConsumption / 1000.0f);
ESP_LOGI("ble_adv", "Total water consumption %ld", totConsumption);
//unsigned long int totOpening = x[4];
//totOpening += x[5] << 8;
//totOpening += x[6] << 16;
//totOpening += x[7] << 24;
//ESP_LOGI("ble_adv", "Total valve openings %ld", totOpening);
//ESP_LOGI("ble_adv", " - Setting bleStatus to true");
//id(bleStatus).publish_state(true);
//id(oras_totOpening).publish_state(totOpening);
sensor:
- platform: template
id: oras_totConsumption_m3
name: Oras Total Consumption
device_class: water
unit_of_measurement: 'm³'
state_class: measurement
accuracy_decimals: 0 |
@bipsendk Did you manage to get it working reliably? Thanks in advance. |
@mihsu81 - I do not have a working solution yet. I am still trying to figure out if it can be done using the myhomeiot BLE client - or I should go with an alternative and scan for the faucet, and fetch the desired data once connected - and then go to deep sleep for 1-2 hours before wakeup and doing it all over again (in order not to drain the battery of the faucet). The code can probably store data in Flash (simulated drive), but there is a limit on the number of times you can rewrite a section of the flash. This is something to be done in the lambda code, and is not a part of the BLE client code. |
@bipsendk Thanks a lot for the info. I was asking about persistent values across reboots because I've noticed it possible in dentra's integration. https://github.com/dentra/esphome-components/tree/master/components/miot_cwbs01 |
@myhomeiot - when having multiple myhomeiot_ble_client entries towards the same MAC and service uuid, but different characteristics - will all entries be processed "more or less in sequential order" ? Or will the system take them one after the other, more or less using the next BLE advertise as a sort of index counter? |
@myhomeiot - just tried to create a config with multiple entries on different characteristics:
The problem here is, that the clients are newer connected... I have:
And from that output (triggered when an advertie is received) I get:
But the myhomeiot_ble_client never seems to connect and run the lambda code.... Even though I have checked service and characteristics uuids ... From my bluetooth tracker/logger on Android:
|
Try to remove/comment out the extra settings of esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true use just this: esp32_ble_tracker: |
The parameters on the BLE tracker is in order to locate the device quicker - as the device primarily sends advertise when in use, and not when "idle" ... |
I will try to test |
any progress with multiple "clients" towards same target ? |
Hi @myhomeiot , |
How does one identify the uuids to be used ?
In a config with the "native" ble_client, I currently have this in the sensor section:
What would be the correct way to rewrite this to use myhomeiot_ble_client ?
And if multiple services/characteristics needs to be queried on the same device - what would be the approach ?
The text was updated successfully, but these errors were encountered: