esphome / feature-requests

ESPHome Feature Request Tracker
https://esphome.io/
413 stars 26 forks source link

Set stepper position (without moving) #943

Open abelmatser opened 3 years ago

abelmatser commented 3 years ago

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

I would like to be able to set the stepper position to a value. This could make homing, troubleshooting and toggling the position of a cover much easier.

Please describe your use case for this integration and alternatives you've tried:

I tried to use stepper.report_position, but that moved my stepper to the location desired to be reported.

Additional context

Sometimes my curtain hangs behind something, which causes it to be unable to move. The stepper tries to obtain that location anyway, so it skips steps until it reaches that location. The problem is however, that it did not get to that location, so the next time your cover is opened/closed, it goes the entire wrong way. I want a method to set the position of the stepper after such the cover did not move.

The following snippet should toggle the location of the stepper after it hung, but currently does not work with stepper.report_position.

- service: toggle_current_position
  then:
    - stepper.report_position:
        id: ${plug_id}_stepper
        position: !lambda |-
          if (id(${plug_id}_cover).position == id(closed_position)) {
            return 0;
          } else {
            return id(closed_position);
          }
glmnet commented 3 years ago

Did you try calling set_target after report_position? Thats how docs instructs to do... https://esphome.io/components/stepper/index.html#stepper-report-position-action

edit: set_target

tungmeister commented 2 years ago

I have the same issue with my Venetian blinds, sometimes due to the positioning, they will skip similar to this issue that was mentioned resulting in them being out of alignment. If I could override the open position to introduce an artificial offset this issue would be alleviated as even if the stepper skipped when returning to home it should still achieve complete closure.