I am in a tweaking mode to forward BTHome messages to Home Assistant .
(project Beethowen - BTHome over ESPHome)
With 3023.6.4 and the rework of @jesserockz the previously working workaround is not functioning anymore as APIConnection is hidden in a protected field.
Any ideas?
I could come up with two possible solution ideas
-
generate the HA event in ESPHome and us the forwarding channel of bluetooth_proxy → blocked
-
use a HA sevice call and inject BTHome message from Home Assistant itself → no service exposed for BTHome integration
esphome::api::BluetoothLEAdvertisementResponse msg;
msg.address = client_mac_a64;
msg.service_uuids.push_back("0x181C");
// msg.rssi = -99;
// BTHOME V1
{
esphome::api::BluetoothServiceData btsd;
sd.uuid = "0x01"; // V1 must have header
sd.data.assign({0x06});
msg.service_data.push_back(std::move(btsd));
}
{
esphome::api::BluetoothServiceData btsd;
sd.uuid = "0x181C";
sd.data.assign({
0x02, 0x00, 0xB3, // pkt id
0x23, 0x02, 0xD2, 0x09 // temp
});
msg.service_data.push_back(std::move(btsd));
}
esphome::api::global_api_server->send_bluetooth_le_advertisement(msg);