esphome / esphome/feature-requests
Make servo state public
- 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**
I need to be able to "see" what a servo is doing: know when it starts and stops moving. I think the easiest way would be to simply make the currently protected State enumeration public and add a public "state" method to expose the existing internal state.
Optionally, events could be added to the servo component to allow code to be triggered when the servo starts and stops movement.
**Please describe your use case for this integration and alternatives you've tried:**
I have an indicator LED that I'd like to light up only when the servo is in motion. I can only simulate this now with a script with a turn_on/turn_off and a delay between them, but I must remember to change the delay to match the servo transition time. Things also get janky if I stop the servo part way or reverse it. It would be nice to simply turn on the LED if the servo state is ATTACHED and off if it's TARGET_REACHED or DETACHED.
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the servo component's protected State enumeration and its existing internal state handling. Confirm how ATTACHED, TARGET_REACHED, and DETACHED are represented, then define done as exposing the state publicly; event callbacks are an optional follow-up rather than a required part of this request.
Written by the indexing model from the issue text.
Assessment
- Domain
- embedded-iot
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100