1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-16 07:40:29 +01:00

Include MAC address in noise hello (#8551)

This commit is contained in:
J. Nick Koston 2025-04-12 09:16:14 -10:00 committed by Jesse Hills
parent 7c4ab7abfe
commit 2c499b326a
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -311,6 +311,10 @@ APIError APINoiseFrameHelper::state_action_() {
const std::string &name = App.get_name(); const std::string &name = App.get_name();
const uint8_t *name_ptr = reinterpret_cast<const uint8_t *>(name.c_str()); const uint8_t *name_ptr = reinterpret_cast<const uint8_t *>(name.c_str());
msg.insert(msg.end(), name_ptr, name_ptr + name.size() + 1); msg.insert(msg.end(), name_ptr, name_ptr + name.size() + 1);
// node mac, terminated by null byte
const std::string &mac = get_mac_address();
const uint8_t *mac_ptr = reinterpret_cast<const uint8_t *>(mac.c_str());
msg.insert(msg.end(), mac_ptr, mac_ptr + mac.size() + 1);
aerr = write_frame_(msg.data(), msg.size()); aerr = write_frame_(msg.data(), msg.size());
if (aerr != APIError::OK) if (aerr != APIError::OK)