So my coffee grinder has Bluetooth…
The previous owner of our house installed LED strips below the kitchen cabinets. Ever since we had moved in, I had planned on replacing the LED drivers with ZigBee ones, so I could connect them up to Home Assistant.
I got a couple of these. These are adjustable constant current drivers - luckily the LED strips had their Watt/metre value printed on them, so it was easy enough to work out what current to set them to.
Now what to do with them…
The one that sits over my coffee machine turned out to be pretty useful, but I was pressing a ZigBee button to turn it on and off like a heathen.
I have a ZigBee energy monitor on my coffee machine, so my first thought was setting up an automation that looked for power usage. Unfortunately, the heater draws more power than the pump, and the heater being on is an indicator that it’s heating up - not that it is in use.
I put that idea to bed and forgot about the automation for a while.
What’s the grinder got to do with this story?
I have a Baratza Sette 270Wi Grinder. It is pretty nifty. It was a built-in scale and will automatically dose exact amounts of coffee straight into the basket. The scale was being a bit funny, so I pulled out the companion app to see what the scales were doing in the background.
The app told me there was a firmware upgrade available for the scales, so I ran the updater.
Wait. How did the firmware upgrade?
I’m glad you asked!
It uses Bluetooth.
I had been playing around with esphome recently, and had to connect to some Bluetooth garden sensor - to do that I had to use the ble_scanner
function to find them. Would that find the coffee machine?
I knocked up a quick esphome file, and pushed it to an ESP32.
esphome:
name: "ble-scanner"
esp32:
board: esp32dev
logger:
api:
password: ""
ota:
- platform: esphome
password: ""
esp32_ble_tracker:
text_sensor:
- platform: ble_scanner
name: "BLE Devices Scanner"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "ble_scanner"
password: ""
captive_portal:
And waited for it to scan.
[21:28:17][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363078,"address":"4E:E7:9F:30:9D:A4","rssi":-88,"name":""}'
[21:28:18][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363078,"address":"40:2F:A2:74:D5:F0","rssi":-76,"name":""}'
[21:28:19][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363079,"address":"4E:E7:9F:30:9D:A4","rssi":-76,"name":""}'
[21:28:19][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363079,"address":"7C:D3:5B:1A:F5:93","rssi":-59,"name":""}'
[21:28:19][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363079,"address":"6C:B7:B7:CA:F8:3D","rssi":-80,"name":""}'
[21:28:20][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363080,"address":"40:2F:A2:74:D5:F0","rssi":-92,"name":""}'
[21:28:20][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363080,"address":"C8:69:CD:43:6A:B5","rssi":-64,"name":""}'
[21:28:21][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363081,"address":"E0:32:32:AD:F7:9D","rssi":-65,"name":""}'
[21:28:22][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363082,"address":"7C:D3:5B:1A:F5:93","rssi":-63,"name":""}'
[21:28:22][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363082,"address":"6C:B7:B7:CA:F8:3D","rssi":-93,"name":""}'
No dice. But this is actually good! The coffee machine isn’t on yet, so if it was broadcasting now, this process would be a bust.
I turned it on, and tried again…
[21:29:40][D][text_sensor:064]: 'BLE Devices Scanner': Sending state '{"timestamp":363160,"address":"00:1C:97:1C:A3:B3","rssi":-73,"name":"BARW270A3B3"}'
Found it! I grabbed the MAC of the device, and change the esphome YAML file to be:
esphome:
name: "ble-scanner"
esp32:
board: esp32dev
logger:
api:
password: ""
ota:
- platform: esphome
password: ""
esp32_ble_tracker:
binary_sensor:
- platform: ble_presence
mac_address: 00:1C:97:1C:A3:B3
name: "BARW270A3B3 Power"
timeout: 30s
sensor:
- platform: ble_rssi
mac_address: 00:1C:97:1C:A3:B3
name: "BARW270A3B3 RSSI"
wifi:
ssid: !secret iot_wifi_ssid
password: !secret iot_wifi_password
ap:
ssid: "ble_scanner_poc"
password: ""
captive_portal:
This creates a binary sensor in home assistant called “BARW270A3B3 Power”, which can be used to trigger an automation to turn on and off the lights!