# LED Matrix substitutions: devicename: esp32-03 xscrollpadding: "4" # in pix esphome: name: $devicename platform: ESP32 board: esp32dev # Enable logging logger: # Enable Home Assistant API api: web_server: port: 80 ota: password: !secret ota_password wifi: ssid: "W00t" password: !secret wifi_password # Enable fallback hotspot (captive portal) in case wifi connection fails ap: ssid: "${devicename} Fallback Hotspot" password: !secret ap_password captive_portal: ########## Setup ####################### script: - id: start mode: restart then: - switch.turn_on: led_matrix_flash - delay: 60s - script.execute: stop - id: stop then: - script.stop: start - switch.turn_off: led_matrix_flash - homeassistant.service: service: input_text.set_value data: value: "" entity_id: input_text.led_matrix_text text_sensor: - platform: homeassistant name: "Matrix Text" entity_id: input_text.led_matrix_text id: led_matrix_text internal: true on_value: - if: condition: text_sensor.state: id: led_matrix_text state: "" else: - script.execute: start font: - id: tinyfont file: "ttf/lexis.ttf" size: 8 glyphs: '''äöüß!"%()+,-_.:*=°?~#0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz' light: - platform: fastled_clockless chipset: WS2812B pin: GPIO4 num_leds: 256 rgb_order: GRB name: "led_matrix" id: led_matrix_light default_transition_length: 0s color_correct: [50%, 50%, 50%] internal: true restore_mode: ALWAYS_ON display: - platform: addressable_light id: led_matrix_display addressable_light_id: led_matrix_light width: 32 height: 8 pixel_mapper: |- if (x % 2 == 0) { return (x * 8) + y; } return (x * 8) + (7 - y); rotation: 0° update_interval: 200ms lambda: |- static int16_t xpos = it.get_width(); const char * text = id(led_matrix_text).state.c_str(); auto color = Color(0, 0, 255); 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 ); if(xpos < -1 * (width + $xscrollpadding)) { xpos = it.get_width(); } if(width <= it.get_width()) { xpos = 0; } it.print( xpos, 0, id(tinyfont), color, TextAlign::TOP_LEFT, text ); xpos--; switch: - platform: gpio pin: GPIO23 name: "LED Matrix Flash" id: led_matrix_flash internal: true restore_mode: ALWAYS_OFF binary_sensor: - platform: gpio pin: number: GPIO13 inverted: true mode: input: true pullup: true name: "LED Matrix Confirm" id: led_matrix_confirm internal: true on_press: then: - script.execute: stop