Chreece / BTHomeV2-ESP32-example

An BTHome v2 example with encryption for ESP32
MIT License
35 stars 7 forks source link

BTHome.cpp:7:6: error: no declaration matches 'void BTHome::begin(String, bool, const uint8_t*, bool)' #24

Open feiticeir0 opened 1 year ago

feiticeir0 commented 1 year ago

Hi ! First, thank you for the code. I'm trying to use this, but getting the following error:

/home/feiticeir0/Documents/Arduino/BTHome/BTHome.ino: In function 'void setup()':
/home/feiticeir0/Documents/Arduino/BTHome/BTHome.ino:24:27: error: call of overloaded 'begin(const char [8])' is ambiguous
   bthome.begin(DEVICE_NAME);
                           ^
In file included from /home/feiticeir0/Documents/Arduino/BTHome/BTHome.ino:11:
/home/feiticeir0/Documents/Arduino/BTHome/BTHome.h:117:10: note: candidate: 'void BTHome::begin(String, bool, const uint8_t*, bool)'
     void begin(String dname = "DIY-sensor", bool encryption = false, uint8_t const* const key = NULL, bool trigger_based_device = false);
          ^~~~~
/home/feiticeir0/Documents/Arduino/BTHome/BTHome.h:118:10: note: candidate: 'void BTHome::begin(String, bool, String, bool)'
     void begin(String dname = "DIY-sensor", bool encryption = false, String key = "", bool trigger_based_device = false);
          ^~~~~

exit status 1

Compilation error: call of overloaded 'begin(const char [8])' is ambiguous

Per instructions, without encryption, I've commented out DEFINE_ENCRYPTION and BIND_KEY...

The line that gets red in the editor is this one:

bthome.begin(DEVICE_NAME);

Thank you

Chreece commented 1 year ago

@countrysideboy what could be here wrong?

bineagu commented 1 year ago

you can replace the line bthome.begin(DEVICE_NAME); with bthome.begin(DEVICE_NAME,false, "", false);

feiticeir0 commented 1 year ago

you can replace the line bthome.begin(DEVICE_NAME); with bthome.begin(DEVICE_NAME,false, "", false);

Thank you . I did try some, but none worked. Will try and post the result. Thank you

countrysideboy commented 1 year ago

try bthome.begin("DIY-Sensor"); or String DEVICE_NAME = "DIY-sensor";

It maybe related to the compiler judgment of char arrays and strings.