I’m using ESPHome for the first time. I’ve got the basics figured out, my M5 Atom Matrix is on Wifi, and I’ve got a basic config sort of working but the main use case I can’t figure out. I’ve got two pages to my display, page1 is green and page2 is red. All I want to do is be able to select the page to cycle between green and red. I get a drop down in HA for page1 and page2 but changing them does nothing but it does show in the ESPHome log. I’m pretty sure it’s something to do with my display or select logic but I’ve tried everything. At the end of it I just want a way to display a red matrix or a green matrix and will use it to show my alarm status.
esphome:
name: alarmstatus
friendly_name: AlarmStatus
esp32:
board: m5stack-atom
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: ""
services:
- service: m5_matrix_change_page
variables:
page: int
then:
- display.page.show: !lambda |-
if (page == 1) {
return id(page1);
} else {
if (page == 2) {
return id(page2);
} else {
return id(page1);
} }
ota:
password: ""
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Alarmstatus Fallback Hotspot"
password: ""
captive_portal:
sensor:
- platform: wifi_signal
id: wifi_value
name: "WiFi Signal Sensor"
switch:
- platform: gpio
id: "myled"
pin: 27
light:
- platform: fastled_clockless
chipset: WS2812B
pin: 27
num_leds: 25
rgb_order: GRB
id: status_led
color_correct: [50%, 50%, 50%]
name: 'M5 Light'
effects:
- random:
- flicker:
- addressable_rainbow:
- pulse
- strobe:
name: Strobe Effect With Custom Values
colors:
- state: true
brightness: 50%
red: 100%
green: 90%
blue: 0%
duration: 500ms
- state: false
duration: 250ms
- state: true
brightness: 50%
red: 0%
green: 100%
blue: 0%
duration: 500ms
binary_sensor:
- platform: gpio
pin:
number: 39
inverted: true
name: 'M5 Button'
on_press:
then:
# - light.toggle: status_led
- display.page.show_next: led_matrix_display
display:
- platform: addressable_light
id: led_matrix_display
addressable_light_id: status_led
width: 5
height: 5
rotation: 180°
update_interval: 16ms
pages:
- id: page1
lambda: |-
Color green = Color(0x00FF00);
it.fill(green);
- id: page2
lambda: |-
Color red = Color(0xFF0000);
it.fill(red);
select:
- platform: template
name: "Template select"
optimistic: true
options:
- one
- two
initial_option: one