Project:Humble Homeautomation Handling: Difference between revisions
(Created page with "These are some field notes while playing with sensors, pies and home assistant. == Bluetooth LE Sensors == BLE sensors, like Xiaomi Mijia, are an easy alternative to buildin...") |
NitramLegov (talk | contribs) m (Making the yaml code look prettier) |
||
Line 13: | Line 13: | ||
Passing the Raspberry bluetooth device to the container in which Homeassistant runs proved to be a bit challenging to configure. Therefore the BLE interface is done through ESPhome using the 'Bluetooth Low Energy Tracker Hub' component. Out of the box it kind of works, but WiFi connectivity is fighting with the BLE as they use the same antenna, which results in connection losses. Here are my current ESPhome settings for the BLE tracker, that kind of work.<sup>[citation needed]<sup>not really<sup>I hate Bluetooth</sup></sup></sup> | Passing the Raspberry bluetooth device to the container in which Homeassistant runs proved to be a bit challenging to configure. Therefore the BLE interface is done through ESPhome using the 'Bluetooth Low Energy Tracker Hub' component. Out of the box it kind of works, but WiFi connectivity is fighting with the BLE as they use the same antenna, which results in connection losses. Here are my current ESPhome settings for the BLE tracker, that kind of work.<sup>[citation needed]<sup>not really<sup>I hate Bluetooth</sup></sup></sup> | ||
<syntaxhighlight lang="yaml" line="1"> | |||
#[...] other config | #[...] other config | ||
esp32_ble_tracker: | esp32_ble_tracker: | ||
Line 32: | Line 32: | ||
battery_level: | battery_level: | ||
name: "Living Room Battery Level" | name: "Living Room Battery Level" | ||
- platform: uptime | - platform: uptime | ||
name: "BLE Interface Uptime"</ | name: "BLE Interface Uptime" | ||
</syntaxhighlight> |
Revision as of 01:17, 20 December 2020
These are some field notes while playing with sensors, pies and home assistant.
Bluetooth LE Sensors
BLE sensors, like Xiaomi Mijia, are an easy alternative to building low power with an ESP32 or similar µC. Here are some issues I ran into while trying to integrate them into Homeassistant running on a Raspberry Pi.
Xiaomi LYWSD03MMC
Most BLE sensors advertise their data via GATT packets, that can be read by anyone in range. That makes it easy to integrate them without any configuration or apps. The LYWSD03MMC however encrypts these packets and needs to be configured via a (shady) Xiaomi app to get the binding keys for decryption. To circumvent this there is a GitHub project by atc1441 with which the pairing can be done via Web-Bluetooth through a browser (Chrome worked for me; Firefox and Safari don't support Web-BT currently). There is also a custom firmware for the sensors, that can also be uploaded via the web interface. It allows for changing settings like the advertising intervals and units. When using the custom firmware with ESPhome the 'Advertising Type' needs to be set to 'Mi Like' in order to work. Homeassistant supports the custom unencrypted already as it seems.
Integrating BLE devices on (rootless) container
Passing the Raspberry bluetooth device to the container in which Homeassistant runs proved to be a bit challenging to configure. Therefore the BLE interface is done through ESPhome using the 'Bluetooth Low Energy Tracker Hub' component. Out of the box it kind of works, but WiFi connectivity is fighting with the BLE as they use the same antenna, which results in connection losses. Here are my current ESPhome settings for the BLE tracker, that kind of work.[citation needed]not reallyI hate Bluetooth
#[...] other config
esp32_ble_tracker:
scan_parameters:
interval: 100s
window: 120ms
active: false
sensor:
- platform: xiaomi_lywsd03mmc
mac_address: "XX:XX:XX:XX:XX:XX:XX"
bindkey: "abcdabcdabcdabcdabcdabcdabcdabcd"
temperature:
name: "Living Room Temperature"
humidity:
name: "Living Room Humidity"
battery_level:
name: "Living Room Battery Level"
- platform: uptime
name: "BLE Interface Uptime"