-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix.yaml
114 lines (98 loc) · 2.5 KB
/
matrix.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
substitutions:
xscrollpadding: "4" # in pix
esphome:
name: matrix
platform: esp8266
board: nodemcu
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "esp12-rgb Fallback Hotspot"
password: !secret fallback_password
captive_portal:
# Enable web server
web_server:
port: 80
auth:
username: !secret web_server_user
password: !secret web_server_password
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: !secret hass_key
ota:
password: !secret hass_password
mqtt:
id: mqtt_client
broker: !secret mqtt_broker
username: !secret mqtt_user
password: !secret mqtt_password
text_sensor:
- platform: mqtt_subscribe
name: "Text"
id: matrixtext
topic: matrix/text
- platform: mqtt_subscribe
name: "Color"
id: matrixcolor
topic: matrix/color
font:
- id: tinyfont
file: "DejaVuSans-Bold.ttf"
size: 9
glyphs: '♡Ωäöüß!"%()+,-_.:*=°?~#0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'
# GPIO4 (D02)
light:
- platform: fastled_clockless
chipset: WS2812B
pin: GPIO4
num_leds: 64
rgb_order: GRB
name: "led_matrix"
id: led_matrix
default_transition_length: 0s
color_correct: [50%, 50%, 50%]
restore_mode: ALWAYS_ON
effects:
- addressable_random_twinkle:
- addressable_random_twinkle:
name: Random Twinkle Effect With Custom Values
twinkle_probability: 5%
progress_interval: 32ms
sensor:
- platform: homeassistant
id: hred
entity_id: light.led_matrix
attribute: red
- platform: homeassistant
id: hgreen
entity_id: light.led_matrix
attribute: green
- platform: homeassistant
id: hblue
entity_id: light.led_matrix
attribute: blue
display:
- platform: addressable_light
id: led_matrix_display
addressable_light_id: led_matrix
width: 8
height: 8
rotation: 270°
update_interval: 200ms
lambda: |-
static uint16_t xpos = 0;
const char * text = id(matrixtext).state.c_str();
const char * color = id(matrixcolor).state.c_str();
int x_start, y_start;
int width, height;
it.get_text_bounds(0, 0, text, id(tinyfont),
TextAlign::TOP_LEFT, &x_start, &y_start, &width, &height);
it.print(-(xpos % (width + $xscrollpadding)), -2,
id(tinyfont), Color(uint32_t(color)),
TextAlign::TOP_LEFT, text);
xpos++;