Here’s mine. I’m stuck on the display.
I’m not using any external_components. I’ve been trying to compare the code with others that have gotten it to work like this project and the sample code and with how esphome implements it here.
The init sequences used are different but I haven’t gotten either to work. I have no idea at the moment… if only there was a way to get more debugging output from the st7701s esphome component…
substitutions:
friendly_name: 'nESP'
hostname: 'neo-nesp'
device_name: 'neo_nesp'
device_description: 'WT32S3-21S ZX2D10GE01R-V4848 rotary switch screen'
# Home Assistant climate entity you want to control with nESP
climate_entity: climate.climate_control
min_value: "16"
max_value: "30"
initial_value: "20"
ap_ssid: ${device_name}
ap_password: ${device_name}
esphome:
name: ${hostname}
name_add_mac_suffix: true
friendly_name: ${friendly_name}
comment: ${device_description}
platformio_options:
board_build.flash_mode: dio
board_build.arduino.memory_type: qio_opi
esp32:
board: esp32-s3-devkitc-1
framework:
type: esp-idf
version: recommended
psram:
mode: octal
speed: 80MHz
debug:
update_interval: 30s
<<: !include _common.yaml
packages:
colors: !include nesp/colors/HOMEASSISTANT
qr_code:
- id: qr_hotspot
value: "WIFI:S:${ap_ssid};T:WPA;P:${ap_password};;"
- id: qr_esphome
value: https://my.home-assistant.io/redirect/config_flow_start/?domain=esphome
script:
- id: vibrate
then:
- switch.turn_on: ${device_name}_motor
- id: display_off
then:
- light.turn_off: ${device_name}_backlight
- id: display_on
then:
- light.turn_on: ${device_name}_backlight
- component.update: ${device_name}_display
output:
### BACKLIGHT
- platform: ledc
id: ${device_name}_led
pin: 38
zero_means_zero: true
light:
- platform: monochromatic
id: ${device_name}_backlight
output: ${device_name}_led
name: Backlight
icon: mdi:brightness-percent
internal: true
default_transition_length: 500ms
restore_mode: ALWAYS_ON
### OUTER RGB LIGHT
- platform: esp32_rmt_led_strip
name: RGB LED
id: ${device_name}_rgb
pin: 4
num_leds: 13
rmt_channel: 0
rgb_order: GRB
chipset: WS2812
switch:
### VIBRATION MOTOR
- platform: gpio
id: ${device_name}_motor
name: Vibration Motor
icon: mdi:vibrate
entity_category: diagnostic
internal: true
pin: 7
on_turn_on:
then:
- delay: 100ms
- switch.turn_off: ${device_name}_motor
button:
- platform: restart
name: Restart
disabled_by_default: True
binary_sensor:
- platform: status
name: ${hostname} Status
### PUSH BUTTON
- platform: gpio
name: Button
id: ${device_name}_button
icon: mdi:circle-outline
internal: true
pin:
number: 3
mode: INPUT
inverted: true
ignore_strapping_warning: true
sensor:
- platform: uptime
name: Uptime
disabled_by_default: True
### ROTARY ENCODER (hall sensor)
- platform: rotary_encoder
name: Rotary Encoder
id: ${device_name}_rotary
icon: mdi:cached
entity_category: diagnostic
internal: true
pin_a:
number: 5
inverted: true
mode: INPUT
pin_b:
number: 6
inverted: true
mode: INPUT
min_value: 0
max_value: 100
publish_initial_value: true
#on_clockwise:
# then:
# - script.execute: vibrate
#on_anticlockwise:
# - script.execute: vibrate
- platform: homeassistant
entity_id: $climate_entity
id: current_temperature
entity_category: diagnostic
internal: true
attribute: current_temperature
on_value:
- script.execute: display_on
- platform: homeassistant
entity_id: $climate_entity
id: min_temp
internal: true
attribute: min_temp
- platform: homeassistant
entity_id: $climate_entity
id: max_temp
internal: true
attribute: max_temp
- platform: homeassistant
entity_id: $climate_entity
id: target_temperature
entity_category: diagnostic
attribute: temperature
internal: true
- platform: homeassistant
entity_id: $climate_entity
id: target_temp_high
entity_category: diagnostic
attribute: target_temp_high
internal: true
- platform: homeassistant
entity_id: $climate_entity
id: target_temp_low
entity_category: diagnostic
attribute: target_temp_low
internal: true
text_sensor:
- platform: debug
reset_reason:
name: Reset Reason
disabled_by_default: True
- platform: homeassistant
entity_id: $climate_entity
id: hvac_mode
entity_category: diagnostic
internal: true
- platform: homeassistant
entity_id: $climate_entity
id: hvac_action
entity_category: diagnostic
internal: true
attribute: hvac_action
- platform: homeassistant
entity_id: $climate_entity
id: preset_mode
entity_category: diagnostic
internal: true
attribute: preset_mode
spi:
### DISPLAY
clk_pin:
number: 47
allow_other_uses: true
mosi_pin:
number: 41
allow_other_uses: true
display:
- platform: st7701s
id: ${device_name}_display
# XXX DEBUG
show_test_card: true
lambda: |-
it.fill(COLOR_ON);
spi_mode: MODE0
data_rate: 10MHz
color_order: bgr
#auto_clear_enabled: false
#invert_colors: true
dimensions:
width: 480
height: 480
rotation: 0°
cs_pin: 21
de_pin: 39
vsync_pin: 48
hsync_pin: 40
pclk_pin:
number: 45
ignore_strapping_warning: true
data_pins:
- number: 47 # LCD_D0 = b0
allow_other_uses: true
- number: 41 # LCD_D1 = b1
allow_other_uses: true
- 0 # LCD_D2 = b2
- 42 # LCD_D3 = b3
- 14 # LCD_D4 = b4
- 8 # LCD_D5 = g0
- 13 # LCD_D6 = g1
- 18 # LCD_D7 = g2
- 12 # LCD_D8 = g3
- 11 # LCD_D9 = g4
- 17 # LCD_D10 = g5
- 10 # LCD_D11 = r0
- 16 # LCD_D12 = r1
- 9 # LCD_D13 = r2
- 15 # LCD_D14 = r3
- 46 # LCD_D15 = r4
init_sequence:
# https://github.com/moononournation/Arduino_GFX/blob/b18af50021852e75c14a4bc4e2ebddbf855de23d/src/display/Arduino_RGB_Display.h
# st7701_type7_init_operations[]
- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10]
- [0xC0, 0x3b, 0x00]
- [0xC1, 0x0b, 0x02]
- [0xC2, 0x07, 0x02]
- [0xCC, 0x10]
- [0xCD, 0x08]
- [0xB0, 0x00, 0x11, 0x16, 0x0e, 0x11, 0x06, 0x05, 0x09, 0x08, 0x21, 0x06, 0x13, 0x10, 0x29, 0x31, 0x18]
- [0xB1, 0x00, 0x11, 0x16, 0x0e, 0x11, 0x07, 0x05, 0x09, 0x09, 0x21, 0x05, 0x13, 0x11, 0x2a, 0x31, 0x18]
- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x11]
- [0xb0, 0x6d]
- [0xb1, 0x37]
- [0xb2, 0x81]
- [0xb3, 0x80]
- [0xb5, 0x43]
- [0xb7, 0x85]
- [0xb8, 0x20]
- [0xc1, 0x78]
- [0xc2, 0x78]
- [0xd0, 0x88]
- [0xe0, 0x00, 0x00, 0x02]
- [0xe1, 0x03, 0xa0, 0x00, 0x00, 0x04, 0xa0, 0x00, 0x00, 0x00, 0x20, 0x20]
- [0xe2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
- [0xe3, 0x00, 0x00, 0x11, 0x00]
- [0xe4, 0x22, 0x00]
- [0xe5, 0x05, 0xec, 0xa0, 0xa0, 0x07, 0xee, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
- [0xe6, 0x00, 0x00, 0x11, 0x00]
- [0xe7, 0x22, 0x00]
- [0xe8, 0x06, 0xed, 0xa0, 0xa0, 0x08, 0xef, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
- [0xeb, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00]
- [0xed, 0xff, 0xff, 0xff, 0xba, 0x0a, 0xbf, 0x45, 0xff, 0xff, 0x54, 0xfb, 0xa0, 0xab, 0xff, 0xff, 0xff]
- [0xef, 0x10, 0x0d, 0x04, 0x08, 0x3f, 0x1f]
- [0xff, 0x77, 0x01, 0x00, 0x00, 0x13]
- [0xef, 0x08]
- [0xff, 0x77, 0x01, 0x00, 0x00, 0x00]
- [0x36, 0x00]
- [0x3a, 0x66]
- [0x11, 0x00]
# https://github.com/wireless-tag-com/ZX2D10GE01R-V4848/blob/ad21b3659527618fdd752cc0801b0a36f6c5e52c/main/screen.c
#- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x13]
#- [0xEF, 0x08]
#- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x10]
#- [0xC0, 0x3B, 0x00] # Scan line
#- [0xC1, 0x0B, 0x02] # VBP
#- [0xC2, 0x07, 0x02]
#- [0xCC, 0x10]
#- [0xCD, 0x08] # RGB format // ?565??? 666??
#- [0xB0, 0x00, 0x11, 0x16, 0x0e, 0x11, 0x06, 0x05, 0x09, 0x08, 0x21, 0x06, 0x13, 0x10, 0x29, 0x31, 0x18] # IPS // 255 // 251 // 247 down // 239 // 231 // 203 // 175 // 147 // 108 // 80 // 52 // 24 // 16 // 8 down // 4 // 0
#- [0xB1, 0x00, 0x11, 0x16, 0x0e, 0x11, 0x07, 0x05, 0x09, 0x09, 0x21, 0x05, 0x13, 0x11, 0x2a, 0x31, 0x18] # IPS // 255 // 251 // 247 down // 239 // 231 // 203 // 175 // 147 // 108 // 80 // 52 // 24 // 16 // 8 down // 4 // 0
#- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x11]
#- [0xB0, 0x6d] # VOP 3.5375+ *x 0.0125 // 5D
#- [0xB1, 0x37] # VCOM amplitude setting
#- [0xB2, 0x81] # VGH Voltage setting // 12V
#- [0xB3, 0x80]
#- [0xB5, 0x43] # VGL Voltage setting // -8.3V
#- [0xB7, 0x85]
#- [0xB8, 0x20]
#- [0xC1, 0x78]
#- [0xC2, 0x78]
#- [0xD0, 0x88]
#- [0xE0, 0x00, 0x00, 0x02]
#- [0xE1, 0x03, 0xA0, 0x00, 0x00, 0x04, 0xA0, 0x00, 0x00, 0x00, 0x20, 0x20]
#- [0xE2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
#- [0xE3, 0x00, 0x00, 0x11, 0x00]
#- [0xE4, 0x22, 0x00]
#- [0xE5, 0x05, 0xEC, 0xA0, 0xA0, 0x07, 0xEE, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
#- [0xE6, 0x00, 0x00, 0x11, 0x00]
#- [0xE7, 0x22, 0x00]
#- [0xE8, 0x06, 0xED, 0xA0, 0xA0, 0x08, 0xEF, 0xA0, 0xA0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
#- [0xEB, 0x00, 0x00, 0x40, 0x40, 0x00, 0x00, 0x00]
#- [0xED, 0xFF, 0xFF, 0xFF, 0xBA, 0x0A, 0xBF, 0x45, 0xFF, 0xFF, 0x54, 0xFB, 0xA0, 0xAB, 0xFF, 0xFF, 0xFF]
#- [0xEF, 0x10, 0x0D, 0x04, 0x08, 0x3F, 0x1F]
#- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x13]
#- [0xEF, 0x08]
#- [0xFF, 0x77, 0x01, 0x00, 0x00, 0x00]
#- [0x36, 0x00]
#- [0x3A, 0x66] # 55/50=16bit(RGB565);66=18bit(RGB666);77?????3AH?=24bit(RGB888)
hsync_pulse_width: 10
hsync_back_porch: 10
hsync_front_porch: 10
vsync_pulse_width: 2
vsync_back_porch: 12
vsync_front_porch: 14
pclk_frequency: 15MHz
pclk_inverted: false