esphome / esphome/feature-requests

Add an "on_connect" and "on_disconnect" action to the "USB UART" Interface component.

Open
#3,204 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

**Describe the problem you have/What new integration you would like**

If a USB device is connected or disconnected from the USB bus, after the ESP has started, there is no way to initialize the new device plugged in, or to properly shut down any process depending on the device.
Adding an "on_connect" and "on_disconnect" action would allow us to write code to properly handle this.
**Please describe your use case for this integration and alternatives you've tried:**

When a modem is disconnected and re-connected to the USB port, it will lose any configuration that had been sent to it, and there is no way of knowing that it needs to be re-configured.
**Additional context**

This need to be done to any serial device that needs to be initialized when plugged in, not just to modems.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the USB UART Interface component and its existing connection lifecycle and action handling. Confirm how USB device connection changes are detected; done means exposing on_connect and on_disconnect actions that let serial-device processes initialize and shut down when devices are plugged in or removed.

Written by the indexing model from the issue text.

Assessment

Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.