120 lines
2.4 KiB
YAML
120 lines
2.4 KiB
YAML
substitutions:
|
|
esp_name: "esp32-atom-matrix"
|
|
|
|
esphome:
|
|
name: ${esp_name}
|
|
comment: ${esp_name}
|
|
|
|
|
|
esp32:
|
|
board: m5stack-atom
|
|
framework:
|
|
type: arduino
|
|
|
|
# Enable logging
|
|
logger:
|
|
|
|
# Enable Home Assistant API
|
|
api:
|
|
encryption:
|
|
key: !secret esp32-atom-matrix_api
|
|
|
|
ota:
|
|
password: !secret ota_password
|
|
|
|
wifi:
|
|
ssid: !secret wifi_ssid
|
|
password: !secret wifi_password
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
ap:
|
|
ssid: ${esp_name} fallback
|
|
password: !secret fallback_password
|
|
|
|
captive_portal:
|
|
|
|
globals:
|
|
- id: display_index
|
|
type: int
|
|
restore_value: no
|
|
initial_value: '7'
|
|
- id: display_index_def
|
|
type: int
|
|
restore_value: no
|
|
initial_value: '17'
|
|
|
|
|
|
# Define I2C interface
|
|
i2c:
|
|
sda: 25
|
|
scl: 21
|
|
scan: true
|
|
#frequency: 200kHz
|
|
|
|
font:
|
|
- file: "fonts/5x5.ttf"
|
|
id: matrix_font
|
|
size: 10
|
|
|
|
binary_sensor:
|
|
- platform: gpio # btn
|
|
id: button
|
|
pin:
|
|
number: 39
|
|
inverted: true
|
|
# --- End if binary_sensor: --- #
|
|
|
|
light:
|
|
- platform: fastled_clockless
|
|
chipset: WS2812B
|
|
pin: GPIO27
|
|
num_leds: 25
|
|
rgb_order: GRB
|
|
name: "led_matrix"
|
|
id: led_matrix_light
|
|
default_transition_length: 0s
|
|
color_correct: [50%, 50%, 50%]
|
|
restore_mode: ALWAYS_ON
|
|
|
|
display:
|
|
- platform: addressable_light
|
|
id: led_matrix_display
|
|
addressable_light_id: led_matrix_light
|
|
width: 5
|
|
height: 5
|
|
rotation: 90°
|
|
update_interval: 200ms
|
|
lambda: |-
|
|
// Draw a bulls-eye pattern
|
|
Color red = Color(0xFF0000);
|
|
Color green = Color(0x00FF00);
|
|
Color blue = Color(0x0000FF);
|
|
it.printf(id(display_index), -4, id(matrix_font), blue, TextAlign::TOP_LEFT, "Tim");
|
|
if(id(display_index) <= id(display_index_def)*-1)
|
|
{
|
|
id(display_index) = 7;
|
|
}
|
|
else
|
|
{
|
|
id(display_index) -= 1;
|
|
}
|
|
# --- End of light: --- #
|
|
|
|
# sensor:
|
|
# - platform: mpu6886
|
|
# address: 0x68
|
|
# update_interval: 1s # Defaults to 60s, but seems to work fine up to at least 300ms
|
|
# accel_x:
|
|
# name: "MPU6886 Accel X"
|
|
# accel_y:
|
|
# name: "MPU6886 Accel Y"
|
|
# accel_z:
|
|
# name: "MPU6886 Accel z"
|
|
# gyro_x:
|
|
# name: "MPU6886 Gyro X"
|
|
# gyro_y:
|
|
# name: "MPU6886 Gyro Y"
|
|
# gyro_z:
|
|
# name: "MPU6886 Gyro z"
|
|
# temperature:
|
|
# name: "MPU6886 Temperature" |