Skip to content

feat(cli): add set command group for equipment control#146

Open
tonyfruzza wants to merge 1 commit into
cryptk:mainfrom
tonyfruzza:feat/cli-set-commands
Open

feat(cli): add set command group for equipment control#146
tonyfruzza wants to merge 1 commit into
cryptk:mainfrom
tonyfruzza:feat/cli-set-commands

Conversation

@tonyfruzza
Copy link
Copy Markdown

Summary

Adds a new set command group to the CLI exposing equipment control operations that were previously only available through the Python library API.

Closes #145

New CLI commands

# Set heater target temperature (Fahrenheit)
omnilogic --host 192.168.1.100 set heater-temp 4 82

# Set solar heater set-point
omnilogic --host 192.168.1.100 set solar-temp 4 90

# Set pump/filter speed (0-100%)
omnilogic --host 192.168.1.100 set speed 3 75

# Turn equipment on/off (works with any controllable equipment)
omnilogic --host 192.168.1.100 set on 5
omnilogic --host 192.168.1.100 set off 5

Motivation

The library has comprehensive control methods (heater.set_temperature(), pump.set_speed(), light.turn_on(), etc.) but the CLI only exposed read-only operations via get and debug. This made it impossible to control equipment from shell scripts, cron jobs, or lightweight HTTP wrappers without writing Python.

Implementation

  • New pyomnilogic_local/cli/set/ module following the same pattern as cli/get/
  • Uses the existing OmniLogic instance from Click context (already initialized by entrypoint)
  • Equipment lookup uses all_heaters.get_by_id(), all_pumps.get_by_id(), all_filters.get_by_id(), and get_equipment_by_id() for generic on/off
  • Each command validates equipment exists and supports the requested operation before calling it
  • Follows existing code style: Click decorators, asyncio.run() for async calls, mypy error suppression for Click decorators

Files changed

File Change
cli/cli.py Import and register set command group
cli/set/__init__.py Package init
cli/set/commands.py Click group definition, registers subcommands
cli/set/heater_temp.py heater-temp and solar-temp commands
cli/set/speed.py speed command for pumps/filters
cli/set/equipment.py Generic on/off commands

Testing

I have been testing these control operations against a live Hayward OmniLogic controller (firmware 5.1.85) via an HTTP wrapper that uses the same library methods. Temperature set-points, pump speed, and on/off all confirmed working.

Note: I do not have the test harness set up locally (missing pydantic/dev dependencies) so I have not run the existing test suite. Happy to add unit tests if desired — would follow the mock-based pattern in tests/.

Add a new 'set' command group to the CLI that exposes equipment control
operations that were previously only available through the Python API:

- set heater-temp <system_id> <temperature> — Set heater target temp (°F)
- set solar-temp <system_id> <temperature> — Set solar heater target (°F)
- set speed <system_id> <percent> — Set pump/filter speed (0-100%)
- set on <system_id> — Turn equipment on
- set off <system_id> — Turn equipment off

This allows scripting and automation of pool control without writing
Python code, complementing the existing read-only 'get' and 'debug'
command groups.

Resolves cryptk#145
@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): Add control commands (set temperature, on/off, speed)

1 participant