I am trying to set up a HID ble remote device https://www.daraz.pk/products/i3176167-s1293326595.html?urlFlag=true&mp=1 as a trigger in esphome using this custom component GitHub - fsievers22/esphome-ble-remote: ESPHome custom component for a BLE remote (FireTV-Stick remote)
I tried the following code
esphome:
name: aquariumnode
platform: ESP32
board: esp32dev
framework:
type: esp-idf
sdkconfig_options:
CONFIG_BT_ENABLED: y
includes:
- ble_hid_client.h
- ble_hid_client.cpp
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esp-Br-Node Fallback Hotspot"
password: "kKfOVX4ic1Sl"
# Example configuration entry
web_server:
port: 80
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "f984b7388804c75579f6fab55f8272d5"
esp32_ble_tracker:
captive_portal:
ble_client:
# Replace with the MAC address of your device.
- mac_address: 40:00:13:F4:A7:CD
id: itag_black
sensor:
- platform: ble_client
name: itag_black
ble_client_id: itag_black
service_uuid: '1812'
characteristic_uuid: '2a19'
- platform: ble_client
ble_client_id: itag_black
name: "button keys"
service_uuid: "1812"
characteristic_uuid: "2a4d"
notify: true
on_notify:
- lambda: 'ESP_LOGD("KEY", "value: %f", x);'
custom_component:
- id: ble_hid
lambda: |-
auto ble_component = new BleHidClientComponent();
App.register_component(ble_component);
return {ble_component};
text_sensor:
- platform: custom
lambda: |-
return {ble_hid_keycode(ble_hid)};
text_sensors:
- name: "KeycodeSensor"
binary_sensor:
- platform: custom
lambda: |-
return {ble_hid_keypress(ble_hid)};
binary_sensors:
- name: "KeypressSensor"
but it throws a throws error target_platform error. I did place the .cpp and .h files in esphome directory. and changed the mac address in .cpp file.