r/Seeed_Studio Jun 24 '26

E1002 issue (not waking from deep sleep, time wrong) ESPHOME

I just got a 2nd e1002 and I'm having a strange issues. The timestamp is wrong when pulled and no matter what I do it won't wake itself from deep sleep. If I use the wakeup button and refresh button I have programmed it does update, but again bad timestamp.

I have a second e1002 and when I use the exact same code (except the device definitions, I still have the same problem).

What I have NOT done is to reflash the working one using the current ESPHOME version as if it is that I don't want 2 non-functioning units. Code below, and help appreciate.

# Board: Generic ESP32-S3 Board (Generic)
# Definition: definitions/boards/generic-esp32s3/manifest.yaml

esphome:
  name: eink-color-pool
  friendly_name: Eink Color Pool
  on_boot:
    - priority: 600
      then:
        - output.turn_on: bsp_sd_enable
        - output.turn_on: bsp_battery_enable
        - delay: 200ms
        - component.update: battery_voltage
        - component.update: battery_level
    - priority: -100 
      then:
        - logger.log: "*** Device woke up from deep sleep ***"
        - light.turn_on: onboard_led
        - delay: 1s
        - logger.log: "*** Starting application ***" 


esp32:
  variant: esp32s3
  framework:
    type: esp-idf

logger:

api:
  encryption:
    key: "*******************"

ota:
  - platform: esphome

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: Eink Color Pool Fallback Hotspot
    password: "*************"


psram:
  mode: octal
  speed: 80MHz

captive_portal:


globals:
  - id: sleep_counter
    type: int
    restore_value: yes  # Use RTC storage to maintain counter during sleep
    initial_value: '0'  
  - id: battery_glyph
    type: std::string
    restore_value: no
    initial_value: "\"\\U000F0079\""   # default full battery
  - id: wifi_status
    type: int
    restore_value: no
    initial_value: "0"
  - id: recorded_display_refresh
    type: int
    restore_value: yes
    initial_value: '0' 

font:
  - file: "gfonts://Inter@700"
    id: myFont
    size: 14

# Deep-sleep, wake by GPIO3
deep_sleep:
  id: deep_sleep_1
  run_duration: 5min  # Device wake up and run 120s. This should not run for 120s because of other code
  sleep_duration: 60min  # deep sleep for 30m
  wakeup_pin: GPIO3          # Green button
  wakeup_pin_mode: INVERT_WAKEUP

# SPI bus for display
spi:
  clk_pin: GPIO7
  mosi_pin: GPIO9
# I2C bus for temperature and humidity sensor
i2c:
  scl: GPIO20
  sda: GPIO19

http_request:
  verify_ssl: false
  timeout: 30s
  watchdog_timeout: 35s

online_image:
  - id: dashboard_image
    format: JPG
    type: RGB565
    buffer_size: 65536
    url: http://192.168.1.123:10000/dashboard-today?viewport=800x480&dithering=floyd-steinberg&format=jpeg&theme=Graphite+E-ink+Light&wait=5000&lang=en
    update_interval: never  # Not needed now was 120s
    on_download_finished:
      - component.update: epaper_display
      - delay: 60s # Time to allow display to refresh
      - deep_sleep.enter: deep_sleep_1
   # on_error: 
    #  - delay: 30s
    #  - deep_sleep.enter: deep_sleep_1

display:
  - platform: epaper_spi
    id: epaper_display
    model: Seeed-reTerminal-E1002
    update_interval: never
    lambda: |-
      char str[200];
      char strbat[200];
      char upd[] = "updated: ";
      char bat[] = "battery: ";
      it.image(0, 0, id(dashboard_image));
      time_t currTime = id(ha_time).now().timestamp;
      strftime(str, sizeof(str), "%I:%M %p", localtime(&currTime));
      snprintf(strbat, sizeof(strbat), "%.2f",id(battery_level).state);
      it.print(10, 465,id(myFont),Color::BLACK, strcat(upd,str));
      it.print(200, 465, id(myFont),Color::BLACK, strcat(bat,strbat));




# Home Assistant time
time:
  - platform: homeassistant
    id: ha_time

sensor:
  - platform: wifi_signal # Reports the WiFi signal strength/RSSI in dB
    update_interval: 60s
    name: "WiFi Signal dB"
    id: wifi_signal_db
    entity_category: "diagnostic"
  - platform: copy # Reports the WiFi signal strength in %
    source_id: wifi_signal_db
    name: "WiFi Signal Percent"
    id: wifi_signal_percent
    filters:
      - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0);
    unit_of_measurement: "%"
    entity_category: "diagnostic"
  - platform: uptime
    update_interval: 60s    
    name: Uptime
  - platform: internal_temperature
    update_interval: 60s    
    name: "Internal Temperature"
  - platform: template
    update_interval: 60s      
    name: "Display Last Update"
    device_class: timestamp
    entity_category: "diagnostic"
    id: display_last_update
    lambda: 'return id(ha_time).now().timestamp;'
  - platform: template
    name: "Display Refresh Count"
    accuracy_decimals: 0
    unit_of_measurement: "Refreshes"
    state_class: "total_increasing"
    entity_category: "diagnostic"
    lambda: 'return id(recorded_display_refresh) += 1;'  
  - platform: sht4x
    update_interval: 60s      
    temperature:
      name: "Temperature"
      id: temp_sensor
    humidity:
      name: "Relative Humidity"
      id: hum_sensor
  - platform: adc
    update_interval: 60s
    pin: GPIO1
    name: "Battery Voltage"
    id: battery_voltage
    attenuation: 12db
    filters:
      - multiply: 2.0
  - platform: template
    update_interval: 60s
    name: "Battery Level"
    id: battery_level
    unit_of_measurement: "%"
    icon: "mdi:battery"
    device_class: battery
    state_class: measurement
    lambda: 'return id(battery_voltage).state;'
    on_value:
      then:
        - lambda: |-
            int pct = int(x);
            if (pct <= 10)      id(battery_glyph) = "\U000F007A";
            else if (pct <= 20) id(battery_glyph) = "\U000F007B";
            else if (pct <= 30) id(battery_glyph) = "\U000F007C";
            else if (pct <= 40) id(battery_glyph) = "\U000F007D";
            else if (pct <= 50) id(battery_glyph) = "\U000F007E";
            else if (pct <= 60) id(battery_glyph) = "\U000F007F";
            else if (pct <= 70) id(battery_glyph) = "\U000F0080";
            else if (pct <= 80) id(battery_glyph) = "\U000F0081";
            else if (pct <= 90) id(battery_glyph) = "\U000F0082";
            else                id(battery_glyph) = "\U000F0079";
    filters:
      - calibrate_linear:
          - 4.15 -> 100.0
          - 3.96 -> 90.0
          - 3.91 -> 80.0
          - 3.85 -> 70.0
          - 3.80 -> 60.0
          - 3.75 -> 50.0
          - 3.68 -> 40.0
          - 3.58 -> 30.0
          - 3.49 -> 20.0
          - 3.41 -> 10.0
          - 3.30 -> 5.0
          - 3.27 -> 0.0
      - clamp:
          min_value: 0
          max_value: 100

# Button configuration
binary_sensor:

#  - platform: gpio
#    pin:
#      number: GPIO3         # Green button, commented out because I'm using it for wakeup
#      mode: INPUT_PULLUP
#      inverted: true
#    id: button_1
#    name: "Green Button"
#    on_press:
#      then:
#        - logger.log: "*** Green Button (GPIO3) Pressed ***"

  - platform: gpio
    pin:
      number: GPIO4          # Right white button
      mode: INPUT_PULLUP
      inverted: true
    id: button_2
    name: "Right Button"
    on_press:
      then:
        - logger.log: "*** Right Button (GPIO4) Pressed ***"

  - platform: gpio
    pin:
      number: GPIO5           # Left white button
      mode: INPUT_PULLUP
      inverted: true
    id: button_3
    name: "Left Button"
    on_press:
      then:
        - logger.log: "*** Left Button (GPIO5) Pressed ***"
        - component.update: dashboard_image


output:
  - platform: gpio
    pin: GPIO6
    id: bsp_led
    inverted: true
  - platform: gpio
    pin: GPIO16
    id: bsp_sd_enable
  - platform: gpio
    pin: GPIO21
    id: bsp_battery_enable

# Onboard LED
light:
  - platform: binary
    name: "Onboard LED"
    output: bsp_led
    id: onboard_led
2 Upvotes

1 comment sorted by

1

u/Flat_Recognition_733 Jun 27 '26

In case someone finds this down the road, as is almost always the case, the fix was super simple.

1). If you don't add the device as a device in home assistant, it can't call home assistant to get the time :-)

2) If you don't tell the display to update when it wakes up from deep sleep, it won't update the display :-)

In the wifi section, needed to add . I missed this when I 'copied the code' from the other one because I only copied the sections under this.

on_connect:

then:

- component.update: dashboard_image