找回密码
 立即注册

微信扫码登录

搜索
楼主: 191442029

[技术讨论] 通过ESP32 接入 各种手环 心率广播进homeassistant V3.1.1

[复制链接]

14

主题

1675

回帖

5584

积分

论坛元老

积分
5584
金钱
3895
HASS币
0
发表于 昨天 20:33 | 显示全部楼层
2.82和另外一个不带的什么区别?
回复

使用道具 举报

14

主题

1675

回帖

5584

积分

论坛元老

积分
5584
金钱
3895
HASS币
0
发表于 昨天 21:58 | 显示全部楼层
编不下去了,各种报错,豆包说的 行数跟实际也不一样,搞不懂了
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In member function 'virtual void MyAdvertisedDeviceCallbacks::onResult(BLEAdvertisedDevice)':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:190:64: error: conversion from 'String' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
  190 |       std::string addr = advertisedDevice.getAddress().toString();
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:195:41: error: no match for 'operator=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'String')
  195 |         name = advertisedDevice.getName();
      |                                         ^
In file included from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/string:54,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/locale_classes.h:40,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/ios_base.h:41,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/ios:44,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/ostream:40,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/unique_ptr.h:43,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/memory:78,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\Network\src/NetworkClient.h:24,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\Network\src/Network.h:12,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\WiFi\src/WiFiGeneric.h:44,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\WiFi\src/WiFiSTA.h:30,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\libraries\WiFi\src/WiFi.h:34,
                 from D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:81:
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:941:8: note: candidate: 'template<class _Tp> constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  941 |        operator=(const _Tp& __svt)
      |        ^~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:941:8: note:   template argument deduction/substitution failed:
In file included from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/stl_pair.h:60,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/stl_algobase.h:64,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/specfun.h:43,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/cmath:3898,
                 from C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/math.h:36,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\cores\esp32/esp32-hal.h:30,
                 from C:\Users\����\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.3.2\cores\esp32/Arduino.h:44,
                 from C:\Users\����\AppData\Local\arduino\sketches\DC35C61FB4475D85D687B17CD37E6F1E\sketch\ESP32_HRMLink_Fixed.ino.cpp:1:
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:149:8:   required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = String; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  149 |         using _If_sv = enable_if_t<
      |               ^~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:941:8:   required by substitution of 'template<class _Tp> constexpr std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::operator=(const _Tp&) [with _Tp = String]'
  941 |        operator=(const _Tp& __svt)
      |        ^~~~~~~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:195:41:   required from here
  195 |         name = advertisedDevice.getName();
      |                                         ^
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/type_traits:2696:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
 2696 |     using enable_if_t = typename enable_if<_Cond, _Tp>::type;
      |           ^~~~~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:817:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  817 |       operator=(const basic_string& __str)
      |       ^~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:817:37: note:   no known conversion for argument 1 from 'String' to 'const std::__cxx11::basic_string<char>&'
  817 |       operator=(const basic_string& __str)
      |                 ~~~~~~~~~~~~~~~~~~~~^~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:828:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  828 |       operator=(const _CharT* __s)
      |       ^~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:828:31: note:   no known conversion for argument 1 from 'String' to 'const char*'
  828 |       operator=(const _CharT* __s)
      |                 ~~~~~~~~~~~~~~^~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:840:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  840 |       operator=(_CharT __c)
      |       ^~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:840:24: note:   no known conversion for argument 1 from 'String' to 'char'
  840 |       operator=(_CharT __c)
      |                 ~~~~~~~^~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:858:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  858 |       operator=(basic_string&& __str)
      |       ^~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:858:32: note:   no known conversion for argument 1 from 'String' to 'std::__cxx11::basic_string<char>&&'
  858 |       operator=(basic_string&& __str)
      |                 ~~~~~~~~~~~~~~~^~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:926:7: note: candidate: 'constexpr std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
  926 |       operator=(initializer_list<_CharT> __l)
      |       ^~~~~~~~
C:/Users/����/AppData/Local/Arduino15/packages/esp32/tools/esp-rv32/2507/riscv32-esp-elf/include/c++/14.2.0/bits/basic_string.h:926:42: note:   no known conversion for argument 1 from 'String' to 'std::initializer_list<char>'
  926 |       operator=(initializer_list<_CharT> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void connectWiFi()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:277:12: error: 'class WiFiClass' has no member named 'enableIpV6'; did you mean 'enableIPv6'?
  277 |       WiFi.enableIpV6();
      |            ^~~~~~~~~~
      |            enableIPv6
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:281:20: error: 'class WiFiClass' has no member named 'localIPv6'; did you mean 'localIP'?
  281 |       while (!WiFi.localIPv6().toString().startsWith("fe80:") && ipv6_attempts < 10) {
      |                    ^~~~~~~~~
      |                    localIP
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:288:16: error: 'class WiFiClass' has no member named 'localIPv6'; did you mean 'localIP'?
  288 |       if (WiFi.localIPv6().toString().startsWith("fe80:")) {
      |                ^~~~~~~~~
      |                localIP
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:291:29: error: 'class WiFiClass' has no member named 'localIPv6'; did you mean 'localIP'?
  291 |         Serial.println(WiFi.localIPv6());
      |                             ^~~~~~~~~
      |                             localIP
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void connectMQTT()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:313:28: warning: format '%X' expects argument of type 'unsigned int', but argument 4 has type 'long int' [-Wformat=]
  313 |     snprintf(clientId, 32, "ESP32-HRMLink-%04X", random(0xffff));
      |                            ^~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~
      |                                                        |
      |                                                        long int
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void sendMQTTDiscovery()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:339:28: warning: 'DynamicJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  339 |   DynamicJsonDocument hrDoc(1024);
      |                            ^
In file included from d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson.hpp:65,
                 from d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson.h:9,
                 from D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:88:
d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson/compatibility.hpp:125:58: note: declared here
  125 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") DynamicJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:355:47: warning: 'ArduinoJson::V742PB22::JsonObject ArduinoJson::V742PB22::JsonDocument::createNestedObject(TChar*) [with TChar = const char]' is deprecated: use doc[key].to<JsonObject>() instead [-Wdeprecated-declarations]
  355 |   JsonObject device = hrDoc.createNestedObject("device");
      |                       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
In file included from d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson.hpp:42:
d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson/Document/JsonDocument.hpp:376:14: note: declared here
  376 |   JsonObject createNestedObject(TChar* key) {
      |              ^~~~~~~~~~~~~~~~~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void publishMQTT()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:377:3: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  377 |   StaticJsonDocument<256> doc;
      |   ^~~~~~~~~~~~~~~~~~
d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void handleApiStatus()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:834:3: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  834 |   StaticJsonDocument<350> doc;
      |   ^~~~~~~~~~~~~~~~~~
d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:845:24: error: 'class WiFiClass' has no member named 'localIPv6'; did you mean 'localIP'?
  845 |     doc["ipv6"] = WiFi.localIPv6().toString();
      |                        ^~~~~~~~~
      |                        localIP
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void handleScan()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:869:16: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
  869 |   DEBUG_PRINTF("Free heap before scan: %d\n", ESP.getFreeHeap());
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~
      |                                                              |
      |                                                              uint32_t {aka long unsigned int}
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:106:48: note: in definition of macro 'DEBUG_PRINTF'
  106 |   #define DEBUG_PRINTF(fmt, ...) Serial.printf(fmt, ##__VA_ARGS__)
      |                                                ^~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:871:48: error: conversion from 'BLEScanResults*' to non-scalar type 'BLEScanResults' requested
  871 |   BLEScanResults foundDevices = pBLEScan->start(5, false);
      |                                 ~~~~~~~~~~~~~~~^~~~~~~~~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:875:16: warning: format '%d' expects argument of type 'int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
  875 |   DEBUG_PRINTF("Free heap after scan: %d\n", ESP.getFreeHeap());
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~
      |                                                             |
      |                                                             uint32_t {aka long unsigned int}
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:106:48: note: in definition of macro 'DEBUG_PRINTF'
  106 |   #define DEBUG_PRINTF(fmt, ...) Serial.printf(fmt, ##__VA_ARGS__)
      |                                                ^~~
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino: In function 'void handleApiConnect()':
D:\ESP32_HRMLink_Fixed\ESP32_HRMLink_Fixed.ino:981:3: warning: 'template<unsigned int N> class ArduinoJson::V742PB22::StaticJsonDocument' is deprecated: use JsonDocument instead [-Wdeprecated-declarations]
  981 |   StaticJsonDocument<128> doc;
      |   ^~~~~~~~~~~~~~~~~~
d:\ESP32_HRMLink_Fixed\libraries\ArduinoJson\src/ArduinoJson/compatibility.hpp:63:58: note: declared here
   63 | class ARDUINOJSON_DEPRECATED("use JsonDocument instead") StaticJsonDocument
      |                                                          ^~~~~~~~~~~~~~~~~~
grpc: error while marshaling: string field contains invalid UTF-8

Compilation error: conversion from 'String' to non-scalar type 'std::string' {aka 'std::__cxx11::basic_string<char>'} requested
回复

使用道具 举报

3

主题

57

回帖

358

积分

中级会员

积分
358
金钱
298
HASS币
0
 楼主| 发表于 12 小时前 | 显示全部楼层
本帖最后由 191442029 于 2025-11-5 08:21 编辑
隔壁的王叔叔 发表于 2025-11-4 21:58
编不下去了,各种报错,豆包说的 行数跟实际也不一样,搞不懂了

板子具体型号?我的是ESP32 DEV MODULE.要选择huge APP.看了下好像还是核心库版本不兼容。。开发板管理器 ESP32降级 2.0.X版本使用,别用3.X的
回复

使用道具 举报

14

主题

1675

回帖

5584

积分

论坛元老

积分
5584
金钱
3895
HASS币
0
发表于 12 小时前 | 显示全部楼层
191442029 发表于 2025-11-5 08:05
板子具体型号?要选择huge APP

esp32 c3.。。。哈哈我已经放弃了,没法抄作业
回复

使用道具 举报

1

主题

60

回帖

201

积分

中级会员

积分
201
金钱
140
HASS币
0
发表于 10 小时前 来自手机 | 显示全部楼层
那个跑步机的步数有没有可能搞出来?同步到微信上?
回复

使用道具 举报

4

主题

129

回帖

1646

积分

金牌会员

积分
1646
金钱
1513
HASS币
0
发表于 1 小时前 | 显示全部楼层
支持  高手
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian ( 晋ICP备17001384号-1 )

GMT+8, 2025-11-5 20:22 , Processed in 0.053632 second(s), 5 queries , MemCached On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表