Advice on sending HA sensor data to multiple 7-segment displays

Hi all :slightly_smiling_face:

Very new to ESPHome so please be gentle :grin:

I’m creating a 3D-printed model of my house and will be inserting seven 4-digit 7-segment displays into different parts of the model to give readouts of things like the Tesla Powerwall battery percentage, the cumulative power generation from the two banks of solar panels, etc.

I’ve relied heavily on ChatGPT to write YAML code for my Home Assistant system so far, and whilst I’ve been amazed how much I’ve been able to create with ChatGPT’s help, it seems to have struggled a lot with ESPHome.

I’m using one of these ESP32-S3-DevKit boards, and I’ve managed to produce the following code. This allows me to send text and brightness commands from Home Assistant via ‘Developer tools’ → ‘Actions’ → ‘.esphome.model_house_show_text’ to one 7-segment display:

esphome:
  name: model-house
  friendly_name: Model House

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: esp-idf

logger:

api:

ota:
  platform: esphome
  password: XXX

wifi:
  ssid: XXX
  password: XXX

  manual_ip:
    static_ip: 192.168.1.88
    gateway: 192.168.1.1
    subnet: 255.255.255.0
    dns1: 192.168.1.1

  ap:
    ssid: "Model-House Fallback Hotspot"
    password: XXX

# =========================
# Home Assistant inputs
# =========================

text:
  - platform: template
    name: "Yellow 1 Text"
    id: yellow_1_text
    mode: text
    optimistic: true
    max_length: 4
    initial_value: "0000"

number:
  - platform: template
    name: "Yellow 1 Brightness"
    id: yellow_1_brightness
    optimistic: true
    min_value: 0
    max_value: 7
    step: 1
    initial_value: 5

# =========================
# TM1637 display
# =========================

display:
  - platform: tm1637
    id: yellow_1
    clk_pin: 5
    dio_pin: 6
    length: 4
    update_interval: 1s
    lambda: |-
      it.set_intensity((int) id(yellow_1_brightness).state);
      it.print(id(yellow_1_text).state.c_str());

The idea is to duplicate the ‘text’, ‘number’ and ‘display’ blocks of code with different IDs for each of the seven 7-segment displays: yellow_1, yellow_2, green, red, blue, white_1, white_2.

1. Firstly, I was wondering if this is the best code to use for this application?

2. Secondly, I’m having quite a few problems with the board disconnecting from my WiFi network – please see some screenshots of the logs below.

I’m using a Deco XE75 mesh WiFi network, and from previous logs I’ve seen, I think the board can see multiple instances of the same ‘Nova’ network … I’m wondering if it’s getting confused and trying to switch between multiple networks which is causing it to drop the connection?

3. Lastly, I would be grateful if you could suggest what code I can use to start sending automatically-updating data to the seven different displays, based on sensors in Home Assistant?

Many thanks for your help!

David

My first piece of advice is to stop using ChatGPT for ESPHome/Home Assistant. The LLM has slurped up a great deal of outdated information over time, so it gives you garbage a fair amount of the time. A very simple internet search for the 7-segment module you are using gives back as the first result the actual, up-to-date documentation for it from ESPHome.

Use that instead.

3 Likes

To get sensors from ha to esphome, you can use homeassistant sensor platform.

# Example configuration entry
sensor:
  - platform: homeassistant
    name: "Temperature Sensor From Home Assistant"
    id: temp_sensor
    entity_id: sensor.temperature_sensor

Before you try to build 7 display setup, make it work perfectly just with one.
And resolve your wifi problem first. To share your logs here, just post them with code tags, not screenshots.

1 Like

Thank you Kyle!

I’m afraid my knowledge of how to write YAML is so limited that even looking at that documentation page (which was the first thing I looked at well before I even ordered any parts for this project), isn’t enough for me to understand how the code works, hence using ChatGPT. For example, that page doesn’t provide an example of the code to use to set the brightness of the digits (even though I know it references ‘intensity’ as a configuration variable).

I can confirm what you said about the code it producing being generally very poor is entirely correct :joy: … but after much agro (and cursing at ChatGPT for repeatedly ‘guaranteeing’ that its next bit of code will work and it doesn’t :stuck_out_tongue_winking_eye:), it’s brought me this far and has produced a simple working setup, so I’m pleased with that. I even pointed it to that page about the 7-segment display and told it to use it when writing my code and it claimed it did …

So I was wondering, is this code I shared above is a good / the cleanest way of structuring YAML code for controlling a number of these displays?

Many thanks!

David

Thank you Karosm!

Sorry, please find a log file embedded below – I attached screenshots as I assumed it would be easier to read them if they were already coloured:

INFO ESPHome 2025.12.2
INFO Reading configuration /config/esphome/model-house.yaml...
INFO Starting log output from 192.168.1.88 using esphome API
INFO Successfully resolved model-house @ 192.168.1.88 in 0.000s
WARNING Can't connect to ESPHome API for model-house @ 192.168.1.88: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.88', port=6053))]: [Errno 111] Connect call failed ('192.168.1.88', 6053) (SocketAPIError)
INFO Trying to connect to model-house @ 192.168.1.88 in the background
INFO Successfully connected to model-house @ 192.168.1.88 in 0.048s
INFO Successful handshake with model-house @ 192.168.1.88 in 0.042s
[22:42:53.451][I][app:194]: ESPHome version 2025.12.2 compiled on Dec 26 2025, 22:31:54
[22:42:53.453][C][logger:261]: Logger:
[22:42:53.453][C][logger:261]:   Max Level: DEBUG
[22:42:53.453][C][logger:261]:   Initial Level: DEBUG
[22:42:53.457][C][logger:267]:   Log Baud Rate: 115200
[22:42:53.457][C][logger:267]:   Hardware UART: USB_SERIAL_JTAG
[22:42:53.458][C][logger:274]:   Task Log Buffer Size: 768
[22:42:53.481][C][template.text:048]: Template Text Input 'Yellow 1 Text'
[22:42:53.482][C][template.text:049]:   Optimistic: YES
[22:42:53.489][C][template.text:399]:   Update Interval: 60.0s
[22:42:53.489][C][template.number:016]: Template Number 'Yellow 1 Brightness'
[22:42:53.490][C][template.number:049]:   Optimistic: YES
[22:42:53.490][C][template.number:399]:   Update Interval: 60.0s
[22:42:53.503][C][display.tm1637:136]: TM1637:
[22:42:53.503][C][display.tm1637:136]:   Intensity: 5
[22:42:53.503][C][display.tm1637:136]:   Inverted: 0
[22:42:53.503][C][display.tm1637:136]:   Length: 4
[22:42:53.507][C][display.tm1637:142]:   CLK Pin: GPIO5
[22:42:53.507][C][display.tm1637:143]:   DIO Pin: GPIO6
[22:42:53.512][C][display.tm1637:399]:   Update Interval: 1.0s
[22:42:53.514][C][wifi:1132]: WiFi:
[22:42:53.514][C][wifi:1132]:   Connected: YES
[22:42:53.518][C][wifi:897]:   Local MAC: DC:B4:D9:1F:FF:C8
[22:42:53.519][C][wifi:904]:   IP Address: 192.168.1.88
[22:42:53.528][C][wifi:908]:   SSID: 'Nova'[redacted]
[22:42:53.528][C][wifi:908]:   BSSID: 50:3D:D1:AB:97:D5[redacted]
[22:42:53.528][C][wifi:908]:   Hostname: 'model-house'
[22:42:53.528][C][wifi:908]:   Signal strength: -48 dB ▂▄▆█
[22:42:53.528][C][wifi:908]:   Channel: 6
[22:42:53.528][C][wifi:908]:   Subnet: 255.255.255.0
[22:42:53.528][C][wifi:908]:   Gateway: 192.168.1.1
[22:42:53.528][C][wifi:908]:   DNS1: 192.168.1.1
[22:42:53.528][C][wifi:908]:   DNS2: 0.0.0.0
[22:42:53.530][C][esphome.ota:092]: Over-The-Air updates:
[22:42:53.530][C][esphome.ota:092]:   Address: 192.168.1.88:3232
[22:42:53.530][C][esphome.ota:092]:   Version: 2
[22:42:53.534][C][esphome.ota:099]:   Password configured
[22:42:53.546][C][safe_mode:018]: Safe Mode:
[22:42:53.546][C][safe_mode:018]:   Successful after: 60s
[22:42:53.546][C][safe_mode:018]:   Invoke after: 10 attempts
[22:42:53.546][C][safe_mode:018]:   Duration: 300s
[22:42:53.555][C][api:211]: Server:
[22:42:53.555][C][api:211]:   Address: 192.168.1.88:6053
[22:42:53.555][C][api:211]:   Listen backlog: 4
[22:42:53.555][C][api:211]:   Max connections: 8
[22:42:53.556][C][api:223]:   Noise encryption: NO
[22:42:53.563][C][mdns:177]: mDNS:
[22:42:53.563][C][mdns:177]:   Hostname: model-house
[22:43:37.622][W][api.connection:1978]: Home Assistant 2025.12.4 (192.168.1.31): Reading failed SOCKET_READ_FAILED errno=104
[22:43:38.823][D][api:136]: Accept 192.168.1.31
[22:43:38.840][D][api.connection:1398]: Home Assistant 2025.12.4 (192.168.1.31) connected
[22:44:39.014][W][api.connection:1978]: Home Assistant 2025.12.4 (192.168.1.31): Reading failed SOCKET_READ_FAILED errno=104
[22:44:40.417][D][api:136]: Accept 192.168.1.31
[22:44:40.422][D][api.connection:1398]: Home Assistant 2025.12.4 (192.168.1.31) connected
INFO Processing unexpected disconnect from ESPHome API for model-house @ 192.168.1.88
WARNING Disconnected from API
INFO Successfully resolved model-house @ 192.168.1.88 in 0.000s
WARNING Can't connect to ESPHome API for model-house @ 192.168.1.88: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.88', port=6053))]: [Errno 111] Connect call failed ('192.168.1.88', 6053) (SocketAPIError)
INFO Trying to connect to model-house @ 192.168.1.88 in the background
INFO Successfully connected to model-house @ 192.168.1.88 in 0.100s
INFO Successful handshake with model-house @ 192.168.1.88 in 0.016s
INFO Processing unexpected disconnect from ESPHome API for model-house @ 192.168.1.88
WARNING Disconnected from API
INFO Successfully resolved model-house @ 192.168.1.88 in 0.001s
WARNING Can't connect to ESPHome API for model-house @ 192.168.1.88: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.88', port=6053))]: [Errno 111] Connect call failed ('192.168.1.88', 6053) (SocketAPIError)
INFO Trying to connect to model-house @ 192.168.1.88 in the background
INFO Successfully connected to model-house @ 192.168.1.88 in 0.106s
INFO Successful handshake with model-house @ 192.168.1.88 in 0.018s
INFO Processing unexpected disconnect from ESPHome API for model-house @ 192.168.1.88
WARNING Disconnected from API
INFO Successfully resolved model-house @ 192.168.1.88 in 0.000s
WARNING Can't connect to ESPHome API for model-house @ 192.168.1.88: Error connecting to [AddrInfo(family=<AddressFamily.AF_INET: 2>, type=<SocketKind.SOCK_STREAM: 1>, proto=6, sockaddr=IPv4Sockaddr(address='192.168.1.88', port=6053))]: [Errno 111] Connect call failed ('192.168.1.88', 6053) (SocketAPIError)
INFO Trying to connect to model-house @ 192.168.1.88 in the background
INFO Successfully connected to model-house @ 192.168.1.88 in 0.123s
INFO Successful handshake with model-house @ 192.168.1.88 in 0.016s
[22:49:35.416][D][api:136]: Accept 192.168.1.31
[22:49:35.420][D][api.connection:1398]: Home Assistant 2025.12.4 (192.168.1.31) connected
[22:49:40.540][W][api.connection:1978]: Home Assistant 2025.12.4 (192.168.1.31): Reading failed SOCKET_READ_FAILED errno=104
[22:50:44.318][D][text:050]: 'Yellow 1 Text' - Setting text value: 1025
[22:50:44.322][D][text:018]: 'Yellow 1 Text': Sending state 1025
[22:51:07.357][D][number:064]: 'Yellow 1 Brightness': Setting value
[22:51:07.362][D][number:123]:   New value: 7.000000
[22:51:07.374][D][number:034]: 'Yellow 1 Brightness': Sending state 7.000000

Is there any indication from this why it might be losing the connection? It seems to have a decent signal strength?

Many thanks for your help!

David

My feeling is that your display update is blocking and api drops. Try how it goes with update_interval: 5s
Ideally you only print on display when something changes and even that with reasonable interval.
You might have lot of fun with seven displays. Do you already have them all?

1 Like

Thanks Karosm!

The WiFi seems to be dropping even if nothing is being sent to the single display I’ve currently got connected – you can see me sending numerous text and brightness requests at the bottom of that log file with no drop-outs. The prior dropouts further up the log file occurred whilst the display was dormant / not being updated.

I’ve already got the 7 displays, yes :grimacing: … from the ESPHome documentation page, it didn’t seem to imply there would be any limitation for driving multiple displays? I’m even going to be giving each display a unique CLK and DIO pin to save sharing them.

In reality they only need to update maybe once every 30 seconds or so as it’s not like I will be looking at this model house frequently, or relying on the readouts for anything – it’s more to be a sort of executive toy on my desk :grinning:

Thanks for your help!

so api drops even if you remove display component out of your yaml?

1 Like

Ah that’s a very good point to check, thanks Karosm :pray: Unfortunately, I’m away from home until next weekend so I won’t be able to test this until I’m back, but it’s the first thing I will check.