esphome:
name: esphome-web-c76b40
friendly_name: Matrix Portal
substitutions:
xscrollpadding: "5" # in pix
scroll_speed: .09s
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
external_components:
- source: github://TillFleisch/ESPHome-HUB75-MatrixDisplayWrapper@main
interval:
- interval: 0.1s
then:
lambda: |-
id(partlycloudy).next_frame();
id(cloudy).next_frame();
id(fog).next_frame();
id(windy).next_frame();
- interval: 0.1s
then:
animation.next_frame: cloudy
font:
- file: /config/esphome/fonts/MatrixChunky8X.ttf
id: mono
size: 8
glyphs: |
! "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz°
- file: "gfonts://Roboto"
id: roboto
size: 12
- file: "gfonts://Micro 5"
id: micro
size: 20
color:
- id: teal
hex: 00CED1
- id: blue
hex: 7B68EE
- id: brown
hex: D2691E
- id: orange
hex: FFA500
- id: green
hex: 008000
- id: pink
hex: FF69B4
- id: purple
hex: 9400D3
- id: red
hex: FF0000
- id: yellow
hex: FFFF00
display:
- platform: hub75_matrix_display
id: matrix
width: 64
height: 32
R1_pin: 42
G1_pin: 41
B1_pin: 40
R2_pin: 38
G2_pin: 39
B2_pin: 37
A_pin: 45
B_pin: 36
C_pin: 48
D_pin: 35
E_pin: 21
LAT_pin: 47
OE_pin: 14
CLK_pin: 2
brightness: 64
update_interval: 32ms
lambda: |-
if (id(weather).state == "sunny") {
id(sunny).next_frame();
it.image(2, 10, id(sunny), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "lightning-rainy") {
id(rainylight).next_frame();
it.image(2, 10, id(rainylight), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "rainy") {
id(rainy).next_frame();
it.image(2, 10, id(rainy), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "partlycloudy") {
id(partlycloudy).next_frame();
it.image(2, 10, id(partlycloudy), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "cloudy") {
id(cloudy).next_frame();
it.image(2, 10, id(cloudy), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "clear-night") {
id(clearnight).next_frame();
it.image(2, 10, id(clearnight), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "fog") {
id(fog).next_frame();
it.image(2, 10, id(fog), COLOR_ON, COLOR_OFF);
}
if (id(weather).state == "windy") {
id(windy).next_frame();
it.image(2, 10, id(windy), COLOR_ON, COLOR_OFF);
}
it.strftime(10, 0, id(mono), id(purple),"%b %d", id(homeassistant_time).now());
it.strftime(37, 0, id(mono), id(orange), "%I:%M", id(homeassistant_time).now());
if (id(outsidetemp).has_state()) {
it.printf(14, 10, id(mono), id(pink), "%.1f°", id(outsidetemp).state);
}
if (id(motion).state) {
id(pacman).next_frame();
it.image(0, -15, id(pacman), COLOR_ON, COLOR_OFF);
} else {
static int16_t xpos = it.get_width();
const char * text = id(quote).state.c_str();
int x_start, y_start;
int width, height;
it.get_text_bounds(0, 22, text, id(mono), TextAlign::TOP_LEFT, &x_start, &y_start, &width, &height);
if(xpos < -1 * (width + $xscrollpadding)) {xpos = it.get_width();}
if(width <= it.get_width()) {xpos = 0;}
it.print(xpos, 22, id(mono), id(red), TextAlign::TOP_LEFT, text);
xpos--;
}
switch:
- platform: hub75_matrix_display
matrix_id: matrix
name: "Power"
id: power
number:
- platform: hub75_matrix_display
matrix_id: matrix
name: "Brightness"
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "xxxxxxxxxxxxxxxxxxxxxxx"
ota:
safe_mode: true
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Esphome-Web-C76B40"
password: "n5SZyllaF9nO"
captive_portal:
animation:
- file: /config/www/gif/pac-man.gif
id: pacman
resize: 64x64
type: RGB565
- file: /config/esphome/weather/sunny.gif
id: sunny
resize: 10x10
type: RGB565
- file: /config/esphome/weather/cloudy.gif
id: cloudy
resize: 10x10
type: RGB565
- file: /config/esphome/weather/partlycloudy.gif
id: partlycloudy
resize: 10x10
type: RGB565
- file: /config/esphome/weather/clearnight.gif
id: clearnight
resize: 10x10
type: RGB565
- file: /config/esphome/weather/fog.gif
id: fog
resize: 10x10
type: RGB565
- file: /config/esphome/weather/windy.gif
id: windy
resize: 10x10
type: RGB565
- file: /config/esphome/weather/rainylightening.gif
id: rainylight
resize: 10x10
type: RGB565
- file: /config/esphome/weather/rainy.gif
id: rainy
resize: 10x10
type: RGB565
image:
- file: mdi:television-classic
id: game
resize: 20x20
binary_sensor:
- platform: homeassistant
id: motion
entity_id: binary_sensor.driveway_motion_motion
name: "Drive-way motion"
time:
- platform: homeassistant
id: homeassistant_time
timezone: America/Chicago
text_sensor:
- platform: homeassistant
name: "Weather Forecast From Home Assistant"
entity_id: weather.forecast_central_hub
id: weather
internal: true
- platform: homeassistant
name: "Matrix Text"
entity_id: input_text.led_matrix_text
id: led_matrix_text
internal: true
- platform: homeassistant
id: quote
entity_id: sensor.daily_quote
attribute: q
internal: true
- platform: homeassistant
id: author
entity_id: sensor.daily_quote
attribute: a
internal: true
sensor:
- platform: homeassistant
id: outsidetemp
entity_id: sensor.outside_temp_temperature
internal: true