Project:Humble Homeautomation Handling: Difference between revisions

From CoMakingSpace Wiki

m (Making the yaml code look prettier)
(podman, fuse and I...)
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
== Bluetooth LE Sensors ==
== 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.
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 ===
=== Xiaomi LYWSD03MMC ===
Line 36: Line 36:
   - platform: uptime
   - platform: uptime
     name: "BLE Interface Uptime"
     name: "BLE Interface Uptime"
</syntaxhighlight>
== Other ==
=== Podman and fuse ===
I ran into an issue when using [https://github.com/trapexit/mergerfs mergerFS] together with Podman resulting in the the following error:<syntaxhighlight lang="bash">
Error: kernel does not support overlay fs: kernel too old to provide multiple lowers feature for overlay: driver not supported
</syntaxhighlight>Installing fuse-overlayfs seems to fix it.<syntaxhighlight lang="bash">
sudo apt install fuse-overlayfs
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 16:21, 3 June 2021

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"

Other

Podman and fuse

I ran into an issue when using mergerFS together with Podman resulting in the the following error:

Error: kernel does not support overlay fs: kernel too old to provide multiple lowers feature for overlay: driver not supported

Installing fuse-overlayfs seems to fix it.

sudo apt install fuse-overlayfs