『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
楼主: XCray

[修仙教程] 【ESPHome】蓝牙体重秤/体脂秤接入思路:云麦好轻mini 2S为例

[复制链接]

47

主题

1655

帖子

6684

积分

论坛元老

Rank: 8Rank: 8

积分
6684
金钱
5019
HASS币
40
发表于 2022-3-27 14:27:52 | 显示全部楼层
华为的最封闭没有之一
折腾精神永存,感恩感谢论坛每一位愿意分享和帮助过我的大佬,论坛有你更精彩
回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

 楼主| 发表于 2022-3-27 16:38:16 | 显示全部楼层
iamhyde 发表于 2022-3-27 13:41
请教下我的云麦mini2得到的数据是这样
后面长度是6不是14,需要怎样修改呢,谢谢
...

你这显然只是mac地址呀,需要称重时的消息
回复

使用道具 举报

3

主题

301

帖子

3243

积分

论坛元老

Rank: 8Rank: 8

积分
3243
金钱
2942
HASS币
0
发表于 2022-3-27 18:39:35 | 显示全部楼层
XCray 发表于 2022-3-27 16:38
你这显然只是mac地址呀,需要称重时的消息

每次称重都只有这个数据,UUID和Mac地址还不一样
[18:37:23][D][ble_adv:050]: New BLE device
[18:37:23][D][ble_adv:051]:   address: A4:C1:38:28:40:09
[18:37:23][D][ble_adv:052]:   name: YUNMAI-ISM22T
[18:37:23][D][ble_adv:053]:   Advertised service UUIDs:
[18:37:23][D][ble_adv:055]:     - 0x1310
[18:37:23][D][ble_adv:055]:     - 0xD618
[18:37:23][D][ble_adv:057]:   Advertised service data:
[18:37:23][D][ble_adv:061]:   Advertised manufacturer data:
[18:37:23][D][ble_adv:061]:   Advertised manufacturer data:
[18:37:23][D][ble_adv:063]:     - 0x4009: (length 6)


回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

 楼主| 发表于 2022-3-28 08:02:35 | 显示全部楼层
iamhyde 发表于 2022-3-27 18:39
每次称重都只有这个数据,UUID和Mac地址还不一样

肯定是哪儿没弄对。

称重数据肯定要发出来呀,不妨再仔细看看官方app的工作过程,实在不行蓝牙抓包看看
回复

使用道具 举报

80

主题

388

帖子

1680

积分

金牌会员

Rank: 6Rank: 6

积分
1680
金钱
1292
HASS币
0
发表于 2022-4-2 20:41:49 | 显示全部楼层
本帖最后由 ciasdmxhxjjpd@c 于 2022-4-2 20:43 编辑

荣耀 a100, 显示 无数据
esp32_ble_tracker:
  on_ble_advertise:
    - mac_address: C8:B2:1E:81:1B:45
      then:
        - lambda: |-
            ESP_LOGD("ble_adv", "New BLE device");
            ESP_LOGD("ble_adv", "  address: %s", x.address_str().c_str());
            ESP_LOGD("ble_adv", "  name: %s", x.get_name().c_str());
           
            ESP_LOGD("ble_adv", "  Advertised manufacturer data:");
            for (auto data : x.get_manufacturer_datas()) {
                                ESP_LOGD("ble_adv", "    - %s:%s", data.uuid.to_string().c_str(), hexencode(data.data).c_str());
            }
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][xiaomi_ble:314]: Got Xiaomi LYWSD03MMC :
[D][xiaomi_ble:317]:   Temperature: 13.6°C
[D][xiaomi_ble:320]:   Humidity: 39.0%
[D][sensor:125]: 'Outdoor LYWSD03MMC Temperature': Sending state 13.60000 °C with 1 decimals of accuracy
[D][sensor:125]: 'Outdoor LYWSD03MMC Temperature': Sending state 13.60000 °C with 1 decimals of accuracy
[D][sensor:125]: 'Outdoor LYWSD03MMC Humidity': Sending state 39.00000 % with 0 decimals of accuracy
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:061]:   name: AH100
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45
[D][ble_adv:059]: New BLE device
[D][ble_adv:060]:   address: C8:B2:1E:81:1B:45
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:063]:   Advertised manufacturer data:
[D][ble_adv:065]:     - 0xB2C8:1E.81.1B.45

回复

使用道具 举报

80

主题

388

帖子

1680

积分

金牌会员

Rank: 6Rank: 6

积分
1680
金钱
1292
HASS币
0
发表于 2022-4-2 20:45:00 | 显示全部楼层
ciasdmxhxjjpd@c 发表于 2022-4-2 20:41
荣耀 a100, 显示 无数据

编译的时候,报warming

INFO Reading configuration /config/esp32.yaml...
WARNING GPIO2 is a Strapping PIN and should be avoided.
Attaching external pullup/down resistors to strapping pins can cause unexpected failures.
See https://esphome.io/guides/faq.html#why-am-i-getting-a-warning-about-strapping-pins
INFO Generating C++ source...
INFO Compiling app...
Processing esp32 (board: nodemcu-32s; framework: arduino; platform: platformio/espressif32 @ 3.5.0)
--------------------------------------------------------------------------------
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
Dependency Graph
|-- <AsyncTCP-esphome> 1.2.2
|-- <WiFi> 1.0
|-- <FS> 1.0
|-- <Update> 1.0
|-- <ESPAsyncWebServer-esphome> 2.1.0
|   |-- <AsyncTCP-esphome> 1.2.2
|-- <DNSServer> 1.1.0
|-- <ESPmDNS> 1.0
|-- <ArduinoJson> 6.18.5
Compiling .pioenvs/esp32/src/main.cpp.o
In file included from src/esphome/components/sensor/sensor.h:3:0,
                 from src/esphome/core/application.h:16,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
/config/esp32.yaml: In lambda function:
/config/esp32.yaml:65:96: warning: 'std::__cxx11::string esphome::hexencode(const T&) [with T = std::vector<unsigned char>; std::__cxx11::string = std::__cxx11::basic_string<char>]' is deprecated: hexencode() is deprecated, use format_hex_pretty() instead. [-Wdeprecated-declarations]
                 ESP_LOGD("ble_adv", "    - %s:%s", data.uuid.to_string().c_str(), hexencode(data.data).c_str());
                                                                                                ^
src/esphome/core/log.h:92:89: note: in definition of macro 'esph_log_d'
   esp_log_printf_(ESPHOME_LOG_LEVEL_DEBUG, tag, __LINE__, ESPHOME_LOG_FORMAT(format), ##__VA_ARGS__)
                                                                                         ^
/config/esp32.yaml:65:11: note: in expansion of macro 'ESP_LOGD'
                 ESP_LOGD("ble_adv", "    - %s:%s", data.uuid.to_string().c_str(), hexencode(data.data).c_str());
           ^
In file included from src/esphome/core/preferences.h:6:0,
                 from src/esphome/core/application.h:6,
                 from src/esphome/components/api/api_connection.h:4,
                 from src/esphome.h:3,
                 from src/main.cpp:3:
src/esphome/core/helpers.h:644:13: note: declared here
 std::string hexencode(const T &data) {
             ^
src/esphome/core/helpers.h: In instantiation of 'std::__cxx11::string esphome::hexencode(const T&) [with T = std::vector<unsigned char>; std::__cxx11::string = std::__cxx11::basic_string<char>]':
/config/esp32.yaml:65:11:   required from here
src/esphome/core/helpers.h:645:19: warning: 'std::__cxx11::string esphome::hexencode(const uint8_t*, uint32_t)' is deprecated: hexencode() is deprecated, use format_hex_pretty() instead. [-Wdeprecated-declarations]
   return hexencode(data.data(), data.size());
                   ^
src/esphome/core/helpers.h:640:20: note: declared here
 inline std::string hexencode(const uint8_t *data, uint32_t len) { return format_hex_pretty(data, len); }
回复

使用道具 举报

105

主题

2954

帖子

1万

积分

超级版主

智能家居&单板滑雪痴迷爱好者

Rank: 8Rank: 8

积分
12103
金钱
9084
HASS币
460

教程狂人突出贡献

 楼主| 发表于 2022-4-3 10:15:33 | 显示全部楼层
ciasdmxhxjjpd@c 发表于 2022-4-2 20:45
编译的时候,报warming

只是一个函数被计划废弃了,换成推荐的即可。垃圾华为的东西,这个思路好像不支持,我也没用过,帮不上忙,自己研究吧。
回复

使用道具 举报

7

主题

166

帖子

1302

积分

论坛技术达人

积分
1302
金钱
1131
HASS币
60
发表于 2022-6-4 15:42:26 | 显示全部楼层
mark 后面慢慢学习
回复

使用道具 举报

7

主题

166

帖子

1302

积分

论坛技术达人

积分
1302
金钱
1131
HASS币
60
发表于 2022-6-4 15:44:37 | 显示全部楼层
mark 后面慢慢学习
回复

使用道具 举报

80

主题

388

帖子

1680

积分

金牌会员

Rank: 6Rank: 6

积分
1680
金钱
1292
HASS币
0
发表于 2022-7-20 21:44:03 | 显示全部楼层
3. 打印出这个广播数据,消息内容有变化,部分消息有重复,最多看到过8次:


请问,如何打印指定mac地址的ble设备的广播数据!
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 23:02 , Processed in 0.120972 second(s), 31 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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