Files
hassos_config/esphome/esp32-matrix.yaml
2022-12-20 21:26:47 +01:00

178 lines
3.5 KiB
YAML

substitutions:
devicename: esp32-matrix
mypin: GPIO14
board: esp32dev
external_components:
- source:
type: git
url: https://github.com/lubeda/EsphoMaTrix
esphome:
name: $devicename
esp32:
board: $board
binary_sensor:
- platform: status
name: "$devicename Status"
font:
- file: fonts/monobit.ttf
id: ehmtx_font
size: 16
glyphs: |
!?"%()+*=,-_.:°0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz€@<>/
# Enable logging
logger:
api:
encryption:
key: !secret matrix_led_api
services:
- service: alarm
variables:
icon_name: string
text: string
then:
lambda: |-
id(rgb8x32)->add_screen(icon_name, text, 7, true);
id(rgb8x32)->force_screen(icon_name);
- service: screen
variables:
icon_name: string
text: string
then:
lambda: |-
id(rgb8x32)->add_screen(icon_name, text, 5, false);
- service: brightness
variables:
brightness: int
then:
lambda: |-
id(rgb8x32)->set_brightness(brightness);
- service: status
then:
lambda: |-
id(rgb8x32)->get_status();
- service: del_screen
variables:
icon_name: string
then:
lambda: |-
id(rgb8x32)->del_screen(icon_name);
- service: indicator_on
variables:
r: int
g: int
b: int
then:
lambda: |-
id(rgb8x32)->set_indicator_color(r,g,b);
id(rgb8x32)->set_indicator_on();
- service: text_color
variables:
r: int
g: int
b: int
then:
lambda: |-
id(rgb8x32)->set_text_color(r,g,b);
- service: alarm_color
variables:
r: int
g: int
b: int
then:
lambda: |-
id(rgb8x32)->set_alarm_color(r,g,b);
- service: indicator_off
then:
lambda: |-
id(rgb8x32)->set_indicator_off();
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: $devicename
password: "InM2TlqVfJe4"
light:
- platform: neopixelbus
id: ehmtx_light
type: GRB
variant: WS2812
pin: $mypin
num_leds: 256
color_correct: [30%, 30%, 30%]
name: "$devicename Light"
restore_mode: ALWAYS_OFF
on_turn_on:
lambda: |-
id(ehmtx_display)->set_enabled(false);
on_turn_off:
lambda: |-
id(ehmtx_display)->set_enabled(true);
number:
- platform: template
name: "LED brightness"
min_value: 0
max_value: 255
step: 1
lambda: |-
return id(rgb8x32)->get_brightness();
set_action:
lambda: |-
id(rgb8x32)->set_brightness(x);
time:
- platform: homeassistant
id: ehmtx_time
display:
- platform: addressable_light
id: ehmtx_display
addressable_light_id: ehmtx_light
width: 32
height: 8
pixel_mapper: |-
if (x % 2 == 0) {
return (x * 8) + y;
}
return (x * 8) + (7 - y);
rotation: 0°
update_interval: 16ms
auto_clear_enabled: true
lambda: |-
id(rgb8x32)->tick();
id(rgb8x32)->draw();
web_server:
port: 80
ehmtx:
id: rgb8x32
show_clock: 4
show_screen: 6
display8x32: ehmtx_display
time: ehmtx_time
duration: 7
font_id: ehmtx_font
on_next_screen:
lambda: |-
ESP_LOGD("Trigger","Ole it works");
icons:
- file: icons/1350.gif
id: boot