API

PLC

class lvmecp.lights.LightsController(name, plc, modbus=None, interval=None, start=True, notifier=None)[source]

Bases: PLCModule

Controller for the light settings.

Parameters:
  • name (str)

  • plc (PLC)

  • modbus (Modbus | None)

  • interval (float | None)

  • start (bool)

  • notifier (Callable[[int, str, dict], Callable | Coroutine] | None)

flag

alias of LightStatus

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 off(light)[source]

Turns off a light.

Parameters:

light (str)

async on(light)[source]

Turns on a light.

Parameters:

light (str)

async toggle(light)[source]

Switches a light.

Parameters:

light (str)

interval: float | None = 30.0
class lvmecp.dome.DomeController(*args, **kwargs)[source]

Bases: PLCModule[DomeStatus]

Controller for the rolling dome.

flag

alias of DomeStatus

async allowed_to_open()[source]

Returns whether the dome is allowed to move.

async close(force=False, mode='normal')[source]

Close the dome.

Parameters:
is_daytime()[source]

Returns whether it is daytime.

async open(force=False)[source]

Open the dome.

Parameters:

force (bool)

async reset()[source]

Resets the roll-off error state.

async set_direction(open)[source]

Sets the motor direction (True means open, False close).

Parameters:

open (bool)

async stop()[source]

Stops the dome.

interval: float | None = 15.0