myhomeiot / esphome-components

A collection of my ESPHome components
Other
257 stars 25 forks source link

GL.iNet GL-S10 as BLE Gateway #25

Closed to4ko closed 1 year ago

to4ko commented 1 year ago

I'm trying to use GL.iNet GL-S10 (https://blakadder.com/gl-s10/) as a BLE gateways and no BLE packets received at all. Regular ESP32 board based BLE Gateway working just fine.

Same time ble device_tracker binary sensor (tracking NUT mini) working fine on GL-S10's

  - platform: ble_presence
    mac_address: 7E:FE:3E:EC:59:FB
    name: ${board_name}_White
    device_class: presence

Config used for devices https://github.com/to4ko/myconfig/blob/master/esphome/esp32_poe_ble_hs.yaml

BLE Gateway Events counters image

BLE device_tracker's binary Sensors

image

BLE Proxy working also

image

myhomeiot commented 1 year ago

Very strange. Try to enable discovery for this specific device and see if you have any messages from ble_gateway in the log. Maybe something wrong with MAC address byte order, etc.

ble_gateway:
  id: ${board_name}
  discovery: true
  ...
to4ko commented 1 year ago

no changes with discovery true...

here is log from regular ESP32 ble gateway image

and here is log from GL-S10 device. devices laying next to each other image

myhomeiot commented 1 year ago

Try to comment out bluetooth_proxy configuration and if ble_gateway start working return bluetooth_proxy and comment just active: true of it. PS: I never tested ble_gateway together with bluetooth_proxy :(

bluetooth_proxy:
  active: true
to4ko commented 1 year ago

Try to comment out bluetooth_proxy configuration and if ble_gateway start working return bluetooth_proxy and comment just active: true of it. PS: I never tested ble_gateway together with bluetooth_proxy :(

bluetooth_proxy:
  active: true

It's working! Looks like it's not possible to have BLE gateway and BT proxy on the same device... I'm closing this one as solved!

Thanks!

myhomeiot commented 1 year ago

@to4ko Great! Thanks for update! You can try to place ble_gateway before bluetooth_proxy in configuration this may works because ble_gateway not report BLE advertisement as processed and they should pass to next service registered in the chain.

Update: bluetooth_proxy report it as processed.

to4ko commented 1 year ago

test result negative - ble gateway not working once ble proxy enabled in config

myhomeiot commented 1 year ago

@to4ko This is a source of the problem, in version ESPHome 2023.6.0+ they add Bluetooth Proxy: Raw bundled advertisements esphome#4924 by @jesserockz I know how to fix it but I will wait for ESPHome dev's final decision because this improvement breaks other BLE components which should be modified or dev's should fix it.

myhomeiot commented 1 year ago

Issue fixed in ESPHome 2023.6.5.

to4ko commented 1 year ago

Thanks!!

Will try it!

One question - do you have any expirience with single ble gateway and more than one HA instances?

myhomeiot commented 1 year ago

One question - do you have any expirience with single ble gateway and more than one HA instances?

I don't have experience with this, but I think about this before :) If you have few HA instances probably you have external MQTT, so you can publish ble_gateway packets to MQTT and use it in any number of HA instances, more details you can find here.

to4ko commented 1 year ago

One question - do you have any expirience with single ble gateway and more than one HA instances?

I don't have experience with this, but I think about this before :) If you have few HA instances probably you have external MQTT, so you can publish ble_gateway packets to MQTT and use it in any number of HA instances, more details you can find here.

it's working natively without MQTT. Below is a screenshot from second HA instance - parse_data service working on both HAs simultaneously

image

myhomeiot commented 1 year ago

@to4ko I don't know that you can connect ESPHome to two instances of HA simultaneously. Just seen that in latest version of ESPHome in order to be able to call services you will need to enable it for new connected ESP.