I had some time to work on this and have some wonderful updates for anyone interested. Basically, I got an ESP32 to control the light directly over BLE in ESPhome with Home Assistant! The trick is getting the ble commands into the correct format.
Here’s how a proper ble command looks like…
</>
- ble_client.ble_write:
id: lighthouse_ble
service_uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
characteristic_uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
value: [insert hex formatted command here]
</>
Using the reverse engineered info, we have all the commands for on/off, setting themes, colors, brightness, etc
Use this site to convert the command string to hex (Capitalization matters!)
Break the hex into pairs and add a “0x” in front of each to make a byte
So “LEDON” becomes [0x4c, 0x45, 0x44, 0x4f, 0x4e]
Here are examples of buttons I’ve made in ESPHOME…
esp32_ble_tracker:
ble_client:
- mac_address: 24:5C:AB:80:86:82
id: lighthouse_ble
button:
- platform: template
name: "1-Turn ON Moonside Lighthouse"
id: lighthouse_on
on_press:
then:
- ble_client.ble_write:
id: lighthouse_ble
service_uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
characteristic_uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
value: [0x4c, 0x45, 0x44, 0x4f, 0x4e]
- platform: template
name: "2-Turn OFF Moonside Lighthouse"
id: lighthouse_off
on_press:
then:
- ble_client.ble_write:
id: lighthouse_ble
service_uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
characteristic_uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
value: [0x4c, 0x45, 0x44, 0x4f, 0x46, 0x46]
- platform: template
name: "Night Fire"
id: night_fire
on_press:
then:
- ble_client.ble_write:
id: lighthouse_ble
service_uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
characteristic_uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
value: [0x46, 0x49, 0x52, 0x45, 0x31, 0x2E, 0x32, 0x30, 0x2C]
- platform: template
name: "Blending Rainbow"
id: blending_rainbow
on_press:
then:
- ble_client.ble_write:
id: lighthouse_ble
service_uuid: 6e400001-b5a3-f393-e0a9-e50e24dcca9e
characteristic_uuid: 6e400002-b5a3-f393-e0a9-e50e24dcca9e
value: [0x54, 0x48, 0x45, 0x4D, 0x45, 0x2E, 0x52, 0x41, 0x49, 0x4E, 0x42, 0x4F, 0x57, 0x33, 0x2E, 0x30, 0x2C]