panoptes / POCS

An Observatory Control System for the PANOPTES citizen-science project designed to help find transiting exoplanets! :telescope: :stars:
https://pocs.readthedocs.io/en/latest/
MIT License
80 stars 49 forks source link

Adding power board control to cli #1171

Closed wtgee closed 2 years ago

wtgee commented 2 years ago
$ pocs power --help
Usage: pocs power [OPTIONS] COMMAND [ARGS]...

  Interact with power relays.

Options:
  --host TEXT  Power monitor host address.  [default: localhost]
  --port TEXT  Power monitor port.  [default: 6564]
  --help       Show this message and exit.

Commands:
  control   Control a relay by label or relay index.
  off       Turns a relay off.
  on        Turns a relay on.
  readings  Get the readings of the relays.
  status    Get the status of the power monitor.
$ pocs power status
[RELAY_0] weather_station..... OFF
[RELAY_1] unused1............. OFF
[RELAY_2] fans................ ON
[RELAY_3] unused3............. OFF
[RELAY_4] mount............... ON
$ pocs power readings
ac_ok............... ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ [0]
weather_station..... ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ [0]
unused1............. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ [0]
fans................ ▅▅▅▁▅▆█▅▆▆▇▅▅█▅▆▅▃▆▇▅▆▅▅▆▆▆▅▆▅ [9]
unused3............. ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄ [0]
mount............... ▆▁▄▃▄▅▂▅▂▄▃▄▁▆▂▃▅▃▁▄▁▁▄▂▅▅▂▄█▂ [99]
$ pocs power control --relay fans --command turn_off
{'command': 'turn_off', 'relay': 'fans'}

$ # Shorter method
$ pocs power off fans
{'command': 'turn_off', 'relay': 'fans'}

$ pocs power on fans
{'command': 'turn_on', 'relay': 'fans'}

Comes from #1167

codecov[bot] commented 2 years ago

Codecov Report

Merging #1171 (8cfea6b) into develop (4908119) will decrease coverage by 8.63%. The diff coverage is 56.31%.

@@             Coverage Diff             @@
##           develop    #1171      +/-   ##
===========================================
- Coverage    83.08%   74.45%   -8.64%     
===========================================
  Files           86       91       +5     
  Lines         7425     7778     +353     
  Branches       635      864     +229     
===========================================
- Hits          6169     5791     -378     
- Misses        1083     1847     +764     
+ Partials       173      140      -33     
Impacted Files Coverage Δ
src/panoptes/pocs/camera/gphoto/remote.py 0.00% <0.00%> (-21.57%) :arrow_down:
...rc/panoptes/pocs/scheduler/observation/compound.py 0.00% <0.00%> (ø)
src/panoptes/pocs/sensor/power.py 40.23% <0.00%> (-1.74%) :arrow_down:
...rc/panoptes/pocs/state/states/default/analyzing.py 5.55% <0.00%> (-54.45%) :arrow_down:
src/panoptes/pocs/state/states/default/tracking.py 6.66% <0.00%> (-76.67%) :arrow_down:
src/panoptes/pocs/utils/cli/main.py 0.00% <0.00%> (-70.00%) :arrow_down:
src/panoptes/pocs/utils/database.py 0.00% <0.00%> (ø)
src/panoptes/pocs/utils/error.py 0.00% <0.00%> (ø)
src/panoptes/pocs/utils/logger.py 100.00% <ø> (ø)
tests/test_ioptron.py 66.66% <0.00%> (+0.70%) :arrow_up:
... and 70 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.