I have a mini ESP32 C3 board, and I am not able to install to it @NicoIIT
This is my setup:
esphome:
name: fan
esp32:
board: esp32-c3-devkitm-1
framework:
type: esp-idf
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "CQ9eKokvQxcPtJ2YelCdUoiSbydfR8KpK9ec6Fg2rKc="
ota:
- platform: esphome
password: "caf3bb91f14fb099775cb5670ad442ec"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Fan Fallback Hotspot"
password: "aQOM0grbgQcK"
captive_portal:
external_components:
source: github://NicoIIT/esphome-components
ble_adv_controller:
# A controller per device, or per remote in fact as it has the same role
- id: my_controller
# encoding: could be any of 'zhijia', 'fanlamp_pro', 'smartlamp_pro' (the 2 last are the same)
encoding: fanlamp_pro
# variant: variant of the encoding
# For ZhiJia: Can be v0 (MSC16), v1 (MSC26) or v2 (MSC26A), default is v2
# For Fanlamp: Can be any of 'v1a', 'v1b', 'v2' or 'v3', depending on how old your lamp is... Default is 'v3'
variant: v3
# max_duration (default 3000, range 300 -> 10000): the maximum duration in ms during which the command is advertized.
# if a command is received before the 'max_duration' but after the 'duration', it is processed immediately
# Increasing this parameter will have no major consequences, the component will just keep advertize the command
# Could be interesting at pairing time to have the pairing command advertized for a long time
max_duration: 3000
# duration (default 200, range 100 -> 500): the MINIMUM duration in ms during which the command is sent.
# It corresponds to the maximum time the controlled device is taking to process a command and be ready to receive a new one.
# if a command is received before the 'duration' it is queued and processed later,
# if there is already a similar command pending, in this case the pending command is removed from the queue
# Increasing this parameter will make the combination of commands slower. See 'Dynamic Configuration'.
duration: 200
# reversed: reversing the cold / warm at encoding time, needed for some controllers
# default to false
reversed: false
# forced_id: provide the 4 bytes identifier key extracted from your app phone traffic
# to share the same key than the phone
# example: 0xBFF62757
# For ZhiJia, default to 0xC630B8 which was the value hard-coded in ble_adv_light component. Max 0xFFFFFF.
# For FanLamp: default to 0, uses the hash id computed by esphome from the id/name of the controller
forced_id: 0
# show_config (default true): shows the dynamic configuration in the device info page in Home Automation
show_config: true
fan:
- platform: ble_adv_controller
ble_adv_controller_id: my_controller
name: fan
# speed_count: the number of speed level available on your remote / app. Can be 0 / 3 / 6.
# if not properly setup the remote and this component does not behave properly together
# only speed 6 is available for zhijia, and this is the default
speed_count: 6
# use_direction: ability to change the fan direction forward / reverse.
# default to true, not available for zhijia
use_direction: true
# use_oscillation: ability to start / stop the fan oscillation.
# default to false, only available for FanLamp v2 / v3
use_oscillation: false
button:
- platform: ble_adv_controller
ble_adv_controller_id: my_controller
name: Pair
# cmd: the action to be executed when the button is pressed
# any of 'pair', 'unpair', 'custom', 'light_on', ...
cmd: pair
I get this error:
INFO ESPHome 2024.7.3
INFO Reading configuration /config/fan.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing fan (board: esp32-c3-devkitm-1; framework: espidf; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP32C3 160MHz, 320KB RAM, 4MB Flash
- framework-espidf @ 3.40407.240606 (4.4.7)
- tool-cmake @ 3.16.4
- tool-ninja @ 1.7.1
- toolchain-esp32ulp @ 2.35.0-20220830
- toolchain-riscv32-esp @ 8.4.0+2021r2-patch5
Reading CMake configuration...
Dependency Graph
|-- noise-c @ 0.1.4
Compiling .pioenvs/fan/src/esphome/components/ble_adv_controller/fanlamp_pro.o
Compiling .pioenvs/fan/src/esphome/components/ble_adv_controller/zhijia.o
Compiling .pioenvs/fan/src/esphome/components/captive_portal/captive_portal.o
Compiling .pioenvs/fan/src/esphome/components/esp32/core.o
Compiling .pioenvs/fan/src/esphome/components/esp32/gpio.o
src/esphome/components/ble_adv_controller/fanlamp_pro.cpp: In function 'uint16_t esphome::bleadvcontroller::sign(uint8_t*, uint8_t, uint16_t)':
src/esphome/components/ble_adv_controller/fanlamp_pro.cpp:78:35: error: 'ESP_AES_ENCRYPT' was not declared in this scope
mbedtls_aes_crypt_ecb(&aes_ctx, ESP_AES_ENCRYPT, aes_in, aes_out);
^~~~~~~~~~~~~~~
src/esphome/components/ble_adv_controller/fanlamp_pro.cpp:78:35: note: suggested alternative: 'ESP_BLE_SEC_ENCRYPT'
mbedtls_aes_crypt_ecb(&aes_ctx, ESP_AES_ENCRYPT, aes_in, aes_out);
^~~~~~~~~~~~~~~
ESP_BLE_SEC_ENCRYPT
src/esphome/components/ble_adv_controller/fanlamp_pro.cpp: In function 'void esphome::bleadvcontroller::v2_whiten(uint8_t*, uint8_t, uint8_t, uint8_t)':
src/esphome/components/ble_adv_controller/fanlamp_pro.cpp:86:44: error: suggest parentheses around '+' in operand of '&' [-Werror=parentheses]
buf[i] ^= XBOXES[(seed + i + 9) & 0x1f + (salt & 0x3) * 0x20];
~~~~~^~~~~~~~~~~~~~~~~~~~~
src/esphome/components/ble_adv_controller/zhijia.cpp: In function 'void esphome::bleadvcontroller::msc16_msc26::aes26Encrypt(uint8_t*, uint8_t*, uint8_t*, uint8_t, uint8_t, uint8_t, uint8_t*, uint8_t*)':
src/esphome/components/ble_adv_controller/zhijia.cpp:240:33: error: suggest parentheses around arithmetic in operand of '^' [-Werror=parentheses]
txData[8] = (txData[8] & 1) - 1 ^ txData[8];
~~~~~~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp: In function 'unsigned char* esphome::bleadvcontroller::msc26a::stage2(unsigned char*, unsigned int, unsigned int)':
src/esphome/components/ble_adv_controller/zhijia.cpp:424:32: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
(uVar4 & 2 | (uVar4 & 1) << 2 | (uVar4 & 0xff) >> 2 & 1)
~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp:424:77: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
(uVar4 & 2 | (uVar4 & 1) << 2 | (uVar4 & 0xff) >> 2 & 1)
~~~~~~~~~~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp:423:36: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
(uVar4 >> 3 & 1 |
~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp:422:44: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
((uVar4 & 0xff) >> 4 & 1 |
~~~~~~~~~~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp:421:34: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
(uVar4 >> 5 & 1 |
~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp:420:33: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
(uint8_t)((uVar4 >> 6 & 1 |
~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp:419:33: error: suggest parentheses around arithmetic in operand of '|' [-Werror=parentheses]
(uint8_t)(uVar4 >> 7) & 1 |
~~~~~~~~~~~~~~~~~~~~~~^~~
src/esphome/components/ble_adv_controller/zhijia.cpp: In function 'void esphome::bleadvcontroller::msc26a::whitening_encode(unsigned char*, int, unsigned int*)':
src/esphome/components/ble_adv_controller/zhijia.cpp:500:49: error: suggest parentheses around arithmetic in operand of '^' [-Werror=parentheses]
iVar4 += (uVar2 ^ bVar1 >> (uVar3 & 0xff) & 1) << (uVar3 & 0xff);
~~~~~~~~~~~~~~~~~~~~~~~~^~~
cc1plus: some warnings being treated as errors
*** [.pioenvs/fan/src/esphome/components/ble_adv_controller/fanlamp_pro.o] Error 1
cc1plus: some warnings being treated as errors
*** [.pioenvs/fan/src/esphome/components/ble_adv_controller/zhijia.o] Error 1
========================= [FAILED] Took 23.37 seconds =========================