herosdevices.hardware.megatec - Heros Devices 0.11.1 documentation

Skip to content
Back to top
View this page

# herosdevices.hardware.megatec

Drivers for Megatec-compatible UPS devices.

## Module Contents

herosdevices.hardware.megatec.DEFAULT_OBSERVABLES

herosdevices.hardware.megatec.SERIAL_UPS_STATUS_FORMAT = ['voltage_input', 'voltage_input_fail', 'voltage_output', 'load_percentage', 'input_frequency',...

herosdevices.hardware.megatec.split_status_reply(status_str: str) → dict[str, float | int]

  Parse Megatec status reply string into components.

  Format: (MMM.M NNN.N PPP.P QQQ RR.R S.SS TT.T b7b6b5b4b3b2b1b0<cr>)

  Returns:

    Flat list of values in order SERIAL_UPS_STATUS_FORMAT

class herosdevices.hardware.megatec.SerialUPS(address: str, timeout: float = 1.0, observables: dict | None = None)

  Bases: `herosdevices.core.templates.SerialDeviceTemplate`

  Representation of Megatec based uninterruptible power supplies.

  Several UPS vendors use the Megatec based controller card. Among them are:

    - AdPoS

    - Green Cell

  Important

  The devices are quite picky concerning the serial to USB chip. It is known to work with a `Prolific PL2303` chip. Others might work but it is not guaranteed.

  Important

  Some devices seem to have an incorrectly grounded serial interface, generating massive noise on the output line. Check for noise on the output power sockets before installing permanently!

  A documentation of the full protocol can be found here.

  voltage_input: float
  voltage_input_fail: float
  voltage_output: float
  load_percentage: int
  input_frequency: float
  battery_voltage: float
  temperature: float
  utility_fail: int
  battery_low: int
  bypass_active: int
  ups_failed: int
  ups_standby: int
  test_in_progress: int
  shutdown_active: int
  beeper_on: int
  observables: dict
  run_test(test_length: str | int = 'short') → None

    Run a self test.

    Parameters:

      test_length – Length of the test to run. Can be given in minutes (integer, 1-99) or as one of `"short"` or `"low"`. `"short"` runs a 10 second test, ``”low”` runs a test until the battery is low.

  address
  connection