]> www.infradead.org Git - users/dwmw2/esp32-pool.git/commitdiff
Only reset home on stall if travelling upwards
authorDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 12 Feb 2025 14:47:40 +0000 (14:47 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Wed, 12 Feb 2025 14:47:40 +0000 (14:47 +0000)
blind.yaml

index a2edcba151664af85b03d02e8f5d4d9c2b578171..bdb16f7771333aa25df31ef61a892214104d4e27 100644 (file)
@@ -172,7 +172,9 @@ stepper:
          args: [ "id(encoder)->get_state()", "id(motor)->current_direction",
                "cover_operation_to_str(id(pd_blinds)->current_operation)" ]
       - stepper.stop: motor #un-comment this to disable on stall
-      - lambda: id(sensored_home_pos) = id(encoder)->get_state();  #un-comment this to not reset home on stall
+      - lambda: |
+          if (id(motor).current_direction < 0)
+            id(sensored_home_pos) = id(encoder)->get_state();
       - cover.template.publish:
           id: pd_blinds
           state: OPEN