Files
jdillenburg-esphome/trash/adxl345-test.yaml
John Dillenburg d1578f36e0 yaml
2024-11-24 15:47:04 -06:00

61 lines
1.1 KiB
YAML

esphome:
name: adxl345-test
friendly_name: ADXL345 Test
includes:
- ADXL345.h
libraries:
- "Wire"
- "SPI"
- "Adafruit BusIO"
- "Adafruit Unified Sensor"
- "Adafruit ADXL345"
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "/v0qaJ9WNLlO/ceNxMjQN/4L1kDpg4xF3GB+huSE9uU="
ota:
password: "d29c9732c14ab553c7b61cf7518893b8"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Adxl345-Test Fallback Hotspot"
password: "51tWtojf169e"
captive_portal:
i2c:
sda: 21
scl: 22
scan: true
sensor:
- platform: custom
lambda: |-
auto adxl345 = new ADXL345Sensor();
App.register_component(adxl345);
return {
adxl345->off_vertical
};
sensors:
- name: "Off Vertical"
unit_of_measurement: percentage
filters:
- sliding_window_moving_average:
window_size: 5
send_every: 5
- lambda: return 100 * x / 45.0;