AstroHuntsman / huntsman-pocs

POCS on the Huntsman Telescope
MIT License
7 stars 8 forks source link

write a huntsman.pocs.utils.nps module for toggling plug power via the nps #593

Open fergusL opened 1 year ago

fergusL commented 1 year ago

We need a utils module that will allow pocs to control power to devices via the nps. This module will contain an nps class and an enum class that maps the various nps power plug numbers to the name of the device eg plug B3 maps to Jetson DC power and perhaps another for plug state. The nps class can then be used to toggle a plug state to be on, off or boot (reboot the plug):

pocs.nps(plug.jetson, status.off)

The nps class should also have a method for retrieving nps status, including "alarms" such as the "LOST VOLTAGE (LINE INPUT)" alarm which indicates if mains power has been lost and that the unit is running on the UPS.

An example of a python script utilising the WTI RESTful api to reboot a plug is given here . The documentation for the WTI RESTful api can be found here.

Once this nps class has been implemented, it should be used to power on the jetsons once the start up horizon is reached (see here) and to turn off the jetson power in the morning after flats (see here).

An additional corner case to consider is the scenario where pocs is started when it is already dark. In that case another clause that checks the jetson plug status, toggles it on if it is off and waits for the jetson camera servers to be ready would be required.

A summarised form of the nps status should also be recorded in the pocs logs (incorporated into the safety check?). This is will allow the observatory to shut itself down if mains power is lost. It also will allow the slack alert script to notify us on slack if mains power is lost (see #557)