Skip to content

Commit 7cf3278

Browse files
committed
Add CLI for desk height control; implement argument parsing for target height and duty cycle status
1 parent 63bc7d3 commit 7cf3278

2 files changed

Lines changed: 28 additions & 63 deletions

File tree

src/progressive_automations_python/desk_controller.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,31 @@ def move_to_height(target_height: float) -> dict:
166166
"duty_cycle": duty_status,
167167
"total_up_time": state["total_up_time"]
168168
}
169+
170+
171+
if __name__ == "__main__":
172+
import argparse
173+
174+
parser = argparse.ArgumentParser(description="Desk height controller")
175+
parser.add_argument("--target-height", type=float, required=True,
176+
help="Target height in inches")
177+
parser.add_argument("--status", action="store_true",
178+
help="Show duty cycle status before execution")
179+
args = parser.parse_args()
180+
181+
try:
182+
if args.status:
183+
status = check_duty_cycle_status_before_execution()
184+
print(f"\nCurrent position: {status.get('current_position', 'Unknown')}\"")
185+
186+
print(f"\nMoving to target height: {args.target_height}\"")
187+
result = move_to_height(args.target_height)
188+
189+
if result["success"]:
190+
print(f"✓ Movement successful!")
191+
print(f" Direction: {result['movement']}")
192+
print(f" Distance: {result['distance']:.2f}\"")
193+
print(f" Duration: {result['duration']:.1f}s")
194+
195+
except Exception as e:
196+
print(f"Error: {e}")

src/progressive_automations_python/direct_test.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)