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.
jsuanet
(Jos)
May 14, 2022, 10:39am
2
Please post also the log file so we can see the exact error.
yousaf465
(Yousaf465)
May 14, 2022, 10:52am
3
progress
issue was with esp32 and esphome blocks
but now new issue
while compiling the modified code faced this
esphome:
name: aquariumnode
includes:
- ble_hid_client.h
- ble_hid_client.cpp
esp32:
board: esp32dev
framework:
type: esp-idf
sdkconfig_options:
CONFIG_BT_ENABLED: y
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"
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "f984b7388804c75579f6fab55f8272d5"
esp32_ble_tracker:
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"
and logs
INFO Reading configuration /config/esphome/esp-br-node.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing aquariumnode (board: esp32dev; framework: espidf; platform: platformio/espressif32 @ 3.5.0)
Tool Manager: Installing platformio/toolchain-esp32ulp @ ~1.22851.0
Error: Could not find the package with 'platformio/toolchain-esp32ulp @ ~1.22851.0' requirements for your system 'linux_aarch64'
jsuanet
(Jos)
May 14, 2022, 11:15am
4
Well that’s a known ‘external’ issue, the required platformio package is not available for the arm 64 bits platform you are using now to compile the firmware. This has to be solved by the platformio maintainers. A workaround is to install ESPHome on your local pc or use the ESPHome docker container on your local pc or a not arm64 device like f.i. a NAS
yousaf465
(Yousaf465)
May 14, 2022, 11:41am
5
I have already installed esphome on windows and was compiled from it.