Max7219digit Resetting Time After 15 Minutes

Hello! I am trying to make a simple clock and calendar with max7219digit. I got it working but the clock resets to 1:00:00 after 15 minutes and just counts up to 15 minutes and resets again. I can ‘force’ it to right time by accessing the logs in the ESP Home on HA web interface.

How can I make it so it doesn’t do this? I don’t see anything in the documentation about this.

Config looks like:

esphome:

  name: esphome-web-5ac3d8

esp8266:

  board: d1_mini_lite

# Enable logging

logger:

# Enable Home Assistant API

api:

ota:

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails

  ap:

    ssid: "esphome-web-5ac3d8"

    password: "I5lwyk8Zffm0"

captive_portal:

packages: !include_dir_named common

spi:

  clk_pin: D5 # D5 is connected to CLK of MAX7219

  mosi_pin: D7 # D7 is connected to MOSI of MAX7219

display:

  - platform: max7219digit

    intensity: 12

    cs_pin: D8

    num_chips: 8

    lambda: |-

      it.strftime(0, 0, id(digit_font), "%H:%M:%S", id(hass_time).now());

font:

  - file: "pixelmix.ttf"

    id: digit_font

    size: 8

time:

  - platform: homeassistant

    id: hass_time

    timezone: CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00

A 15min reboot is a typical symptom of api and/or wifi connectivity issues.

Change the reboot timeout to something else to confirm this is the cause.

Native API Component — ESPHome.

1 Like

Yes and starting at 1:00:00 is equivalent to UTC 0:00:00, you are not connecting to HA correctly. If my devices have no connection to a time server my clock sets to 11:00:00 (AEST).

Try changing to use a time server rather than sourcing the time from HA and see if that makes a difference.

time:
  - platform: sntp
    id: hass_time
    timezone: CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00

But what @Mahko_Mahko said still applies - the reason it resets after 15 mins is the connection timeout.

Makes sense, I will try it later today.

Also makes sense, but it connects to HA fine for the first 15 minutes. According to logs and also it shows the right time. But then after 15 minutes, it just resets to 1:00:00…

So my hypothesis is it is loosing connectivity to wifi after 15 minutes.

Edit: I’ll also try using sntp later today and report back :slight_smile:

I tried adding reboot_timeout: 5min under wifi and it still reset after 15 minutes… a bit strange.

I had success by using platform: sntp rather than platform: homeassistant

It’s been running okay for about 2 hours. It seems to sync the time with sntp every 15 minutes.

That sounds like a network disconnect then.
Your sync is keeping the network alive, so it will not reach timeout.

1 Like

Did you try the same for api with other things the same?

Have you added the device to HA via the integrations page?

Did you try the same for api with other things the same?

I added here:

wifi:

  ssid: !secret wifi_ssid

  password: !secret wifi_password

  reboot_timeout: 5min

Is it better to put it somewhere else?

Have you added the device to HA via the integrations page?

Yes, it is added there.

The same name setting with a different function goes under api:

See first link here: