API#

PLC#

class lvmecp.lights.LightsController(plc)[source]#

Bases: object

Controller for the light settings.

Parameters

plc (PLC) –

async get_all(update=True)[source]#

Returns a dictionary with the status of all the lights.

Parameters

update (bool) – Whether to update the status of all lights before returning. If False, the last cached status will be used.

Returns

status – A dictionary of light name to status (True for on, False for off).

Return type

dict[str, bool]

get_code(light)[source]#

Returns the short-form code for a light. Case-insensitive.

Parameters

light (str) – The light for which the code is seeked.

Examples

>>> get_code('telescope_red')
'tr'
>>> get_code('telescope bright')
'tb'
>>> get_code('uMa Room')
'uma'
Raises

ValueError – When a code cannot be found for the input light.

Parameters

light (str) –

get_flag(light)[source]#

Gets the LightStatus flag associated with a light.

Parameters

light (str) – The light for which the LightStatus a flag is requested. It can be specified in short form (e.g., tr), using underscores (telescope_red), or spaces (telescope red). The light name is case-insensitive.

async get_light_status(light, update=True)[source]#

Returns the status of a light.

Parameters
  • light (str) – The light for which to get the status.

  • update (bool) – Whether to update the status of all lights before returning the status. If False, the last cached status will be used.

Returns

statusTrue if the light is on, False otherwise.

Raises

ValueError – If the light is unknown.

Return type

bool

async set(light, action=None)[source]#

Turns a light on/off.

Updates the internal status dictionary.

Parameters
  • light (str) – The light to command.

  • action (bool | None) – True to turn on the light, False for off. If None, the light status will be switched. Doesn’t do anything if the light is already at the desired state.

async update()[source]#

Refreshes the lights status.

class lvmecp.dome.DomeController(plc)[source]#

Bases: object

Controller for the rolling dome.

Parameters

plc (PLC) –

async update()[source]#

Refreshes the dome status.