Skip to content

Time Request during reconnect slows down first command #1313

@bdraco

Description

@bdraco
2025-08-11 21:03:18.877 DEBUG (MainThread) [aioesphomeapi.connection] x: Connecting to IPv4Sockaddr(address='x', port=6053)
2025-08-11 21:03:19.616 DEBUG (MainThread) [aioesphomeapi.connection] x: TCP_QUICKACK not supported
2025-08-11 21:03:19.616 DEBUG (MainThread) [aioesphomeapi.connection] x: Opened socket to x:6053
2025-08-11 21:03:19.617 DEBUG (MainThread) [aioesphomeapi._frame_helper.base] 192.168.209.157: Sending frame: [01000001003100ec02202a5b0e6477f8acca5c6d701e0209cc97d078a123fe774bdd2e64ac693519b18872102ed8d1089659b9d8bf1135]
2025-08-11 21:03:19.677 DEBUG (MainThread) [aioesphomeapi.connection] x: Sending HelloRequest: client_info: "aioesphomeapi"
api_version_major: 1
api_version_minor: 12

2025-08-11 21:03:19.677 DEBUG (MainThread) [aioesphomeapi._frame_helper.base] x: Sending frame: [010027909dc5ed5db9d93959bfb21877b55304751bfb87db0ecb7dd55b71a2462c7fa0e844f953fe19cd]
2025-08-11 21:03:19.686 DEBUG (MainThread) [aioesphomeapi.connection] x: Got message of type GetTimeRequest (len=0): 
2025-08-11 21:03:19.686 DEBUG (MainThread) [aioesphomeapi.connection] x: Sending GetTimeResponse: epoch_seconds: 1754964199

2025-08-11 21:03:19.686 DEBUG (MainThread) [aioesphomeapi._frame_helper.base] x: Sending frame: [0100190fee5341c0463e75ba39c9078a52229ad98356df7adef87700]
2025-08-11 21:03:19.686 DEBUG (MainThread) [aioesphomeapi.connection] x: Got message of type HelloResponse (len=64): api_version_major: 1
api_version_minor: 12
server_info: "kitchenalexproxy (esphome v2025.8.0-dev)"
name: "kitchenalexproxy"

2025-08-11 21:03:19.687 DEBUG (MainThread) [aioesphomeapi.connection] x: Successfully connected ('kitchenalexproxy (esphome v2025.8.0-dev)' API=1.12)

We could proactively include the TimeResponse in the first packet (hello/connnect). If HA time is disabled it will do nothing. Its nearly free to send in the same packet. Than we don't need to respond to the first time request as the device will already have it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions