herosdevices.hardware.megatec ============================= .. py:module:: herosdevices.hardware.megatec .. autoapi-nested-parse:: Drivers for Megatec-compatible UPS devices. Module Contents --------------- .. py:data:: DEFAULT_OBSERVABLES .. py:data:: SERIAL_UPS_STATUS_FORMAT :value: ['voltage_input', 'voltage_input_fail', 'voltage_output', 'load_percentage', 'input_frequency',... .. py:function:: 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) :returns: Flat list of values in order SERIAL_UPS_STATUS_FORMAT .. py:class:: SerialUPS(address: str, timeout: float = 1.0, observables: dict | None = None) Bases: :py:obj:`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 `_. .. py:attribute:: voltage_input :type: float .. py:attribute:: voltage_input_fail :type: float .. py:attribute:: voltage_output :type: float .. py:attribute:: load_percentage :type: int .. py:attribute:: input_frequency :type: float .. py:attribute:: battery_voltage :type: float .. py:attribute:: temperature :type: float .. py:attribute:: utility_fail :type: int .. py:attribute:: battery_low :type: int .. py:attribute:: bypass_active :type: int .. py:attribute:: ups_failed :type: int .. py:attribute:: ups_standby :type: int .. py:attribute:: test_in_progress :type: int .. py:attribute:: shutdown_active :type: int .. py:attribute:: beeper_on :type: int .. py:attribute:: observables :type: dict .. py:method:: run_test(test_length: str | int = 'short') -> None Run a self test. :param 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. .. py:attribute:: address .. py:attribute:: connection