:orphan:

UPS (Serial)
============

**From:** `Megatec <https://www.megatec.com.tw/allproducts/>`_

**Class:** :py:class:`herosdevices.hardware.megatec.SerialUPS`


**Driver Quality Index:** stable


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 <https://networkupstools.org/protocols/megatec.html>`_.

.. tab-set:: 


   .. tab-item:: Arguments
   
   
      Bold arguments are mandatory. For more information on the listed arguments refer to the class             documentation: :py:class:`herosdevices.hardware.megatec.SerialUPS` If parameters appear in this             list but not in the class definition, please recursively check the linked base classes for the             definition of the parameter.
      
      
      .. list-table:: 
         :widths: 50 50 50 100
         :header-rows: 1
      
         * - Argument
           - Type
           - Default Value
           - Description
         * - **address**
           - **<class 'str'>**
           - 
           - Serial port address of the target device. 
         * - timeout
           - <class 'float'>
           - 1.0
           - Timeout for serial communication.
         * - observables
           - dict | None
           - None
           - Dictionary of attributes which should be exposed at datasource :py:meth:`_observable_data` events. Of the form {"attribute_name": {"name": "display_name", "unit": "unit"}}.
      

   .. tab-item:: Example JSON for BOSS
   
      The following JSON strings can be used to start a HERO device representation of             :py:class:`SerialUPS <herosdevices.hardware.megatec.SerialUPS>` using             `BOSS <https://boss-eb4966.gitlab.io/>`_.
      
      
      .. code-block:: json
      
         {
             "_id": "my_SerialUPS",
             "classname": "herosdevices.hardware.megatec.SerialUPS",
             "arguments": {
                 "address": "/dev/ttyUSB0",
                 "timeout": 1.0,
                 "observables": null
             }
         }
      
      :sup:`generated from signature`
   .. tab-item:: Inheritance
   
   
      .. inheritance-diagram:: herosdevices.hardware.megatec.SerialUPS
      
