networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.13k stars 355 forks source link

SMS Manager III Support #1987

Open leleobhz opened 1 year ago

leleobhz commented 1 year ago

Hello!

I'm trying to read SMS Manager III without sucess. I've built NUT for Docker and published at https://github.com/leleobhz/docker-nut (To use glibc-based compilation) and as stated at https://networkupstools.org/stable-hcl.html - This nobreak is served by blazer_ser. Since this driver was superseed by nutdrv_qx, I'm trying to use it.

With the following configuration:

docker run -it --rm --name nut --user 0 --privileged --device /dev -e DRIVER="nutdrv_qx" -e DESCRIPTION="Nobreak Zenith" -e NAME="NobreakZenith" -e PORT="auto" -e SUBDRIVER="cypress" -e VENDORID="04b4" -e PRODUCTID="5500" -e SDORDER="-1" -e API_USER="upsmon" -e API_PASSWORD="aaaaa"  quay.io/pqatsi/docker-nut:v2.8.0-signed

Resulting this ups.conf:

[NobreakZenith]
        driver = nutdrv_qx
        port = auto
        desc = "Nobreak Zenith"
        subdriver = "cypress"
        vendorid = 04b4
        productid = "5500"
        sdorder = -1

Running driver directly returns:

/nut/bin/nutdrv_qx -V

Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-signed)
USB communication driver (libusb 1.0) 0.43

/nut/bin/nutdrv_qx -a NobreakZenith -DDD

Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-signed)
USB communication driver (libusb 1.0) 0.43
   0.000000 [D1] debug level is '3'
   0.002508 [D1] upsdrv_initups...
   0.024183 [D2] Checking device 1 of 4 (04B4/5500)
   0.039965 [D2] - VendorID: 04b4
   0.040428 [D2] - ProductID: 5500
   0.040754 [D2] - Manufacturer: Cypress Semiconductor
   0.041119 [D2] - Product: USB to Serial
   0.042261 [D2] - Serial Number: unknown
   0.042335 [D2] - Bus: 001
   0.042391 [D2] - Device: unknown
   0.042517 [D2] - Device release number: 0000
   0.042571 [D2] Trying to match device
   0.042625 [D3] match_function_regex: matching a device...
   0.044825 [D2] Device matches
   0.045186 [D2] Reading first configuration descriptor
   0.046393 [D3] libusb_kernel_driver_active() returned 0
   0.047206 [D2] Claimed interface 0 successfully
   0.047784 [D3] nut_usb_set_altinterface: skipped libusb_set_interface_alt_setting(udev, 0, 0)
   0.049516 [D3] send: QGS
   0.175883 [D3] read: �
   0.176624 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   0.178995 [D3] send: QGS
   0.306880 [D3] read: �
   0.307551 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   0.309425 [D3] send: QGS
   0.435873 [D3] read: �
   0.436628 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   0.440793 [D3] send: M
   0.568869 [D3] read: �
   0.569095 [D2] voltronic_qs_protocol: invalid protocol [�]
   0.571009 [D3] send: M
   0.698866 [D3] read: �
   0.699093 [D2] voltronic_qs_protocol: invalid protocol [�]
   0.700526 [D3] send: M
   0.827869 [D3] read: �
   0.828521 [D2] voltronic_qs_protocol: invalid protocol [�]
   0.830483 [D3] send: M
   0.957869 [D3] read: �
   0.960846 [D2] voltronic_qs_hex_protocol: invalid protocol [�]
   0.965752 [D3] send: M
   1.093863 [D3] read: �
   1.094032 [D2] voltronic_qs_hex_protocol: invalid protocol [�]
   1.095566 [D3] send: M
   1.222859 [D3] read: �
   1.223629 [D2] voltronic_qs_hex_protocol: invalid protocol [�]
   1.224731 [D3] send: QS
   1.350854 [D3] read: �
   1.351556 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   1.354554 [D3] send: QS
   1.480838 [D3] read: �
   1.481003 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   1.482841 [D3] send: QS
   1.610841 [D3] read: �
   1.611007 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   1.613615 [D3] send: D
   1.742842 [D3] read: �
   1.743475 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   1.745949 [D3] send: D
   1.871833 [D3] read: �
   1.872316 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   1.876676 [D3] send: D
   2.003831 [D3] read: �
   2.004197 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.006173 [D3] send: Q1
   2.133828 [D3] read: �
   2.135792 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.136917 [D3] send: Q1
   2.265821 [D3] read: �
   2.265997 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.267396 [D3] send: Q1
   2.393808 [D3] read: �
   2.394632 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.397461 [D3] send: Q1
   2.524817 [D3] read: �
   2.524981 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.526360 [D3] send: Q1
   2.654806 [D3] read: �
   2.654976 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.656296 [D3] send: Q1
   2.785807 [D3] read: �
   2.785972 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.787384 [D3] send: Q1
   2.913792 [D3] read: �
   2.914269 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   2.917185 [D3] send: Q1
   3.043785 [D3] read: �
   3.043961 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.044942 [D3] send: Q1
   3.170793 [D3] read: �
   3.170960 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.171992 [D3] send: Q1
   3.298779 [D3] read: �
   3.298955 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.300688 [D3] send: Q1
   3.426774 [D3] read: �
   3.426951 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.428079 [D3] send: Q1
   3.554770 [D3] read: �
   3.554935 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.555110 [D2] find_nut_info: info type series not found
   3.555983 [D2] claim: cannot find series
   3.556982 [D2] find_nut_info: info type series not found
   3.558218 [D2] claim: cannot find series
   3.558411 [D2] find_nut_info: info type series not found
   3.558517 [D2] claim: cannot find series
   3.559762 [D3] send: Q1
   3.687776 [D3] read: �
   3.687943 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.689348 [D3] send: Q1
   3.815768 [D3] read: �
   3.815935 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.817749 [D3] send: Q1
   3.943758 [D3] read: �
   3.943925 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   3.945467 [D3] send: Q1
   4.071753 [D3] read: �
   4.071918 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   4.073586 [D3] send: Q1
   4.199757 [D3] read: �
   4.199921 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   4.201397 [D3] send: Q1
   4.327750 [D3] read: �
   4.327918 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   4.329559 [D3] send: Q1
   4.455749 [D3] read: �
   4.455916 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   4.457639 [D3] send: Q1
   4.583735 [D3] read: �
   4.583910 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   4.585068 [D3] send: Q1
   4.711740 [D3] read: �
   4.712227 [D2] qx_process_answer: input.voltage - invalid start character [f0], expected [28]
   4.712526 Device not supported!
   4.712847 Device not supported!

For reference. lsusb of this device:

Bus 001 Device 010: ID 04b4:5500 Cypress Semiconductor Corp. HID->COM RS232 Adapter
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x04b4 Cypress Semiconductor Corp.
  idProduct          0x5500 HID->COM RS232 Adapter
  bcdDevice            0.00
  iManufacturer           1 Cypress Semiconductor
  iProduct                2 USB to Serial
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0029
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          4 Sample HID
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      37
          Report Descriptor: (length is 37)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0x01 ] 1
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff 0x00 ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x08 ] 8
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x02 ] 2
                            (null)
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x08 ] 8
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Local ): Usage, data= [ 0x03 ] 3
                            (null)
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x05 ] 5
            Item(Main  ): Feature, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile Bitfield
            Item(Main  ): End Collection, data=none
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval               1
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0000
  (Bus Powered)

And tracing this nobreak history, in past SMS was this driver: https://alioth-lists.debian.net/pipermail/nut-upsdev/2013-January/006379.html

This is a issue with nutdrv_qx driver, there is any configuration required I'm missing there or this is in fact a bug of nutdrv_qx?

leleobhz commented 1 year ago

Just for reference: Another repo build a python support for this nobreak: and the chat is at https://github.com/dmslabsbr/smsUps/blob/master/smsUPS.py#L1673

jimklimov commented 1 year ago

The response characters seem to be hex, not ascii :\

One driver that comes to mind is voltronic_hex (IIRC the name?), give it a shot...

Also, would nut-scanner say anything about the device?

leleobhz commented 1 year ago

Hello,

nut-scanner replies like this:

root@8f628cce7de1:/# /nut/bin/nut
bash: /nut/bin/nut: No such file or directory
root@8f628cce7de1:/# /nut/bin/nut-scanner 
Scanning USB bus.
No start IP, skipping SNMP
Scanning XML/HTTP bus.
No start IP, skipping NUT bus (old connect method)
Scanning NUT bus (avahi method).
Scanning IPMI bus.
Failed to create client: Daemon not running
[nutdev1]
    driver = "riello_usb"
    port = "auto"
    vendorid = "04B4"
    productid = "5500"
    product = "USB to Serial"
    vendor = "Cypress Semiconductor"
    bus = "001"

But running with riello_usb:

root@840d4051e392:/# /nut/bin/riello_usb -a nutdev1 -DDD
Network UPS Tools - Riello USB driver 0.07 (2.8.0-signed)
Warning: This is an experimental driver.
Some features may not function correctly.

   0.000000 [D1] debug level is '3'
   0.026157 [D2] Checking device 1 of 4 (04B4/5500)
   0.040315 [D2] - VendorID: 04b4
   0.040419 [D2] - ProductID: 5500
   0.040483 [D2] - Manufacturer: Cypress Semiconductor
   0.040542 [D2] - Product: USB to Serial
   0.040610 [D2] - Serial Number: unknown
   0.040669 [D2] - Bus: 001
   0.040850 [D2] - Device: unknown
   0.040912 [D2] - Device release number: 0000
   0.041420 [D2] Trying to match device
   0.041483 [D3] match_function_regex: matching a device...
   0.041546 [D2] Device matches
   0.041614 [D2] Reading first configuration descriptor
   0.043434 [D3] libusb_kernel_driver_active() returned 0
   0.043622 [D2] Claimed interface 0 successfully
   0.043701 [D3] nut_usb_set_altinterface: skipped libusb_set_interface_alt_setting(udev, 0, 0)
   0.046127 [D3] HID descriptor, method 1: (9 bytes) => 09 21 00 01 00 01 22 25 00
   0.046270 [D3] HID descriptor length (method 1) 37
   0.046341 [D3] HID descriptor, method 2: (9 bytes) => 09 21 00 01 00 01 22 25 00
   0.046405 [D3] HID descriptor length (method 2) 37
   0.046456 [D2] HID descriptor length 37
   0.051613 [D2] Report descriptor retrieved (Reportlen = 37)
   0.051707 [D2] Found HID device
   0.051828 [D2] entering start_ups_comm()

   0.052476 [D3] send: features report ok
   0.457260 [D3] send ok
   0.459253 [D3] read: F0 00 00 00 00 00 00 00
   0.472170 [D3] read: F0 00 00 00 00 00 00 00
   0.485175 [D3] read: F0 00 00 00 00 00 00 00
   0.498179 [D3] read: F0 00 00 00 00 00 00 00
   0.511167 [D3] read: F0 00 00 00 00 00 00 00
   0.524165 [D3] read: F0 00 00 00 00 00 00 00
   0.537165 [D3] read: F0 00 00 00 00 00 00 00
   0.550166 [D3] read: F0 00 00 00 00 00 00 00
   0.563188 [D3] read: F0 00 00 00 00 00 00 00
   0.576208 [D3] read: F0 00 00 00 00 00 00 00
   0.589159 [D3] read: F0 00 00 00 00 00 00 00
   0.602166 [D3] read: F0 00 00 00 00 00 00 00
   0.615162 [D3] read: F0 00 00 00 00 00 00 00
   0.628169 [D3] read: F0 00 00 00 00 00 00 00
   0.641170 [D3] read: F0 00 00 00 00 00 00 00
   0.654179 [D3] read: F0 00 00 00 00 00 00 00
   0.667173 [D3] read: F0 00 00 00 00 00 00 00
   0.680162 [D3] read: F0 00 00 00 00 00 00 00
   0.693157 [D3] read: F0 00 00 00 00 00 00 00
   0.706154 [D3] read: F0 00 00 00 00 00 00 00
   0.719168 [D3] read: F0 00 00 00 00 00 00 00
   0.732157 [D3] read: F0 00 00 00 00 00 00 00
   0.745165 [D3] read: F0 00 00 00 00 00 00 00
   0.758157 [D3] read: F0 00 00 00 00 00 00 00
   0.771152 [D3] read: F0 00 00 00 00 00 00 00
   0.784158 [D3] read: F0 00 00 00 00 00 00 00
   0.797153 [D3] read: F0 00 00 00 00 00 00 00
   0.810173 [D3] read: F0 00 00 00 00 00 00 00
   0.823191 [D3] read: F0 00 00 00 00 00 00 00
   0.836157 [D3] read: F0 00 00 00 00 00 00 00
   0.849157 [D3] read: F0 00 00 00 00 00 00 00
   0.862156 [D3] read: F0 00 00 00 00 00 00 00
   0.875158 [D3] read: F0 00 00 00 00 00 00 00
   0.888154 [D3] read: F0 00 00 00 00 00 00 00
   0.901153 [D3] read: F0 00 00 00 00 00 00 00
   0.914149 [D3] read: F0 00 00 00 00 00 00 00
   0.927154 [D3] read: F0 00 00 00 00 00 00 00
   0.940157 [D3] read: F0 00 00 00 00 00 00 00
   0.953151 [D3] read: F0 00 00 00 00 00 00 00
   0.966157 [D3] read: F0 00 00 00 00 00 00 00
   0.979146 [D3] read: F0 00 00 00 00 00 00 00
   0.991161 [D3] read: F0 00 00 00 00 00 00 00
   1.004169 [D3] read: F0 00 00 00 00 00 00 00
   1.017151 [D3] read: F0 00 00 00 00 00 00 00
   1.030154 [D3] read: F0 00 00 00 00 00 00 00
   1.043151 [D3] read: F0 00 00 00 00 00 00 00
   1.056162 [D3] read: F0 00 00 00 00 00 00 00
   1.070155 [D3] read: F0 00 00 00 00 00 00 00
   1.083147 [D3] read: F0 00 00 00 00 00 00 00
   1.096158 [D3] read: F0 00 00 00 00 00 00 00
   1.109159 [D3] read: F0 00 00 00 00 00 00 00
   1.122147 [D3] read: F0 00 00 00 00 00 00 00
   1.135148 [D3] read: F0 00 00 00 00 00 00 00
   1.148143 [D3] read: F0 00 00 00 00 00 00 00
   1.161144 [D3] read: F0 00 00 00 00 00 00 00
   1.174161 [D3] read: F0 00 00 00 00 00 00 00
   1.187142 [D3] read: F0 00 00 00 00 00 00 00
   1.200144 [D3] read: F0 00 00 00 00 00 00 00
   1.213141 [D3] read: F0 00 00 00 00 00 00 00
   1.226141 [D3] read: F0 00 00 00 00 00 00 00
   1.239158 [D3] read: F0 00 00 00 00 00 00 00
   1.252140 [D3] read: F0 00 00 00 00 00 00 00
   1.265140 [D3] read: F0 00 00 00 00 00 00 00
   1.278141 [D3] read: F0 00 00 00 00 00 00 00
   1.291144 [D3] read: F0 00 00 00 00 00 00 00
   1.304137 [D3] read: F0 00 00 00 00 00 00 00
   1.317140 [D3] read: F0 00 00 00 00 00 00 00
   1.330139 [D3] read: F0 00 00 00 00 00 00 00
   1.343141 [D3] read: F0 00 00 00 00 00 00 00
   1.356146 [D3] read: F0 00 00 00 00 00 00 00
   1.369148 [D3] read: F0 00 00 00 00 00 00 00
   1.382139 [D3] read: F0 00 00 00 00 00 00 00
   1.395153 [D3] read: F0 00 00 00 00 00 00 00
   1.408136 [D3] read: F0 00 00 00 00 00 00 00
   1.421138 [D3] read: F0 00 00 00 00 00 00 00
   1.434136 [D3] read: F0 00 00 00 00 00 00 00
   1.447137 [D3] read: F0 00 00 00 00 00 00 00
   1.460144 [D3] read: F0 00 00 00 00 00 00 00
   1.473148 [D3] read: F0 00 00 00 00 00 00 00
   1.486137 [D3] read: F0 00 00 00 00 00 00 00
   1.499135 [D3] read: F0 00 00 00 00 00 00 00
   1.512133 [D3] read: F0 00 00 00 00 00 00 00
   1.525138 [D3] read: F0 00 00 00 00 00 00 00
   1.538135 [D3] read: F0 00 00 00 00 00 00 00
   1.551131 [D3] read: F0 00 00 00 00 00 00 00
   1.564131 [D3] read: F0 00 00 00 00 00 00 00
   1.577138 [D3] read: F0 00 00 00 00 00 00 00
   1.590129 [D3] read: F0 00 00 00 00 00 00 00
   1.603143 [D3] read: F0 00 00 00 00 00 00 00
   1.616180 [D3] read: F0 00 00 00 00 00 00 00
   1.629131 [D3] read: F0 00 00 00 00 00 00 00
   1.642128 [D3] read: F0 00 00 00 00 00 00 00
   1.655130 [D3] read: F0 00 00 00 00 00 00 00
   1.668127 [D3] read: F0 00 00 00 00 00 00 00
   1.681130 [D3] read: F0 00 00 00 00 00 00 00
   1.694132 [D3] read: F0 00 00 00 00 00 00 00
   1.707124 [D3] read: F0 00 00 00 00 00 00 00
   1.720124 [D3] read: F0 00 00 00 00 00 00 00
   1.733136 [D3] read: F0 00 00 00 00 00 00 00
   1.746123 [D3] read: F0 00 00 00 00 00 00 00
   1.759126 [D3] read: F0 00 00 00 00 00 00 00
   1.772133 [D3] read: F0 00 00 00 00 00 00 00
   1.785129 [D3] read: F0 00 00 00 00 00 00 00
   1.798124 [D3] read: F0 00 00 00 00 00 00 00
   1.811126 [D3] read: F0 00 00 00 00 00 00 00
   1.824124 [D3] read: F0 00 00 00 00 00 00 00
   1.837123 [D3] read: F0 00 00 00 00 00 00 00
   1.850122 [D3] read: F0 00 00 00 00 00 00 00
   1.863124 [D3] read: F0 00 00 00 00 00 00 00
   1.876123 [D3] read: F0 00 00 00 00 00 00 00
   1.889125 [D3] read: F0 00 00 00 00 00 00 00
   1.902121 [D3] read: F0 00 00 00 00 00 00 00
   1.915127 [D3] read: F0 00 00 00 00 00 00 00
   1.928121 [D3] read: F0 00 00 00 00 00 00 00
   1.941124 [D3] read: F0 00 00 00 00 00 00 00
   1.954121 [D3] read: F0 00 00 00 00 00 00 00
   1.967118 [D3] read: F0 00 00 00 00 00 00 00
   1.980117 [D3] read: F0 00 00 00 00 00 00 00
   1.993120 [D3] read: F0 00 00 00 00 00 00 00
   2.006139 [D3] read: F0 00 00 00 00 00 00 00
   2.019118 [D3] read: F0 00 00 00 00 00 00 00
   2.032116 [D3] read: F0 00 00 00 00 00 00 00
   2.045125 [D3] read: F0 00 00 00 00 00 00 00
   2.058122 [D3] read: F0 00 00 00 00 00 00 00
   2.071116 [D3] read: F0 00 00 00 00 00 00 00
   2.084125 [D3] read: F0 00 00 00 00 00 00 00
   2.097115 [D3] read: F0 00 00 00 00 00 00 00
   2.110120 [D3] read: F0 00 00 00 00 00 00 00
   2.123103 [D3] read: F0 00 00 00 00 00 00 00
   2.136109 [D3] read: F0 00 00 00 00 00 00 00
   2.149118 [D3] read: F0 00 00 00 00 00 00 00
   2.162110 [D3] read: F0 00 00 00 00 00 00 00
   2.175111 [D3] read: F0 00 00 00 00 00 00 00
   2.188123 [D3] read: F0 00 00 00 00 00 00 00
   2.201122 [D3] read: F0 00 00 00 00 00 00 00
   2.214123 [D3] read: F0 00 00 00 00 00 00 00
   2.227111 [D3] read: F0 00 00 00 00 00 00 00
   2.240107 [D3] read: F0 00 00 00 00 00 00 00
   2.253109 [D3] read: F0 00 00 00 00 00 00 00
   2.266295 [D3] read: F0 00 00 00 00 00 00 00
   2.279106 [D3] read: F0 00 00 00 00 00 00 00
   2.292109 [D3] read: F0 00 00 00 00 00 00 00
   2.305102 [D3] read: F0 00 00 00 00 00 00 00
   2.318107 [D3] read: F0 00 00 00 00 00 00 00
   2.331111 [D3] read: F0 00 00 00 00 00 00 00
   2.344110 [D3] read: F0 00 00 00 00 00 00 00
   2.357116 [D3] read: F0 00 00 00 00 00 00 00
   2.370104 [D3] read: F0 00 00 00 00 00 00 00
   2.383105 [D3] read: F0 00 00 00 00 00 00 00
   2.396114 [D3] read: F0 00 00 00 00 00 00 00
   2.409112 [D3] read: F0 00 00 00 00 00 00 00
   2.422114 [D3] read: F0 00 00 00 00 00 00 00
   2.435109 [D3] read: F0 00 00 00 00 00 00 00
   2.448111 [D3] read: F0 00 00 00 00 00 00 00
   2.461103 [D3] read: F0 00 00 00 00 00 00 00
   2.474103 [D3] read: F0 00 00 00 00 00 00 00
   2.487101 [D3] read: F0 00 00 00 00 00 00 00
   2.500103 [D3] read: F0 00 00 00 00 00 00 00
   2.513099 [D3] read: F0 00 00 00 00 00 00 00
   2.526097 [D3] read: F0 00 00 00 00 00 00 00
   2.539100 [D3] read: F0 00 00 00 00 00 00 00
   2.552093 [D3] read: F0 00 00 00 00 00 00 00
   2.565097 [D3] read: F0 00 00 00 00 00 00 00
   2.578094 [D3] read: F0 00 00 00 00 00 00 00
   2.591281 [D3] read: F0 00 00 00 00 00 00 00
   2.605097 [D3] read: F0 00 00 00 00 00 00 00
   2.618093 [D3] read: F0 00 00 00 00 00 00 00
   2.631100 [D3] read: F0 00 00 00 00 00 00 00
   2.644106 [D3] read: F0 00 00 00 00 00 00 00
   2.657105 [D3] read: F0 00 00 00 00 00 00 00
   2.670097 [D3] read: F0 00 00 00 00 00 00 00
   2.683094 [D3] read: F0 00 00 00 00 00 00 00
   2.696096 [D3] read: F0 00 00 00 00 00 00 00
   2.709092 [D3] read: F0 00 00 00 00 00 00 00
   2.722132 [D3] read: F0 00 00 00 00 00 00 00
   2.735106 [D3] read: F0 00 00 00 00 00 00 00
   2.748096 [D3] read: F0 00 00 00 00 00 00 00
   2.761090 [D3] read: F0 00 00 00 00 00 00 00
   2.774094 [D3] read: F0 00 00 00 00 00 00 00
   2.787094 [D3] read: F0 00 00 00 00 00 00 00
   2.800086 [D3] read: F0 00 00 00 00 00 00 00
   2.813089 [D3] read: F0 00 00 00 00 00 00 00
   2.826094 [D3] read: F0 00 00 00 00 00 00 00
   2.839085 [D3] read: F0 00 00 00 00 00 00 00
   2.852096 [D3] read: F0 00 00 00 00 00 00 00
   2.865085 [D3] read: F0 00 00 00 00 00 00 00
   2.878087 [D3] read: F0 00 00 00 00 00 00 00
   2.891085 [D3] read: F0 00 00 00 00 00 00 00
   2.904085 [D3] read: F0 00 00 00 00 00 00 00
   2.917092 [D3] read: F0 00 00 00 00 00 00 00
   2.930093 [D3] read: F0 00 00 00 00 00 00 00
   2.943218 [D3] read: F0 00 00 00 00 00 00 00
   2.956097 [D3] read: F0 00 00 00 00 00 00 00
   2.969085 [D3] read: F0 00 00 00 00 00 00 00
   2.982093 [D3] read: F0 00 00 00 00 00 00 00
   2.995090 [D3] read: F0 00 00 00 00 00 00 00
   3.008092 [D3] read: F0 00 00 00 00 00 00 00
   3.021085 [D3] read: F0 00 00 00 00 00 00 00
   3.034094 [D3] read: F0 00 00 00 00 00 00 00
   3.047084 [D3] read: F0 00 00 00 00 00 00 00
   3.060085 [D3] read: F0 00 00 00 00 00 00 00
   3.073081 [D3] read: F0 00 00 00 00 00 00 00
   3.086082 [D3] read: F0 00 00 00 00 00 00 00
   3.099085 [D3] read: F0 00 00 00 00 00 00 00
   3.112080 [D3] read: F0 00 00 00 00 00 00 00
   3.125080 [D3] read: F0 00 00 00 00 00 00 00
   3.138089 [D3] read: F0 00 00 00 00 00 00 00
   3.151082 [D3] read: F0 00 00 00 00 00 00 00
   3.164081 [D3] read: F0 00 00 00 00 00 00 00
   3.177080 [D3] read: F0 00 00 00 00 00 00 00
   3.190083 [D3] read: F0 00 00 00 00 00 00 00
   3.203080 [D3] read: F0 00 00 00 00 00 00 00
   3.216078 [D3] read: F0 00 00 00 00 00 00 00
   3.229086 [D3] read: F0 00 00 00 00 00 00 00
   3.242073 [D3] read: F0 00 00 00 00 00 00 00
   3.255085 [D3] read: F0 00 00 00 00 00 00 00
   3.268073 [D3] read: F0 00 00 00 00 00 00 00
   3.281076 [D3] read: F0 00 00 00 00 00 00 00
   3.294081 [D3] read: F0 00 00 00 00 00 00 00
   3.307077 [D3] read: F0 00 00 00 00 00 00 00
   3.320082 [D3] read: F0 00 00 00 00 00 00 00
   3.333072 [D3] read: F0 00 00 00 00 00 00 00
   3.346070 [D3] read: F0 00 00 00 00 00 00 00
   3.359093 [D3] read: F0 00 00 00 00 00 00 00
   3.372073 [D3] read: F0 00 00 00 00 00 00 00
   3.385071 [D3] read: F0 00 00 00 00 00 00 00
   3.398083 [D3] read: F0 00 00 00 00 00 00 00
   3.411078 [D3] read: F0 00 00 00 00 00 00 00
   3.424069 [D3] read: F0 00 00 00 00 00 00 00
   3.437073 [D3] read: F0 00 00 00 00 00 00 00
   3.450068 [D3] read: F0 00 00 00 00 00 00 00
   3.463068 [D3] read: F0 00 00 00 00 00 00 00
   3.476068 [D3] read: F0 00 00 00 00 00 00 00
   3.489074 [D3] read: F0 00 00 00 00 00 00 00
   3.502069 [D3] read: F0 00 00 00 00 00 00 00
   3.515076 [D3] read: F0 00 00 00 00 00 00 00
   3.528075 [D3] read: F0 00 00 00 00 00 00 00
   3.541064 [D3] read: F0 00 00 00 00 00 00 00
   3.554064 [D3] read: F0 00 00 00 00 00 00 00
   3.567066 [D3] read: F0 00 00 00 00 00 00 00
   3.580065 [D3] read: F0 00 00 00 00 00 00 00
   3.593063 [D3] read: F0 00 00 00 00 00 00 00
   3.606064 [D3] read: F0 00 00 00 00 00 00 00
   3.619073 [D3] read: F0 00 00 00 00 00 00 00
   3.632073 [D3] read: F0 00 00 00 00 00 00 00
   3.645070 [D3] read: F0 00 00 00 00 00 00 00
   3.658062 [D3] read: F0 00 00 00 00 00 00 00
   3.671064 [D3] read: F0 00 00 00 00 00 00 00
   3.684062 [D3] read: F0 00 00 00 00 00 00 00
   3.697057 [D3] read: F0 00 00 00 00 00 00 00
   3.710067 [D3] read: F0 00 00 00 00 00 00 00
   3.723058 [D3] read: F0 00 00 00 00 00 00 00
   3.736057 [D3] read: F0 00 00 00 00 00 00 00
   3.749060 [D3] read: F0 00 00 00 00 00 00 00
   3.762056 [D3] read: F0 00 00 00 00 00 00 00
   3.775054 [D3] read: F0 00 00 00 00 00 00 00
   3.788063 [D3] read: F0 00 00 00 00 00 00 00
   3.801061 [D3] read: F0 00 00 00 00 00 00 00
   3.814058 [D3] read: F0 00 00 00 00 00 00 00
   3.827046 [D3] read: F0 00 00 00 00 00 00 00
   3.840055 [D3] read: F0 00 00 00 00 00 00 00
   3.853049 [D3] read: F0 00 00 00 00 00 00 00
   3.866050 [D3] read: F0 00 00 00 00 00 00 00
   3.879052 [D3] read: F0 00 00 00 00 00 00 00
   3.892050 [D3] read: F0 00 00 00 00 00 00 00
   3.905047 [D3] read: F0 00 00 00 00 00 00 00
   3.918053 [D3] read: F0 00 00 00 00 00 00 00
   3.931061 [D3] read: F0 00 00 00 00 00 00 00
   3.944054 [D3] read: F0 00 00 00 00 00 00 00
   3.957062 [D3] read: F0 00 00 00 00 00 00 00
   3.970050 [D3] read: F0 00 00 00 00 00 00 00
   3.983052 [D3] read: F0 00 00 00 00 00 00 00
   3.996054 [D3] read: F0 00 00 00 00 00 00 00
   4.009049 [D3] read: F0 00 00 00 00 00 00 00
   4.022061 [D3] read: F0 00 00 00 00 00 00 00
   4.035056 [D3] read: F0 00 00 00 00 00 00 00
   4.048057 [D3] read: F0 00 00 00 00 00 00 00
   4.061056 [D3] read: F0 00 00 00 00 00 00 00
   4.074053 [D3] read: F0 00 00 00 00 00 00 00
   4.087042 [D3] read: F0 00 00 00 00 00 00 00
   4.100045 [D3] read: F0 00 00 00 00 00 00 00
   4.113050 [D3] read: F0 00 00 00 00 00 00 00
   4.126044 [D3] read: F0 00 00 00 00 00 00 00
   4.139048 [D3] read: F0 00 00 00 00 00 00 00
   4.152058 [D3] read: F0 00 00 00 00 00 00 00
   4.165049 [D3] read: F0 00 00 00 00 00 00 00
   4.178082 [D3] read: F0 00 00 00 00 00 00 00
   4.192055 [D3] read: F0 00 00 00 00 00 00 00
   4.206042 [D3] read: F0 00 00 00 00 00 00 00
   4.219038 [D3] read: F0 00 00 00 00 00 00 00
   4.232041 [D3] read: F0 00 00 00 00 00 00 00
   4.245041 [D3] read: F0 00 00 00 00 00 00 00
   4.258038 [D3] read: F0 00 00 00 00 00 00 00
   4.271032 [D3] read: F0 00 00 00 00 00 00 00
   4.284041 [D3] read: F0 00 00 00 00 00 00 00
   4.297044 [D3] read: F0 00 00 00 00 00 00 00
   4.310041 [D3] read: F0 00 00 00 00 00 00 00
   4.323038 [D3] read: F0 00 00 00 00 00 00 00
   4.336040 [D3] read: F0 00 00 00 00 00 00 00
   4.349037 [D3] read: F0 00 00 00 00 00 00 00
   4.362034 [D3] read: F0 00 00 00 00 00 00 00
   4.362252 [D1] wait_packet reset
   4.372521 [D3] in read: 0
   4.372679 [D3] riello_command ok: 0
   4.372799 [D3] Get identif Ok: read byte: 0
   4.372901 [D2] Communication with UPS established
   4.777133 [D3] send ok
   4.779100 [D3] read: F0 00 00 00 00 00 00 00
   4.792036 [D3] read: F0 00 00 00 00 00 00 00
   4.805017 [D3] read: F0 00 00 00 00 00 00 00
   4.818017 [D3] read: F0 00 00 00 00 00 00 00
   4.831014 [D3] read: F0 00 00 00 00 00 00 00
   4.844020 [D3] read: F0 00 00 00 00 00 00 00
   4.857028 [D3] read: F0 00 00 00 00 00 00 00
   4.870015 [D3] read: F0 00 00 00 00 00 00 00
   4.883024 [D3] read: F0 00 00 00 00 00 00 00
   4.896014 [D3] read: F0 00 00 00 00 00 00 00
   4.909025 [D3] read: F0 00 00 00 00 00 00 00
   4.922014 [D3] read: F0 00 00 00 00 00 00 00
   4.935020 [D3] read: F0 00 00 00 00 00 00 00
   4.948041 [D3] read: F0 00 00 00 00 00 00 00
   4.961018 [D3] read: F0 00 00 00 00 00 00 00
   4.974014 [D3] read: F0 00 00 00 00 00 00 00
   4.987010 [D3] read: F0 00 00 00 00 00 00 00
   5.000012 [D3] read: F0 00 00 00 00 00 00 00
   5.013023 [D3] read: F0 00 00 00 00 00 00 00
   5.026024 [D3] read: F0 00 00 00 00 00 00 00
   5.039021 [D3] read: F0 00 00 00 00 00 00 00
   5.052014 [D3] read: F0 00 00 00 00 00 00 00
   5.065011 [D3] read: F0 00 00 00 00 00 00 00
   5.078015 [D3] read: F0 00 00 00 00 00 00 00
   5.091012 [D3] read: F0 00 00 00 00 00 00 00
   5.104021 [D3] read: F0 00 00 00 00 00 00 00
   5.117018 [D3] read: F0 00 00 00 00 00 00 00
   5.130011 [D3] read: F0 00 00 00 00 00 00 00
   5.143010 [D3] read: F0 00 00 00 00 00 00 00
   5.156015 [D3] read: F0 00 00 00 00 00 00 00
   5.169015 [D3] read: F0 00 00 00 00 00 00 00
   5.182008 [D3] read: F0 00 00 00 00 00 00 00
   5.195017 [D3] read: F0 00 00 00 00 00 00 00
   5.208010 [D3] read: F0 00 00 00 00 00 00 00
   5.221006 [D3] read: F0 00 00 00 00 00 00 00
   5.234007 [D3] read: F0 00 00 00 00 00 00 00
   5.247011 [D3] read: F0 00 00 00 00 00 00 00
   5.260010 [D3] read: F0 00 00 00 00 00 00 00
   5.273009 [D3] read: F0 00 00 00 00 00 00 00
   5.286016 [D3] read: F0 00 00 00 00 00 00 00
   5.299008 [D3] read: F0 00 00 00 00 00 00 00
   5.312008 [D3] read: F0 00 00 00 00 00 00 00
   5.324010 [D3] read: F0 00 00 00 00 00 00 00
   5.336011 [D3] read: F0 00 00 00 00 00 00 00
   5.349002 [D3] read: F0 00 00 00 00 00 00 00
   5.362006 [D3] read: F0 00 00 00 00 00 00 00
   5.375014 [D3] read: F0 00 00 00 00 00 00 00
   5.388003 [D3] read: F0 00 00 00 00 00 00 00
   5.401004 [D3] read: F0 00 00 00 00 00 00 00
   5.414003 [D3] read: F0 00 00 00 00 00 00 00
   5.427002 [D3] read: F0 00 00 00 00 00 00 00
   5.439998 [D3] read: F0 00 00 00 00 00 00 00
   5.452006 [D3] read: F0 00 00 00 00 00 00 00
   5.463998 [D3] read: F0 00 00 00 00 00 00 00
   5.476004 [D3] read: F0 00 00 00 00 00 00 00
   5.488004 [D3] read: F0 00 00 00 00 00 00 00
   5.500996 [D3] read: F0 00 00 00 00 00 00 00
   5.513994 [D3] read: F0 00 00 00 00 00 00 00
   5.527009 [D3] read: F0 00 00 00 00 00 00 00
   5.539998 [D3] read: F0 00 00 00 00 00 00 00
   5.552996 [D3] read: F0 00 00 00 00 00 00 00
   5.566002 [D3] read: F0 00 00 00 00 00 00 00
   5.578994 [D3] read: F0 00 00 00 00 00 00 00
   5.591995 [D3] read: F0 00 00 00 00 00 00 00
   5.603990 [D3] read: F0 00 00 00 00 00 00 00
   5.616992 [D3] read: F0 00 00 00 00 00 00 00
   5.629999 [D3] read: F0 00 00 00 00 00 00 00
   5.642994 [D3] read: F0 00 00 00 00 00 00 00
   5.655995 [D3] read: F0 00 00 00 00 00 00 00
   5.669135 [D3] read: F0 00 00 00 00 00 00 00
   5.681999 [D3] read: F0 00 00 00 00 00 00 00
   5.695005 [D3] read: F0 00 00 00 00 00 00 00
   5.707995 [D3] read: F0 00 00 00 00 00 00 00
   5.720989 [D3] read: F0 00 00 00 00 00 00 00
   5.733995 [D3] read: F0 00 00 00 00 00 00 00
   5.746984 [D3] read: F0 00 00 00 00 00 00 00
   5.759988 [D3] read: F0 00 00 00 00 00 00 00
   5.772997 [D3] read: F0 00 00 00 00 00 00 00
   5.786020 [D3] read: F0 00 00 00 00 00 00 00
   5.798991 [D3] read: F0 00 00 00 00 00 00 00
   5.811987 [D3] read: F0 00 00 00 00 00 00 00
   5.824982 [D3] read: F0 00 00 00 00 00 00 00
   5.837984 [D3] read: F0 00 00 00 00 00 00 00
   5.850986 [D3] read: F0 00 00 00 00 00 00 00
   5.863982 [D3] read: F0 00 00 00 00 00 00 00
   5.876985 [D3] read: F0 00 00 00 00 00 00 00
   5.889981 [D3] read: F0 00 00 00 00 00 00 00
   5.902980 [D3] read: F0 00 00 00 00 00 00 00
   5.915984 [D3] read: F0 00 00 00 00 00 00 00
   5.928979 [D3] read: F0 00 00 00 00 00 00 00
   5.941981 [D3] read: F0 00 00 00 00 00 00 00
   5.954984 [D3] read: F0 00 00 00 00 00 00 00
   5.967981 [D3] read: F0 00 00 00 00 00 00 00
   5.980978 [D3] read: F0 00 00 00 00 00 00 00
   5.993983 [D3] read: F0 00 00 00 00 00 00 00
   6.006976 [D3] read: F0 00 00 00 00 00 00 00
   6.019985 [D3] read: F0 00 00 00 00 00 00 00
   6.032980 [D3] read: F0 00 00 00 00 00 00 00
   6.045979 [D3] read: F0 00 00 00 00 00 00 00
   6.058978 [D3] read: F0 00 00 00 00 00 00 00
   6.071986 [D3] read: F0 00 00 00 00 00 00 00
   6.084981 [D3] read: F0 00 00 00 00 00 00 00
   6.097983 [D3] read: F0 00 00 00 00 00 00 00
   6.110984 [D3] read: F0 00 00 00 00 00 00 00
   6.123987 [D3] read: F0 00 00 00 00 00 00 00
   6.136993 [D3] read: F0 00 00 00 00 00 00 00
   6.149982 [D3] read: F0 00 00 00 00 00 00 00
   6.162981 [D3] read: F0 00 00 00 00 00 00 00
   6.175978 [D3] read: F0 00 00 00 00 00 00 00
   6.188978 [D3] read: F0 00 00 00 00 00 00 00
   6.201978 [D3] read: F0 00 00 00 00 00 00 00
   6.215978 [D3] read: F0 00 00 00 00 00 00 00
   6.228988 [D3] read: F0 00 00 00 00 00 00 00
   6.241982 [D3] read: F0 00 00 00 00 00 00 00
   6.254977 [D3] read: F0 00 00 00 00 00 00 00
   6.267975 [D3] read: F0 00 00 00 00 00 00 00
   6.280975 [D3] read: F0 00 00 00 00 00 00 00
   6.293976 [D3] read: F0 00 00 00 00 00 00 00
   6.306974 [D3] read: F0 00 00 00 00 00 00 00
   6.320007 [D3] read: F0 00 00 00 00 00 00 00
   6.332969 [D3] read: F0 00 00 00 00 00 00 00
   6.344969 [D3] read: F0 00 00 00 00 00 00 00
   6.357976 [D3] read: F0 00 00 00 00 00 00 00
   6.370973 [D3] read: F0 00 00 00 00 00 00 00
   6.383970 [D3] read: F0 00 00 00 00 00 00 00
   6.396967 [D3] read: F0 00 00 00 00 00 00 00
   6.409969 [D3] read: F0 00 00 00 00 00 00 00
   6.422970 [D3] read: F0 00 00 00 00 00 00 00
   6.435972 [D3] read: F0 00 00 00 00 00 00 00
   6.448985 [D3] read: F0 00 00 00 00 00 00 00
   6.461977 [D3] read: F0 00 00 00 00 00 00 00
   6.474972 [D3] read: F0 00 00 00 00 00 00 00
   6.487967 [D3] read: F0 00 00 00 00 00 00 00
   6.500967 [D3] read: F0 00 00 00 00 00 00 00
   6.513976 [D3] read: F0 00 00 00 00 00 00 00
   6.526979 [D3] read: F0 00 00 00 00 00 00 00
   6.539984 [D3] read: F0 00 00 00 00 00 00 00
   6.552975 [D3] read: F0 00 00 00 00 00 00 00
   6.565965 [D3] read: F0 00 00 00 00 00 00 00
   6.578964 [D3] read: F0 00 00 00 00 00 00 00
   6.591973 [D3] read: F0 00 00 00 00 00 00 00
   6.604975 [D3] read: F0 00 00 00 00 00 00 00
   6.617972 [D3] read: F0 00 00 00 00 00 00 00
   6.630976 [D3] read: F0 00 00 00 00 00 00 00
   6.643976 [D3] read: F0 00 00 00 00 00 00 00
   6.656963 [D3] read: F0 00 00 00 00 00 00 00
   6.669969 [D3] read: F0 00 00 00 00 00 00 00
   6.682959 [D3] read: F0 00 00 00 00 00 00 00
   6.695978 [D3] read: F0 00 00 00 00 00 00 00
   6.708964 [D3] read: F0 00 00 00 00 00 00 00
   6.721966 [D3] read: F0 00 00 00 00 00 00 00
   6.734970 [D3] read: F0 00 00 00 00 00 00 00
   6.747959 [D3] read: F0 00 00 00 00 00 00 00
   6.760956 [D3] read: F0 00 00 00 00 00 00 00
   6.773961 [D3] read: F0 00 00 00 00 00 00 00
   6.786960 [D3] read: F0 00 00 00 00 00 00 00
   6.799957 [D3] read: F0 00 00 00 00 00 00 00
   6.812956 [D3] read: F0 00 00 00 00 00 00 00
   6.825973 [D3] read: F0 00 00 00 00 00 00 00
   6.838960 [D3] read: F0 00 00 00 00 00 00 00
   6.851960 [D3] read: F0 00 00 00 00 00 00 00
   6.864956 [D3] read: F0 00 00 00 00 00 00 00
   6.877971 [D3] read: F0 00 00 00 00 00 00 00
   6.890957 [D3] read: F0 00 00 00 00 00 00 00
   6.903955 [D3] read: F0 00 00 00 00 00 00 00
   6.916955 [D3] read: F0 00 00 00 00 00 00 00
   6.929956 [D3] read: F0 00 00 00 00 00 00 00
   6.942955 [D3] read: F0 00 00 00 00 00 00 00
   6.955954 [D3] read: F0 00 00 00 00 00 00 00
   6.968960 [D3] read: F0 00 00 00 00 00 00 00
   6.981954 [D3] read: F0 00 00 00 00 00 00 00
   6.994954 [D3] read: F0 00 00 00 00 00 00 00
   7.007952 [D3] read: F0 00 00 00 00 00 00 00
   7.020950 [D3] read: F0 00 00 00 00 00 00 00
   7.033951 [D3] read: F0 00 00 00 00 00 00 00
   7.046951 [D3] read: F0 00 00 00 00 00 00 00
   7.059952 [D3] read: F0 00 00 00 00 00 00 00
   7.072945 [D3] read: F0 00 00 00 00 00 00 00
   7.085949 [D3] read: F0 00 00 00 00 00 00 00
   7.098947 [D3] read: F0 00 00 00 00 00 00 00
   7.111946 [D3] read: F0 00 00 00 00 00 00 00
   7.124948 [D3] read: F0 00 00 00 00 00 00 00
   7.137954 [D3] read: F0 00 00 00 00 00 00 00
   7.150941 [D3] read: F0 00 00 00 00 00 00 00
   7.163949 [D3] read: F0 00 00 00 00 00 00 00
   7.176943 [D3] read: F0 00 00 00 00 00 00 00
   7.189946 [D3] read: F0 00 00 00 00 00 00 00
   7.202945 [D3] read: F0 00 00 00 00 00 00 00
   7.215943 [D3] read: F0 00 00 00 00 00 00 00
   7.228958 [D3] read: F0 00 00 00 00 00 00 00
   7.241948 [D3] read: F0 00 00 00 00 00 00 00
   7.254945 [D3] read: F0 00 00 00 00 00 00 00
   7.267943 [D3] read: F0 00 00 00 00 00 00 00
   7.280938 [D3] read: F0 00 00 00 00 00 00 00
   7.293936 [D3] read: F0 00 00 00 00 00 00 00
   7.305937 [D3] read: F0 00 00 00 00 00 00 00
   7.318933 [D3] read: F0 00 00 00 00 00 00 00
   7.331936 [D3] read: F0 00 00 00 00 00 00 00
   7.344932 [D3] read: F0 00 00 00 00 00 00 00
   7.357936 [D3] read: F0 00 00 00 00 00 00 00
   7.370939 [D3] read: F0 00 00 00 00 00 00 00
   7.383940 [D3] read: F0 00 00 00 00 00 00 00
   7.396937 [D3] read: F0 00 00 00 00 00 00 00
   7.409933 [D3] read: F0 00 00 00 00 00 00 00
   7.422942 [D3] read: F0 00 00 00 00 00 00 00
   7.435954 [D3] read: F0 00 00 00 00 00 00 00
   7.448932 [D3] read: F0 00 00 00 00 00 00 00
   7.461935 [D3] read: F0 00 00 00 00 00 00 00
   7.474937 [D3] read: F0 00 00 00 00 00 00 00
   7.487938 [D3] read: F0 00 00 00 00 00 00 00
   7.500939 [D3] read: F0 00 00 00 00 00 00 00
   7.513933 [D3] read: F0 00 00 00 00 00 00 00
   7.526929 [D3] read: F0 00 00 00 00 00 00 00
   7.539946 [D3] read: F0 00 00 00 00 00 00 00
   7.552934 [D3] read: F0 00 00 00 00 00 00 00
   7.565928 [D3] read: F0 00 00 00 00 00 00 00
   7.578925 [D3] read: F0 00 00 00 00 00 00 00
   7.591926 [D3] read: F0 00 00 00 00 00 00 00
   7.604932 [D3] read: F0 00 00 00 00 00 00 00
   7.617938 [D3] read: F0 00 00 00 00 00 00 00
   7.630931 [D3] read: F0 00 00 00 00 00 00 00
   7.643932 [D3] read: F0 00 00 00 00 00 00 00
   7.656931 [D3] read: F0 00 00 00 00 00 00 00
   7.669936 [D3] read: F0 00 00 00 00 00 00 00
   7.682940 [D3] read: F0 00 00 00 00 00 00 00
   7.695871 [D3] read: F0 00 00 00 00 00 00 00
   7.708922 [D3] read: F0 00 00 00 00 00 00 00
   7.721934 [D3] read: F0 00 00 00 00 00 00 00
   7.734927 [D3] read: F0 00 00 00 00 00 00 00
   7.747925 [D3] read: F0 00 00 00 00 00 00 00
   7.760916 [D3] read: F0 00 00 00 00 00 00 00
   7.773925 [D3] read: F0 00 00 00 00 00 00 00
   7.786920 [D3] read: F0 00 00 00 00 00 00 00
   7.799921 [D3] read: F0 00 00 00 00 00 00 00
   7.812929 [D3] read: F0 00 00 00 00 00 00 00
   7.825921 [D3] read: F0 00 00 00 00 00 00 00
   7.838920 [D3] read: F0 00 00 00 00 00 00 00
   7.851920 [D3] read: F0 00 00 00 00 00 00 00
   7.864914 [D3] read: F0 00 00 00 00 00 00 00
   7.877931 [D3] read: F0 00 00 00 00 00 00 00
   7.890927 [D3] read: F0 00 00 00 00 00 00 00
   7.903931 [D3] read: F0 00 00 00 00 00 00 00
   7.916925 [D3] read: F0 00 00 00 00 00 00 00
   7.929925 [D3] read: F0 00 00 00 00 00 00 00
   7.942930 [D3] read: F0 00 00 00 00 00 00 00
   7.955961 [D3] read: F0 00 00 00 00 00 00 00
   7.968915 [D3] read: F0 00 00 00 00 00 00 00
   7.981912 [D3] read: F0 00 00 00 00 00 00 00
   7.994922 [D3] read: F0 00 00 00 00 00 00 00
   8.007935 [D3] read: F0 00 00 00 00 00 00 00
   8.020920 [D3] read: F0 00 00 00 00 00 00 00
   8.033918 [D3] read: F0 00 00 00 00 00 00 00
   8.047918 [D3] read: F0 00 00 00 00 00 00 00
   8.060917 [D3] read: F0 00 00 00 00 00 00 00
   8.073913 [D3] read: F0 00 00 00 00 00 00 00
   8.086908 [D3] read: F0 00 00 00 00 00 00 00
   8.099955 [D3] read: F0 00 00 00 00 00 00 00
   8.112910 [D3] read: F0 00 00 00 00 00 00 00
   8.125910 [D3] read: F0 00 00 00 00 00 00 00
   8.138915 [D3] read: F0 00 00 00 00 00 00 00
   8.151917 [D3] read: F0 00 00 00 00 00 00 00
   8.164910 [D3] read: F0 00 00 00 00 00 00 00
   8.177920 [D3] read: F0 00 00 00 00 00 00 00
   8.190900 [D3] read: F0 00 00 00 00 00 00 00
   8.203917 [D3] read: F0 00 00 00 00 00 00 00
   8.216914 [D3] read: F0 00 00 00 00 00 00 00
   8.229907 [D3] read: F0 00 00 00 00 00 00 00
   8.242920 [D3] read: F0 00 00 00 00 00 00 00
   8.255905 [D3] read: F0 00 00 00 00 00 00 00
   8.268915 [D3] read: F0 00 00 00 00 00 00 00
   8.281914 [D3] read: F0 00 00 00 00 00 00 00
   8.294905 [D3] read: F0 00 00 00 00 00 00 00
   8.307906 [D3] read: F0 00 00 00 00 00 00 00
   8.320913 [D3] read: F0 00 00 00 00 00 00 00
   8.333908 [D3] read: F0 00 00 00 00 00 00 00
   8.346905 [D3] read: F0 00 00 00 00 00 00 00
   8.359902 [D3] read: F0 00 00 00 00 00 00 00
   8.372911 [D3] read: F0 00 00 00 00 00 00 00
   8.385903 [D3] read: F0 00 00 00 00 00 00 00
   8.398900 [D3] read: F0 00 00 00 00 00 00 00
   8.411909 [D3] read: F0 00 00 00 00 00 00 00
   8.424899 [D3] read: F0 00 00 00 00 00 00 00
   8.437909 [D3] read: F0 00 00 00 00 00 00 00
   8.450902 [D3] read: F0 00 00 00 00 00 00 00
   8.463901 [D3] read: F0 00 00 00 00 00 00 00
   8.476921 [D3] read: F0 00 00 00 00 00 00 00
   8.489902 [D3] read: F0 00 00 00 00 00 00 00
   8.502900 [D3] read: F0 00 00 00 00 00 00 00
   8.515900 [D3] read: F0 00 00 00 00 00 00 00
   8.528909 [D3] read: F0 00 00 00 00 00 00 00
   8.541901 [D3] read: F0 00 00 00 00 00 00 00
   8.554897 [D3] read: F0 00 00 00 00 00 00 00
   8.567898 [D3] read: F0 00 00 00 00 00 00 00
   8.580898 [D3] read: F0 00 00 00 00 00 00 00
   8.593892 [D3] read: F0 00 00 00 00 00 00 00
   8.606899 [D3] read: F0 00 00 00 00 00 00 00
   8.619920 [D3] read: F0 00 00 00 00 00 00 00
   8.632892 [D3] read: F0 00 00 00 00 00 00 00
   8.645897 [D3] read: F0 00 00 00 00 00 00 00
   8.659906 [D3] read: F0 00 00 00 00 00 00 00
   8.672903 [D3] read: F0 00 00 00 00 00 00 00
   8.673310 [D1] wait_packet reset
   8.684386 [D3] in read: 0
   8.684552 [D3] riello_command ok: 0
   8.684667 [D3] Get nominal Ok: read byte: 0
riello_usb: riello.c:460: riello_parse_gn: Assertion `pom_long < UINT16_MAX' failed.
Aborted

Using voltronic-qs-hex:

root@31f031de2ea6:/# cat /nut/etc/ups.conf
[NobreakZenith]
        driver = nutdrv_qx
        port = auto
        desc = "Nobreak Zenith"
        subdriver = "cypress"
        protocol = "voltronic-qs-hex"
        vendorid = 04b4
        productid = "5500"
        sdorder = -1

But no sucess:

root@31f031de2ea6:/# /nut/bin/nutdrv_qx -a NobreakZenith -DDD      
Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-signed)
USB communication driver (libusb 1.0) 0.43
   0.000000 [D1] debug level is '3'
   0.002634 [D1] upsdrv_initups...
   0.024123 [D2] Checking device 1 of 4 (04B4/5500)
   0.039657 [D2] - VendorID: 04b4
   0.039897 [D2] - ProductID: 5500
   0.040095 [D2] - Manufacturer: Cypress Semiconductor
   0.040229 [D2] - Product: USB to Serial
   0.040398 [D2] - Serial Number: unknown
   0.040588 [D2] - Bus: 001
   0.040708 [D2] - Device: unknown
   0.042285 [D2] - Device release number: 0000
   0.042405 [D2] Trying to match device
   0.042983 [D3] match_function_regex: matching a device...
   0.044101 [D2] Device matches
   0.044202 [D2] Reading first configuration descriptor
   0.044468 [D3] libusb_kernel_driver_active() returned 0
   0.045206 [D2] Claimed interface 0 successfully
   0.045554 [D3] nut_usb_set_altinterface: skipped libusb_set_interface_alt_setting(udev, 0, 0)
   0.045803 [D2] Skipping protocol Voltronic 0.06
   0.046014 [D2] Skipping protocol Voltronic-QS 0.07
   0.047469 [D3] send: M
   0.175087 [D3] read: �
   0.175482 [D2] voltronic_qs_hex_protocol: invalid protocol [�]
   0.177592 [D3] send: M
   0.305100 [D3] read: �
   0.305632 [D2] voltronic_qs_hex_protocol: invalid protocol [�]
   0.308152 [D3] send: M
   0.435089 [D3] read: �
   0.436203 [D2] voltronic_qs_hex_protocol: invalid protocol [�]
   0.436376 [D2] Skipping protocol Mustek 0.07
   0.436522 [D2] Skipping protocol Megatec/old 0.07
   0.436628 [D2] Skipping protocol BestUPS 0.06
   0.436734 [D2] Skipping protocol Mecer 0.07
   0.436834 [D2] Skipping protocol Megatec 0.06
   0.437014 [D2] Skipping protocol Zinto 0.06
   0.437379 [D2] Skipping protocol Masterguard 0.02
   0.437511 [D2] Skipping protocol Hunnox 0.01
   0.437614 [D2] Skipping protocol Ablerex 0.01
   0.437714 [D2] Skipping protocol Q1 0.07
   0.437820 Device not supported!
   0.437916 Device not supported!
leleobhz commented 1 year ago

@jimklimov

Since this nobreak uses a Serial USB adapter, nut-scanner does have anyway to check only serial ports? In the help, there is only a eaton option (-E).

Also, there is something I can do to help the troubleshooting?

leleobhz commented 1 year ago

@jimklimov hello!

Hacking a bit with Official SMS application, i found a file called upsilon.xml and opening serial port with screen /dev/ttyUSB0 2400, commands Q\n and I\n got results! (Commands from file voltronic.xml does not works).

This is the file about upsilon upsilon.xml.txt

This can help to find out why nutdrv_qx did not found my device?

leleobhz commented 1 year ago

Also, now inspecting again the repo, I found https://github.com/networkupstools/nut/blob/master/docs/cables/sms.txt that describes preciselly my Nobreak - but still dont working.

Looking at blazer_ser output, I saw no Q\n got tested:

root@40c72052d126:/# /nut/bin/blazer_ser -a NobreakZenith -DDDD 2>&1 | cat -v
   0.000000 [D1] debug level is '4'
   0.110676 Please note that this driver is deprecated and will not receive
new development. If it works for managing your devices - fine,
but if you are running it to try setting up a new device, please
consider the newer nutdrv_qx instead, which should handle all 'Qx'
protocol variants for NUT. (Please also report if your device works
with this driver, but nutdrv_qx would not actually support it with
any subdriver!)

   0.110785 [D2] Trying megatec protocol...
   0.111124 [D3] send: 'Q1'
   1.112307 [D3] read: timeout
   1.112405 [D2] blazer_status: short reply
   1.112441 [D2] Status read 1 failed
   1.113355 [D3] send: 'Q1'
   1.203021 [D3] read: '=^E^T^E^T^Dj^A^D^BX^CM-h^AM-^Z^H6'
   1.203117 [D2] blazer_status: short reply
   1.203167 [D2] Status read 2 failed
   1.203574 [D3] send: 'Q1'
   2.204792 [D3] read: timeout
   2.204909 [D2] blazer_status: short reply
   2.204945 [D2] Status read 3 failed
   2.204978 [D2] Trying mustek protocol...
   2.205455 [D3] send: 'QS'
   3.206641 [D3] read: timeout
   3.206742 [D2] blazer_status: short reply
   3.206801 [D2] Status read 1 failed
   3.207153 [D3] send: 'QS'
   3.296901 [D3] read: '=^E^T^E^T^Dj'
   3.296999 [D2] blazer_status: short reply
   3.297035 [D2] Status read 2 failed
   3.297563 [D3] send: 'QS'
   4.298801 [D3] read: timeout
   4.298906 [D2] blazer_status: short reply
   4.298951 [D2] Status read 3 failed
   4.298985 [D2] Trying megatec/old protocol...
   4.299398 [D3] send: 'D'
   5.300587 [D3] read: timeout
   5.300676 [D2] blazer_status: short reply
   5.300739 [D2] Status read 1 failed
   5.301108 [D3] send: 'D'
   5.385844 [D3] read: '=^E^T^E^T^D`'
   5.385959 [D2] blazer_status: short reply
   5.385995 [D2] Status read 2 failed
   5.386878 [D3] send: 'D'
   6.388076 [D3] read: timeout
   6.388178 [D2] blazer_status: short reply
   6.388213 [D2] Status read 3 failed
   6.388255 [D2] Trying zinto protocol...
   6.388598 [D3] send: 'Q1'
   7.389800 [D3] read: timeout
   7.389924 [D2] blazer_status: short reply
   7.389960 [D2] Status read 1 failed
   7.390697 [D3] send: 'Q1'
   8.393147 [D3] read: timeout
   8.393237 [D2] blazer_status: short reply
   8.393288 [D2] Status read 2 failed
   8.393778 [D3] send: 'Q1'
   9.394999 [D3] read: timeout
   9.395102 [D2] blazer_status: short reply
   9.395147 [D2] Status read 3 failed
   9.395200 No supported UPS detected
Network UPS Tools - Megatec/Q1 protocol serial driver 1.58 (2.8.0-signed)

May this nobreak have a kind of "old" upsilon protocol?

EDIT: | cat -v

jimklimov commented 1 year ago

Got one more idea: try with port=/dev/ttyUSB0 (and no/commented-away vendorid/productid) so it tries the serial-port protocol right away over the OS-driver data encapsulation handling.

leleobhz commented 1 year ago

Got one more idea: try with port=/dev/ttyUSB0 (and no/commented-away vendorid/productid) so it tries the serial-port protocol right away over the OS-driver data encapsulation handling.

Hello @jimklimov

This is the output:

cat /nut/etc/ups.conf

[NobreakZenith]
        driver = nutdrv_qx
        port = /dev/ttyUSB0
        desc = "Nobreak Zenith"
        sdorder = -1

/nut/bin/nutdrv_qx -a NobreakZenith -DDD

Network UPS Tools - Generic Q* USB/Serial driver 0.32 (2.8.0-signed)
USB communication driver (libusb 1.0) 0.43
   0.000000 [D1] debug level is '3'
   0.003901 [D1] upsdrv_initups...
   0.109930 [D3] send: 'QGS'
   0.204329 [D3] read: '=��BX��'
   0.204732 [D2] qx_process_answer: short reply (input.voltage)
   0.205580 [D3] send: 'QGS'
   1.207173 [D3] read: timeout (0)
   1.207589 [D2] qx_process_answer: short reply (input.voltage)
   1.208235 [D3] send: 'QGS'
   1.239221 [D3] read: '=
'
   1.239723 [D2] qx_process_answer: short reply (input.voltage)
   1.241274 [D3] send: 'M'
   1.302234 [D3] read: 'VX�r'
   1.302399 [D2] voltronic_qs_protocol: invalid protocol [VX�r]
   1.303043 [D3] send: 'M'
   2.304324 [D3] read: timeout (0)
   2.304509 [D2] qx_process_answer: short reply (ups.firmware.aux)
   2.304930 [D3] send: 'M'
   3.306190 [D3] read: timeout (0)
   3.306356 [D2] qx_process_answer: short reply (ups.firmware.aux)
   3.307177 [D3] send: 'M'
   4.308446 [D3] read: timeout (0)
   4.308613 [D2] qx_process_answer: short reply (ups.firmware.aux)
   4.309116 [D3] send: 'M'
   5.310370 [D3] read: timeout (0)
   5.310550 [D2] qx_process_answer: short reply (ups.firmware.aux)
   5.311290 [D3] send: 'M'
   6.312549 [D3] read: timeout (0)
   6.312718 [D2] qx_process_answer: short reply (ups.firmware.aux)
   6.313150 [D3] send: 'QS'
   7.314414 [D3] read: timeout (0)
   7.314583 [D2] qx_process_answer: short reply (input.voltage)
   7.315012 [D3] send: 'QS'
   8.316271 [D3] read: timeout (0)
   8.316439 [D2] qx_process_answer: short reply (input.voltage)
   8.316862 [D3] send: 'QS'
   9.318111 [D3] read: timeout (0)
   9.318277 [D2] qx_process_answer: short reply (input.voltage)
   9.318691 [D3] send: 'D'
   9.403959 [D3] read: '=��VX��'
   9.404122 [D2] qx_process_answer: short reply (input.voltage)
   9.404720 [D3] send: 'D'
  10.405968 [D3] read: timeout (0)
  10.406141 [D2] qx_process_answer: short reply (input.voltage)
  10.406541 [D3] send: 'D'
  11.407809 [D3] read: timeout (0)
  11.407980 [D2] qx_process_answer: short reply (input.voltage)
  11.408507 [D3] send: 'Q1'
  12.409757 [D3] read: timeout (0)
  12.409930 [D2] qx_process_answer: short reply (input.voltage)
  12.410986 [D3] send: 'Q1'
  13.412304 [D3] read: timeout (0)
  13.412483 [D2] qx_process_answer: short reply (input.voltage)
  13.413054 [D3] send: 'Q1'
  14.414300 [D3] read: timeout (0)
  14.414471 [D2] qx_process_answer: short reply (input.voltage)
  14.414902 [D3] send: 'Q1'
  14.504796 [D3] read: '=��VX��'
  14.504962 [D2] qx_process_answer: short reply (input.voltage)
  14.505375 [D3] send: 'Q1'
  15.506632 [D3] read: timeout (0)
  15.506824 [D2] qx_process_answer: short reply (input.voltage)
  15.507245 [D3] send: 'Q1'
  16.508511 [D3] read: timeout (0)
  16.508685 [D2] qx_process_answer: short reply (input.voltage)
  16.509102 [D3] send: 'Q1'
  16.535701 [D3] read: '=
'
  16.535878 [D2] qx_process_answer: short reply (input.voltage)
  16.536324 [D3] send: 'Q1'
  16.598700 [D3] read: 'X�h'
  16.598859 [D2] qx_process_answer: short reply (input.voltage)
  16.599271 [D3] send: 'Q1'
  17.600517 [D3] read: timeout (0)
  17.600688 [D2] qx_process_answer: short reply (input.voltage)
  17.601102 [D3] send: 'Q1'
  17.690665 [D3] read: '=��BX��'
  17.690830 [D2] qx_process_answer: short reply (input.voltage)
  17.691231 [D3] send: 'Q1'
  18.692476 [D3] read: timeout (0)
  18.692645 [D2] qx_process_answer: short reply (input.voltage)
  18.693047 [D3] send: 'Q1'
  19.694318 [D3] read: timeout (0)
  19.694488 [D2] qx_process_answer: short reply (input.voltage)
  19.694656 [D2] find_nut_info: info type series not found
  19.694784 [D2] claim: cannot find series
  19.694898 [D2] find_nut_info: info type series not found
  19.695003 [D2] claim: cannot find series
  19.695165 [D2] find_nut_info: info type series not found
  19.695320 [D2] claim: cannot find series
  19.695767 [D3] send: 'Q1'
  19.785597 [D3] read: '=��VX��'
  19.785787 [D2] qx_process_answer: short reply (input.voltage)
  19.786278 [D3] send: 'Q1'
  20.787555 [D3] read: timeout (0)
  20.787737 [D2] qx_process_answer: short reply (input.voltage)
  20.788272 [D3] send: 'Q1'
  21.789530 [D3] read: timeout (0)
  21.789718 [D2] qx_process_answer: short reply (input.voltage)
  21.790233 [D3] send: 'Q1'
  21.880537 [D3] read: '=��VX��'
  21.880704 [D2] qx_process_answer: short reply (input.voltage)
  21.881140 [D3] send: 'Q1'
  22.882409 [D3] read: timeout (0)
  22.882607 [D2] qx_process_answer: short reply (input.voltage)
  22.883031 [D3] send: 'Q1'
  23.884295 [D3] read: timeout (0)
  23.884468 [D2] qx_process_answer: short reply (input.voltage)
  23.885562 [D3] send: 'Q1'
  23.911475 [D3] read: '=
'
  23.911680 [D2] qx_process_answer: short reply (input.voltage)
  23.912218 [D3] send: 'Q1'
  23.974452 [D3] read: 'X�r'
  23.974630 [D2] qx_process_answer: short reply (input.voltage)
  23.975231 [D3] send: 'Q1'
  24.976504 [D3] read: timeout (0)
  24.976694 [D2] qx_process_answer: short reply (input.voltage)
  24.976800 Device not supported!
  24.976897 Device not supported!
jimklimov commented 1 year ago

Looking at that python script, looks like it mostly does translation from a megatec-like "Q" protocol to binary queries for the UPS side, posting cmd[v] etc. to the device. So maybe a new NUT driver is in order to handle this device - perhaps a different firmware or even hardware is posted under an older brand/model name?..

jimklimov commented 1 year ago

Although if your test with screen gave a reasonable output as you said, I'm a bit more at a loss. As a wild guess, maybe the driver does not send a \n after the command lines, and other devices don't mind but this one does?..

Such guess so far based on sending a command and getting a timeout in reply (although not always).

So far I've only traced this that the logging cuts off the \n if present, e.g.:

    upsdebugx(3, "send: '%.*s'", (int)strcspn(cmd, "\r"), cmd);
leleobhz commented 1 year ago

Looking at that python script, looks like it mostly does translation from a megatec-like "Q" protocol to binary queries for the UPS side, posting cmd[v] etc. to the device. So maybe a new NUT driver is in order to handle this device - perhaps a different firmware or even hardware is posted under an older brand/model name?..

Hello @jimklimov

This drive was created once in the thread https://nut-upsdev.alioth.debian.narkive.com/bL2wNz3r/nut-driver-for-sms-brazil-ups

About creating a new driver inside nutdrv_qx, how this can be made considering this translation? As you pointed about screen, how is the best way to intercept this communication to device and generate log to you?

Also, the XML I posted here helps with something?

jimklimov commented 1 year ago

Thanks for the link, but it seems that driver's sources are not available anymore. The reference in HCL that the "SMS Manager III" is supported by blazer* drivers is inherited from earlier claim of support by megatec* drivers (which were removed in 2010 and absorbed into blazer*, and now into nutdrv_qx umbrella). Sadly I haven't got any more info about that.

You can see the likes of expected Megatec Qx protocol at https://networkupstools.org/protocols/megatec.html and that document's numerous clones like https://powerman.ru/assets/files/soft/Megatec-single-phase-UPS-protocal.pdf or https://www.upspowercom.com/pcm-download/UPS-Protocol.pdf, or an overview at https://prog.world/ups-emulator-with-megatec-and-voltronic-protocols/ - either way, it is a text-based protocol.

As for that script and possible Qx-Binary translations, there's only so much that I can make of it without a device, nor a long stretch of time to read into it, and with all comments and commands written in Spanish ;)

So while the high-level protocol does seem Q-based, at least in that script the actual serial protocol written and read seems to be based on "magic sequences" and not all of them in ASCII text character range.

jimklimov commented 1 year ago

As for screen, it should have logging. I am not sure how helpful it would be to me (can't personally commit to writing a driver) but might help you if you dare get your feet wet with coding and testing :)

The XML seems to provide a list of commands that are expected to work, so helpful in that at least. I now think some of the errors reported in driver screenshots above may be due to either the device getting confused from unsupported commands (when nutdrv_qx sends various probes to identify the device and protocol), or if it does answer in 32-byte chunks while the driver expects ASCII-like text sessions with line breaks - then the buffer is full with bytes from an older reply as the driver tries to interpret reaction to a newer query?..

leleobhz commented 1 year ago

As for that script and possible Qx-Binary translations, there's only so much that I can make of it without a device, nor a long stretch of time to read into it, and with all comments and commands written in Spanish ;)

Hello @jimklimov

I've asked to author of smsbrasil for the lost code (And with hope to get awnsers). I'll also translate in next days the XML and any code in Portuguese about this Nobreak.

Also I'll try to do a effort with documentation you written before to create a little helper to talk with device. I had some sucess trying to send only Q, but I had to enter QQ a lot of times to get awnser that is not garbage - and the awnser was textual in fact, fact may enforce the case you written either the device getting confused from unsupported commands (when nutdrv_qx sends various probes to identify the device and protocol),

Thank you for you time, I'll try to dig a bit and I'll awnser here with some progress.

jimklimov commented 1 year ago

Thanks for the update, and sorry about mis-identifying the language.

jimklimov commented 1 year ago

Also, I think it could be helpful for experiments to see if that Python script actually talks to your device (is an example of working protocol), e.g. try the container "as is" or to remove web-server parts and replace MQTT posts with sys.stdout.write() to extract just the UPS-related handling.

alexwbaule commented 1 year ago

Hi @leleobhz and @jimklimov

If i can help, i have SMS PREMIUM 1500 VA, get the same XML debuging the powerView. For this version, get a different XML.

For what i see, the PowerView query the UPS to get the correct protocol, i will get some files to post here too.

alexwbaule commented 1 year ago

I will try to make a driver based on skel.c , following the python scripts. Using some python code, i get the model, and some infos.

alexwbaule commented 1 year ago

@leleobhz and @jimklimov i found this: https://github.com/petersenna/nobreakSMS/blob/master/userland/nobreakSMS.c Maybe it can help it ..

alexwbaule commented 1 year ago

its work the nobreakSMS.c,, with some modifications, i can get my SMS status. Captura de tela de 2023-07-26 21-03-43

jimklimov commented 1 year ago

Nice result, congrats! And that driver is also GPLv2 so ok to borrow parts into NUT skel.c layout.

leleobhz commented 1 year ago

its work the nobreakSMS.c,, with some modifications, i can get my SMS status. Captura de tela de 2023-07-26 21-03-43

Hello @alexwbaule

What did you changed in the code? I have sucess fixing the overflow issue but no output:

dietpi@piprinter:~/nobreakSMS/userland$ sudo strace -f  ./nobreakSMS 
execve("./nobreakSMS", ["./nobreakSMS"], 0x7fcb337cd8 /* 13 vars */) = 0
brk(NULL)                               = 0x4f11000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (Arquivo ou diretório inexistente)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=33115, ...}) = 0
mmap(NULL, 33115, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fa0a07000
close(3)                                = 0
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0`\17\2\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1455120, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fa0a05000
mmap(NULL, 1527752, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fa086d000
mprotect(0x7fa09ca000, 61440, PROT_NONE) = 0
mmap(0x7fa09d9000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15c000) = 0x7fa09d9000
mmap(0x7fa09df000, 12232, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fa09df000
close(3)                                = 0
mprotect(0x7fa09d9000, 16384, PROT_READ) = 0
mprotect(0x411000, 4096, PROT_READ)     = 0
mprotect(0x7fa0a13000, 4096, PROT_READ) = 0
munmap(0x7fa0a07000, 33115)             = 0
openat(AT_FDCWD, "/dev/ttyUSB0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
write(3, "Q\377\377\377\377\263\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "", 64)                         = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "", 64)                         = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "=\366\4", 64)                  = 3
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "\366\4B\1", 64)                = 4
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "\30\2X\3", 64)                 = 4
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "\350\1\220\10", 64)            = 4
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "\222\r", 64)                   = 2
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, "", 64)                         = 0

And this way goes forever.

alexwbaule commented 1 year ago

Hi @leleobhz , i change the connection part, get exacly like NUT.

I changed the "open_config_tty" to this:

int open_config_tty(char *tty)
{
    int fd;
    struct termios options;

    options.c_cflag = CS8 | CLOCAL | CREAD;
    options.c_iflag = IGNPAR;
    options.c_oflag = 0;
    options.c_lflag = 0;
    options.c_cc[VMIN] = 1;
    options.c_cc[VTIME] = 0;

    fd = open(tty, O_RDWR | O_NOCTTY | O_EXCL | O_NONBLOCK);
    if (fd == -1)
        return fd; /* ERROR! */

//  fcntl(fd, F_SETFL, 0); /* Block and wait for data */
    fcntl(fd, F_SETFL, FNDELAY); /* Return immediately */

    /* BPS */
    cfsetispeed(&options, BAUDRATE);
    cfsetospeed(&options, BAUDRATE);

    /* APPLY SETTINGS */
    tcflush(fd, TCIFLUSH);
    tcsetattr(fd, TCSANOW, &options);

    return fd;
}

I copy this from serial.c in NUT source code...

At night i will build a driver , following the logic from power view...

alexwbaule commented 1 year ago

@leleobhz

I comment to some parts.

Captura de tela de 2023-07-27 15-40-24

leleobhz commented 1 year ago

I guess is not only a query6 and query4 issue:

openat(AT_FDCWD, "/dev/ttyUSB0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK) = 3
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
ioctl(3, TCFLSH, TCIFLUSH)              = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
write(3, "I\377\377\377\377\273\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fe65175d8) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, 0x7fe6517640, 64)               = -1 EAGAIN (Recurso temporariamente indisponível)
write(3, "Q\377\377\377\377\263\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fe65175d8) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, 0x7fe6517640, 64)               = -1 EAGAIN (Recurso temporariamente indisponível)
write(3, "Q\377\377\377\377\263\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, 0x7fe6517640, 64)               = -1 EAGAIN (Recurso temporariamente indisponível)
dup(2)                                  = 4
fcntl(4, F_GETFL)                       = 0x2 (flags O_RDWR)
brk(NULL)                               = 0x3d3ba000
brk(0x3d3db000)                         = 0x3d3db000
fstat(4, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0), ...}) = 0
write(4, "Error reading tty. : Resource temporarily unavailable\n", 54Error reading tty. : Resource temporarily unavailable
) = 54
close(4)                                = 0
exit_group(-1)                          = ?
+++ exited with 255 +++

And commenting sanity check:

openat(AT_FDCWD, "/dev/ttyUSB0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK) = 3
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
ioctl(3, TCFLSH, TCIFLUSH)              = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
write(3, "I\377\377\377\377\273\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fd1f1a548) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, 0x7fd1f1a4b0, 64)               = -1 EAGAIN (Recurso temporariamente indisponível)
write(3, "Q\377\377\377\377\263\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fd1f1a548) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, 0x7fd1f1a4b0, 64)               = -1 EAGAIN (Recurso temporariamente indisponível)
close(3)                                = 0
fstat(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(0x88, 0), ...}) = 0
brk(NULL)                               = 0x38613000
brk(0x38634000)                         = 0x38634000
write(1, "          Input(Vac):0.00\n", 26          Input(Vac):0.00
) = 26
write(1, "         Output(Vac):0.00\n", 26         Output(Vac):0.00
) = 26
write(1, "     Output Power(%):0.00\n", 26     Output Power(%):0.00
) = 26
write(1, "          Output(Hz):0.00\n", 26          Output(Hz):0.00
) = 26
write(1, "    Battery level(%):0.00\n", 26    Battery level(%):0.00
) = 26
write(1, "      Temperature(C):0.10\n", 26      Temperature(C):0.10
) = 26
write(1, "             Beep on:1\n", 23             Beep on:1
) = 23
write(1, "     Active shutdown:1\n", 23     Active shutdown:1
) = 23
write(1, "         Active test:1\n", 23         Active test:1
) = 23
write(1, "              UPS OK:1\n", 23              UPS OK:1
) = 23
write(1, "            Boost ON:1\n", 23            Boost ON:1
) = 23
write(1, "         On AC Power:1\n", 23         On AC Power:1
) = 23
write(1, "         Low battery:1\n", 23         Low battery:1
) = 23
write(1, "    On battery power:0\n", 23    On battery power:0
) = 23
exit_group(0)                           = ?
+++ exited with 0 +++

But comparing this code to nutdrv_qx, it sounds like a variant of megatron (Not megatron-old) that does not use Q1 but Q only.

alexwbaule commented 1 year ago

The nobreakSMS only treat Query6

In the drive i will check what the protocol to use, like PowerView does (follwing verificaProtocolo.xml) after that, implement the Query to get UPS Name, UPS mesurements, and Shutdown in any protocol. (nonofasico, trifasico, upsilon and voltronic)

I think this is the "MVP" to work.

leleobhz commented 1 year ago

The nobreakSMS only treat Query6

In the drive i will check what the protocol to use, like PowerView does (follwing verificaProtocolo.xml) after that, implement the Query to get UPS Name, UPS mesurements, and Shutdown in any protocol. (nonofasico, trifasico, upsilon and voltronic)

I think this is the "MVP" to work.

@alexwbaule

Keep Q6 did not changed notting here:

openat(AT_FDCWD, "/dev/ttyUSB0", O_RDWR|O_EXCL|O_NOCTTY|O_NONBLOCK) = 3
fcntl(3, F_SETFL, O_RDONLY|O_NONBLOCK)  = 0
ioctl(3, TCFLSH, TCIFLUSH)              = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, SNDCTL_TMR_START or TCSETS, {B2400 -opost -isig -icanon -echo ...}) = 0
ioctl(3, TCGETS, {B2400 -opost -isig -icanon -echo ...}) = 0
write(3, "Q\377\377\377\377\263\r\0", 8) = 8
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=1, tv_nsec=0}, 0x7fde67d438) = 0
clock_nanosleep(CLOCK_REALTIME, 0, {tv_sec=0, tv_nsec=15000000}, NULL) = 0
read(3, 0x7fde67d3a0, 64)               = -1 EAGAIN (Recurso temporariamente indisponível)
close(3)                                = 0

Something tells me this Q coding are not understandable by my UPS - Sadly. I guess the approach you suggested to check XML file and implement may be a good path, but I do not mind how to even start this code.

alexwbaule commented 1 year ago

I will start this, and share my code here... i will fork the nut and we can make some debug together.

jimklimov commented 1 year ago

Sounds like a good idea - making a fork and pushing around the branch(es) (not named "master") with your driver to share the development and testing would help you both avoid the typos in discussion (code in comments or email is a clumsy option nowadays), post references to line ranges of a specific commit/revision in github comments, and to eventually propose a pull request back to main NUT project :)

leleobhz commented 1 year ago

@alexwbaule and @jungeonkim

Indeed. I'm also trying to understand the Q protocol properly. Awnsers from Q requests seems to be caothic, but I was able to send simple requests over serial port, like Q.

My reading is SMS protocol is a mesh of Q implementations but NUT comments about this documentation seems a bit confusing to me - maybe because I don't understood properly the protocol.

If @alexwbaule create a fork with at least a skel, I can test and code exceptions if necessary.

alexwbaule commented 1 year ago

Hi @leleobhz

Forked and started.

https://github.com/alexwbaule/nut/tree/feature/add-support-sms-brazil

Im looking into riello_ser to get some ideias too.

im testing on a ArchLinux, and you are welcome to test, code, etc...

leleobhz commented 1 year ago

Hello @alexwbaule

I made you code available as container to quay.io/pqatsi/docker-nut:add-support-sms-brazil available for amd64 and arm64.

That said, this is a preliminar run of you code:

root@10c704b8f28c:/# cat /nut/etc/ups.conf
[NobreakZenith]
        driver = sms_ser
        port = /dev/ttyUSB0
        desc = "Nobreak Zenith"
        sdorder = -1
root@10c704b8f28c:/# /nut/bin/sms_ser -DDDDD -a NobreakZenith   
Network UPS Tools - SMS Brazil UPS driver 1.00 (2.8.0.1)
upsdrv_makevartable
   0.000305 [D5] do_upsconf_args: confupsname=NobreakZenith, var=driver, val=sms_ser
   0.001303 [D5] do_upsconf_args: call main_arg()
   0.001492 [D3] main_arg: var='driver' val='sms_ser'
   0.001579 [D5] do_upsconf_args: not a main_arg()
   0.001659 [D5] do_upsconf_args: this is a 'driver' setting, may we proceed?
   0.001747 [D5] do_upsconf_args: 'driver' setting already applied with this value
   0.001877 [D5] do_upsconf_args: confupsname=NobreakZenith, var=port, val=/dev/ttyUSB0
   0.004392 [D5] do_upsconf_args: call main_arg()
   0.004717 [D3] main_arg: var='port' val='/dev/ttyUSB0'
   0.005084 [D5] send_to_all: SETINFO driver.parameter.port "/dev/ttyUSB0"
   0.006116 [D5] do_upsconf_args: confupsname=NobreakZenith, var=desc, val=Nobreak Zenith
   0.006543 [D5] do_upsconf_args: call main_arg()
   0.006812 [D3] main_arg: var='desc' val='Nobreak Zenith'
   0.007228 [D5] do_upsconf_args: confupsname=NobreakZenith, var=sdorder, val=-1
   0.007674 [D5] do_upsconf_args: call main_arg()
   0.008817 [D3] main_arg: var='sdorder' val='-1'
   0.009281 [D1] Network UPS Tools version 2.8.0.1 (release/snapshot of 2.8.0.1) built with gcc (Debian 12.2.0-14) 12.2.0 and configured with flags: --prefix=/nut --with-all --with-ssl --with-libltdl --with-wrap
   0.009407 [D1] debug level is '5'
   0.009636 [D5] send_to_all: SETINFO driver.debug "5"
   0.009853 [D5] send_to_all: SETFLAGS driver.debug RW NUMBER
   0.012617 [D1] Succeeded to become_user(nobody): now UID=65534 GID=65534
   0.012946 [D5] send_to_all: SETINFO device.type "ups"
   0.013175 [D5] send_to_all: SETINFO driver.state "init.device"
   0.013365 upsdrv_initups
   0.017773 [D5] send_to_all: SETINFO driver.state "init.quiet"
   0.018037 [D5] send_to_all: SETINFO driver.version "2.8.0.1"
   0.018240 [D5] send_to_all: SETINFO driver.version.internal "1.00"
   0.018486 [D5] send_to_all: SETINFO driver.name "sms_ser"
   0.018837 [D5] send_to_all: SETINFO driver.state "init.info"
   0.019019 upsdrv_initinfo
]:[I�����
Returned: 15
3a4d332053454e4f4944414c20332e00
]:[F�����
Returned: 15
303b3131352f32323030303030313200
]:[Q�����
Returned: 15
363d04f604f60442fa025803e8019000
   0.299067 Short read from UPS
   0.299216 [D5] send_to_all: SETINFO driver.state "init.updateinfo"
   0.299314 upsdrv_updateinfo
   0.299415 [D5] send_to_all: SETINFO driver.state "init.quiet"
   0.300021 [D2] dstate_init: sock /var/state/ups/sms_ser-NobreakZenith open on fd 4
   0.300167 [D5] send_to_all: SETINFO driver.parameter.pollinterval "2"
   0.300280 [D5] send_to_all: SETINFO driver.parameter.synchronous "auto"
   0.300385 Running as foreground process, not saving a PID file
   0.300499 [D5] send_to_all: SETINFO driver.flag.allow_killpower "0"
   0.300626 [D5] send_to_all: SETFLAGS driver.flag.allow_killpower RW NUMBER
   0.300725 [D5] send_to_all: ADDCMD driver.killpower
   0.300836 [D5] send_to_all: ADDCMD driver.reload
   0.300940 [D5] send_to_all: ADDCMD driver.reload-or-exit
   0.301042 [D5] send_to_all: ADDCMD driver.reload-or-error
   0.301148 [D5] send_to_all: SETINFO driver.state "quiet"
   0.301252 [D1] Driver initialization completed, beginning regular infinite loop
   0.301371 [D5] send_to_all: SETINFO driver.state "updateinfo"
   0.301465 upsdrv_updateinfo
   0.301566 [D5] send_to_all: SETINFO driver.state "quiet"
   2.303498 [D5] send_to_all: SETINFO driver.state "updateinfo"
   2.303760 upsdrv_updateinfo
   2.303873 [D5] send_to_all: SETINFO driver.state "quiet"
   4.305597 [D5] send_to_all: SETINFO driver.state "updateinfo"
   4.305758 upsdrv_updateinfo
   4.305867 [D5] send_to_all: SETINFO driver.state "quiet"
   6.307098 [D5] send_to_all: SETINFO driver.state "updateinfo"
   6.307296 upsdrv_updateinfo
   6.307419 [D5] send_to_all: SETINFO driver.state "quiet"
   8.309205 [D5] send_to_all: SETINFO driver.state "updateinfo"
   8.309337 upsdrv_updateinfo
   8.309523 [D5] send_to_all: SETINFO driver.state "quiet"
  10.311302 [D5] send_to_all: SETINFO driver.state "updateinfo"
  10.311545 upsdrv_updateinfo
  10.311654 [D5] send_to_all: SETINFO driver.state "quiet"
  12.313406 [D5] send_to_all: SETINFO driver.state "updateinfo"
  12.313571 upsdrv_updateinfo
  12.313705 [D5] send_to_all: SETINFO driver.state "quiet"
  14.315107 [D5] send_to_all: SETINFO driver.state "updateinfo"
  14.315568 upsdrv_updateinfo
  14.315891 [D5] send_to_all: SETINFO driver.state "quiet"
  16.317216 [D5] send_to_all: SETINFO driver.state "updateinfo"
  16.317610 upsdrv_updateinfo
  16.318682 [D5] send_to_all: SETINFO driver.state "quiet"
  18.319312 [D5] send_to_all: SETINFO driver.state "updateinfo"
  18.319691 upsdrv_updateinfo
  18.320049 [D5] send_to_all: SETINFO driver.state "quiet"
  20.321409 [D5] send_to_all: SETINFO driver.state "updateinfo"
  20.323181 upsdrv_updateinfo
  20.323583 [D5] send_to_all: SETINFO driver.state "quiet"
  22.323508 [D5] send_to_all: SETINFO driver.state "updateinfo"
  22.324419 upsdrv_updateinfo
  22.324826 [D5] send_to_all: SETINFO driver.state "quiet"
  24.325600 [D5] send_to_all: SETINFO driver.state "updateinfo"
  24.325980 upsdrv_updateinfo
  24.326714 [D5] send_to_all: SETINFO driver.state "quiet"
  26.327702 [D5] send_to_all: SETINFO driver.state "updateinfo"
  26.328087 upsdrv_updateinfo
  26.328402 [D5] send_to_all: SETINFO driver.state "quiet"
  28.329808 [D5] send_to_all: SETINFO driver.state "updateinfo"
  28.330180 upsdrv_updateinfo
  28.330486 [D5] send_to_all: SETINFO driver.state "quiet"
  30.331904 [D5] send_to_all: SETINFO driver.state "updateinfo"
  30.332091 upsdrv_updateinfo
  30.332196 [D5] send_to_all: SETINFO driver.state "quiet"
  32.334013 [D5] send_to_all: SETINFO driver.state "updateinfo"
  32.334271 upsdrv_updateinfo
  32.334606 [D5] send_to_all: SETINFO driver.state "quiet"
  34.336108 [D5] send_to_all: SETINFO driver.state "updateinfo"
  34.336268 upsdrv_updateinfo
  34.336387 [D5] send_to_all: SETINFO driver.state "quiet"
  36.338207 [D5] send_to_all: SETINFO driver.state "updateinfo"
  36.338376 upsdrv_updateinfo
  36.338578 [D5] send_to_all: SETINFO driver.state "quiet"
  38.340298 [D5] send_to_all: SETINFO driver.state "updateinfo"
  38.340476 upsdrv_updateinfo
  38.340585 [D5] send_to_all: SETINFO driver.state "quiet"
  40.342395 [D5] send_to_all: SETINFO driver.state "updateinfo"
  40.342558 upsdrv_updateinfo
  40.342668 [D5] send_to_all: SETINFO driver.state "quiet"
  42.344509 [D5] send_to_all: SETINFO driver.state "updateinfo"
  42.344671 upsdrv_updateinfo
  42.344784 [D5] send_to_all: SETINFO driver.state "quiet"
  44.346600 [D5] send_to_all: SETINFO driver.state "updateinfo"
  44.346760 upsdrv_updateinfo
  44.346875 [D5] send_to_all: SETINFO driver.state "quiet"
  46.348706 [D5] send_to_all: SETINFO driver.state "updateinfo"
  46.348870 upsdrv_updateinfo
  46.348982 [D5] send_to_all: SETINFO driver.state "quiet"
^C  47.953281   [D1] set_exit_flag: raising exit flag due to signal 2
  47.953568 Signal 2: exiting
  47.953713 [D5] send_to_all: SETINFO driver.state "cleanup.upsdrv"
  47.953818 upsdrv_cleanup
  49.027295 [D5] send_to_all: SETINFO driver.state "cleanup.exit"

And attempting a start with debug and foregrounding:

root@10c704b8f28c:/# /nut/sbin/upsdrvctl -u root -DDD -ddd -FF start
Network UPS Tools - UPS driver controller 2.8.0.1
   0.000001 [D1] upsdrvctl commanding all drivers (1 found): (null)
   0.000197 [D1] Starting UPS: NobreakZenith
   0.000339 [D2] 1 remaining attempts
   0.000424 [D2] exec:  /nut/bin/sms_ser -DDD -FF -a NobreakZenith -u root
   0.000508 [D1] Starting the only driver with explicitly requested foregrounding mode, not forking
Network UPS Tools - SMS Brazil UPS driver 1.00 (2.8.0.1)
upsdrv_makevartable
   0.000335 [D3] main_arg: var='driver' val='sms_ser'
   0.000477 [D3] main_arg: var='port' val='/dev/ttyUSB0'
   0.000571 [D3] main_arg: var='desc' val='Nobreak Zenith'
   0.000653 [D3] main_arg: var='sdorder' val='-1'
   0.000861 [D1] Built-in default or configured user for drivers 'nobody' was ignored due to 'root' specified on command line
   0.000943 Debug level is 3, dump data count is off, but backgrounding mode requested as off
   0.001017 [D1] Network UPS Tools version 2.8.0.1 (release/snapshot of 2.8.0.1) built with gcc (Debian 12.2.0-14) 12.2.0 and configured with flags: --prefix=/nut --with-all --with-ssl --with-libltdl --with-wrap
   0.001083 [D1] debug level is '3'
   0.003113 [D1] Succeeded to become_user(root): now UID=0 GID=0
   0.003320 upsdrv_initups
   0.008438 upsdrv_initinfo
]:[I�����
Returned: 15
3a4d332053454e4f4944414c20332e00
]:[F�����
Returned: 15
303b3131352f32323030303030313200
]:[Q�����
Returned: 15
363d04ec04ec0442f0025803e8019000
   0.289510 Short read from UPS
   0.289650 upsdrv_updateinfo
   0.290889 [D2] dstate_init: sock /var/state/ups/sms_ser-NobreakZenith open on fd 4
   0.291668 [D1] Group and/or user account for this driver was customized ('root:nogroup') compared to built-in defaults. Fixing socket '/var/state/ups/sms_ser-NobreakZenith' ownership/access.
   0.292640 [D1] Group access for this driver successfully fixed
   0.293547 Running as foreground process, but saving a PID file anyway
   0.294993 [D1] Saving PID 110 into /var/state/ups/sms_ser-NobreakZenith.pid
   0.296408 [D1] Driver initialization completed, beginning regular infinite loop
   0.296829 upsdrv_updateinfo
   2.298959 upsdrv_updateinfo
   4.301076 upsdrv_updateinfo
   6.303176 upsdrv_updateinfo
   8.305280 upsdrv_updateinfo
  10.307382 upsdrv_updateinfo
  12.309490 upsdrv_updateinfo
  14.311596 upsdrv_updateinfo
  16.313770 upsdrv_updateinfo
  18.315870 upsdrv_updateinfo
  20.317961 upsdrv_updateinfo
  22.320063 upsdrv_updateinfo
  24.322171 upsdrv_updateinfo
  26.324262 upsdrv_updateinfo
  28.326359 upsdrv_updateinfo
  30.328452 upsdrv_updateinfo
  32.330545 upsdrv_updateinfo
  34.332642 upsdrv_updateinfo
  36.334744 upsdrv_updateinfo
  36.859391 sock_connect: enabling asynchronous mode (auto)
  36.859540 [D3] new connection on fd 5
  36.860409 [D2] send_to_one: sending DATASTALE
  36.860536 [D2] send_to_one: sending SETINFO device.type "ups"
  36.860823 [D2] send_to_one: sending SETINFO driver.debug "3"
  36.860903 [D2] send_to_one: sending SETFLAGS driver.debug RW NUMBER
  36.861837 [D2] send_to_one: sending SETINFO driver.flag.allow_killpower "0"
  36.862108 [D2] send_to_one: sending SETFLAGS driver.flag.allow_killpower RW NUMBER
  36.862295 [D2] send_to_one: sending SETINFO driver.name "sms_ser"
  36.862512 [D2] send_to_one: sending SETINFO driver.parameter.pollinterval "2"
  36.862697 [D2] send_to_one: sending SETINFO driver.parameter.port "/dev/ttyUSB0"
  36.862879 [D2] send_to_one: sending SETINFO driver.parameter.synchronous "auto"
  36.863142 [D2] send_to_one: sending SETINFO driver.state "quiet"
  36.863344 [D2] send_to_one: sending SETINFO driver.version "2.8.0.1"
  36.863545 [D2] send_to_one: sending SETINFO driver.version.internal "1.00"
  36.863760 [D2] send_to_one: sending ADDCMD driver.killpower
  36.863969 [D2] send_to_one: sending ADDCMD driver.reload
  36.864192 [D2] send_to_one: sending ADDCMD driver.reload-or-error
  36.864389 [D2] send_to_one: sending ADDCMD driver.reload-or-exit
  36.864570 [D2] send_to_one: sending DUMPDONE
  38.336460 upsdrv_updateinfo
  40.338555 upsdrv_updateinfo
  42.340646 upsdrv_updateinfo
  44.342883 upsdrv_updateinfo
  46.344901 upsdrv_updateinfo
  48.347028 upsdrv_updateinfo
  50.349153 upsdrv_updateinfo
  52.351256 upsdrv_updateinfo
  54.353374 upsdrv_updateinfo
^C  55.557049   [D1] set_exit_flag: raising exit flag due to signal 2
  55.557152 Signal 2: exiting
  55.557253 WARNING: send_to_all: write 38 bytes to socket 5 failed (ret=-1), disconnecting: Broken pipe
  55.557422 upsdrv_cleanup

And at same time:

root@10c704b8f28c:/# /nut/sbin/upsd -DDD -u root
Network UPS Tools upsd 2.8.0.1
   0.000000 fopen /var/state/ups/upsd.pid: No such file or directory
   0.000911 Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!
   0.003496 [D3] listen_add: added 0.0.0.0:3493
   0.004054 [D1] debug level is '3'
   0.004725 [D3] setuptcp: try to bind to 0.0.0.0 port 3493
   0.005530 listening on 0.0.0.0 port 3493
   0.006742 [D1] Succeeded to become_user(root): now UID=0 GID=0
   0.007319 [D1] chdired into statepath /var/state/ups for driver sockets
   0.007949 /var/state/ups is world readable
   0.008846 [D2] sstate_connect: preparing UNIX socket sms_ser-NobreakZenith
   0.009747 Connected to UPS [NobreakZenith]: sms_ser-NobreakZenith
   0.011013 Found 1 UPS defined in ups.conf
   0.016379 [D2] user_add_action: adding 'login' for upsmon
   0.017348 [D2] user_add_action: adding 'master' for upsmon
   0.018330 [D2] user_add_action: adding 'fsd' for upsmon
   0.019808 Running as foreground process, not saving a PID file
   0.020668 [D2] mainloop: polling 2 filedescriptors
   0.022351 [D3] UPS [NobreakZenith]: data is STALE now
   0.022929 [D2] mainloop: polling 2 filedescriptors
   0.023530 [D3] UPS [NobreakZenith]: dump is done
   0.023948 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   0.024850 Data for UPS [NobreakZenith] is stale - check driver
   0.025477 [D2] mainloop: polling 2 filedescriptors
   1.488561 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   1.489102 [D2] mainloop: polling 2 filedescriptors
   1.490551 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   1.491054 [D2] mainloop: polling 2 filedescriptors
   3.490462 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   3.491114 [D2] mainloop: polling 2 filedescriptors
   3.493378 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   3.493815 [D2] mainloop: polling 2 filedescriptors
   5.492580 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   5.493284 [D2] mainloop: polling 2 filedescriptors
   5.494011 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   5.495611 [D2] mainloop: polling 2 filedescriptors
   7.494791 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   7.495425 [D2] mainloop: polling 2 filedescriptors
   9.496681 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   9.497379 [D2] mainloop: polling 2 filedescriptors
   9.498172 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
   9.499707 [D2] mainloop: polling 2 filedescriptors
  11.498941 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  11.499521 [D2] mainloop: polling 2 filedescriptors
  13.500919 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  13.501426 [D2] mainloop: polling 2 filedescriptors
  13.501933 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  13.502328 [D2] mainloop: polling 2 filedescriptors
  15.503039 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  15.503552 [D2] mainloop: polling 2 filedescriptors
  15.504061 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  15.504540 [D2] mainloop: polling 2 filedescriptors
  17.505142 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  17.505694 [D2] mainloop: polling 2 filedescriptors
  17.506207 [D3] sstate_dead: driver for UPS [NobreakZenith] says data is stale
  17.506566 [D2] mainloop: polling 2 filedescriptors
^C  17.984594   mainloop: Interrupted system call
  17.985134 Signal 2: exiting
  17.985892 [D1] driver_free: forgetting UPS [NobreakZenith] (FD 4)

I'll investigate this more, but any thoughts are wellcome now.

Also, thank you a lot @alexwbaule !

alexwbaule commented 1 year ago

Tks @leleobhz

Its just de "first commit", there is a lot to do, i need to translate all hex to validate the response, etc.

i will do this this week, using the riello_ser as exemple.

leleobhz commented 1 year ago

Its just de "first commit", there is a lot to do, i need to translate all hex to validate the response, etc.

Fine! I just make sure this code will run here.

You think add support like riello_ser is better than attach a new interpreter to nutdrv_qx?

alexwbaule commented 1 year ago

Maybe, The time to understand the nutdrv_qx code for me is longer than that of riello, so to have a "driver done faster" I preferred to go for a separate protocol, just "SMS". Maybe, after implemented, migrate it to nutdrv_qx.

jimklimov commented 1 year ago

Ideally, if it is a Qx variant after all - better put it (and a detector) under that umbrella. The slow-moving long term plan is to get rid of other implementations and have one driver per major protocol...

If it is too different and warrants a separate driver, that's another story...

alexwbaule commented 1 year ago

@jimklimov i need to understand all Qx implementation, to see if its a variant.

When I'm done with the implementation, we can see for sure where it fits best, and if that's the case I'll migrate it to Qx. For now, I'm doing it separately. To understand the entire nut code, there's a lot to understand.

alexwbaule commented 1 year ago

@jimklimov ,

Please, give-me a help ?

im looking in the developer documentation, and don´t find something. Is there a "default" values for "dstate_setinfo" and "dstate_addcmd" ??

Taking this driver as example: I have: imput voltage output voltage output power (in percent) output hertz battery level (in percent) temperature (in celsius)

and some booleans for "the device is in test ? its OK ? etc"

there is a default values to set to the dstate_setinfo thats represents the itens above, or i can call every item with any name that i want and its Ok ?

alexwbaule commented 1 year ago

@leleobhz ,

There is some news.

Captura de tela de 2023-08-02 22-24-35

jimklimov commented 1 year ago

@alexwbaule : AFAIK there are no centrally set "defaults" as such, however some values can be initialized by drivers/main.c (driver CLI flags and config settings, override values, etc.) and generally some more by upsdrv_initups() and such (more so where config variables are handled or UPS readings are processed and driver state data updated). In a sense these could be treated as defaults, but not really :)

Some drivers set (and delete) their dstate entries in different functions as the logic flows, others use a mapping-table approach where possible, to separate what is essentially data/config from programmatic code.

As for names of those entries, like battery.charge etc. - there is a standard definition in docs/nut-names.txt for the concepts which somebody somewhere handled so far, so that NUT can act as the abstraction layer for different vendors and media and protocols. This is community-extensible (raise a question in nut-upsdev mailing list to propose a name and have everyone with an opinion agree on something that fits) since there are a lot of vendor-specific or tech-level nuances that not every device deals with (like redundant UPS communications, daisy-chains, bypasses etc.) Still, these are likely not unique to a single device some developer sees, so designing a naming pattern (and possibly code behind it) instead of cowboying one's way through is important. That said, for quick achievements there is an experimental.* namespace that people should not long-term rely on :)

alexwbaule commented 1 year ago

Tks a lot @jimklimov , its the docs/nut-names.txt that i want.

Its almost complete the driver, now i will match the names with the docs.

leleobhz commented 1 year ago

Tks a lot @jimklimov , its the docs/nut-names.txt that i want.

Its almost complete the driver, now i will match the names with the docs.

Feedback of my Nobreak:

root@3f2f4660f611:/# /nut/bin/sms_ser -a NobreakZenith -DDDDDD
Network UPS Tools - SMS Brazil UPS driver 1.00 (2.8.0.1)
upsdrv_makevartable
   0.000359 [D1] Network UPS Tools version 2.8.0.1 (release/snapshot of 2.8.0.1) built with gcc (Debian 12.2.0-14) 12.2.0 and configured with flags: --prefix=/nut --with-all --with-ssl --with-libltdl --with-wrap
   0.000544 [D1] debug level is '6'
   0.000813 [D5] send_to_all: SETINFO driver.debug "6"
   0.001048 [D5] send_to_all: SETFLAGS driver.debug RW NUMBER
   0.003643 [D1] Succeeded to become_user(nobody): now UID=65534 GID=65534
   0.004222 [D5] send_to_all: SETINFO device.type "ups"
   0.004451 [D5] send_to_all: SETINFO driver.state "init.device"
   0.004666 upsdrv_initups
   0.009255 [D5] send_to_all: SETINFO driver.state "init.quiet"
   0.009411 [D5] send_to_all: SETINFO driver.version "2.8.0.1"
   0.009494 [D5] send_to_all: SETINFO driver.version.internal "1.00"
   0.009567 [D5] send_to_all: SETINFO driver.name "sms_ser"
   0.009644 [D5] send_to_all: SETINFO driver.state "init.info"
   0.009709 upsdrv_initinfo
   0.009771 get_ups_nominal
   0.116366 [D3] Get nominal Ok: received byte 18
   0.116532 get_ups_nominal
   0.222412 [D3] Get nominal Ok: received byte 18
   0.222566 get_ups_nominal
   0.328346 [D3] Get nominal Ok: received byte 18
   0.328558 [D5] send_to_all: SETINFO ups.model "M3 SENOIDAL "
   0.328711 [D5] send_to_all: SETINFO ups.firmware "3.0"
   0.328823 [D5] send_to_all: SETINFO ups.range.voltage "M3 SENOIDAL "
   0.328936 [D5] send_to_all: SETINFO ups.range.current "_ser"
"
   0.329065 [D5] send_to_all: SETINFO ups.frequency "0"
   0.329165 [D5] send_to_all: SETINFO ups.battery.voltage "12"
   0.329279 [D5] send_to_all: SETINFO ups.temperature "41.00"
   0.329402 [D5] send_to_all: SETINFO output.frequency "60.00"
   0.329515 [D5] send_to_all: SETINFO input.voltage "129.00"
   0.329625 [D5] send_to_all: SETINFO output.voltage "111.00"
   0.329734 [D5] send_to_all: SETINFO output.power "25.00"
   0.329840 [D5] send_to_all: SETINFO battery.level "100.00"
   0.330016 [D5] send_to_all: SETINFO battery.voltage "12.00"
   0.330124 [D5] send_to_all: SETINFO driver.state "init.updateinfo"
   0.330232 upsdrv_updateinfo
   0.330337 get_ups_nominal
   0.437348 [D3] Get nominal Ok: received byte 18
   0.437617 [D5] send_to_all: SETINFO driver.state "init.quiet"
   0.438858 [D2] dstate_init: sock /var/state/ups/sms_ser-NobreakZenith open on fd 4
   0.439045 [D5] send_to_all: SETINFO driver.parameter.pollinterval "5"
   0.439177 [D5] send_to_all: SETINFO driver.parameter.synchronous "auto"
   0.439293 [D5] send_to_all: SETINFO device.model "M3 SENOIDAL "
   0.439403 Running as foreground process, not saving a PID file
   0.439511 [D5] send_to_all: SETINFO driver.flag.allow_killpower "0"
   0.439620 [D5] send_to_all: SETFLAGS driver.flag.allow_killpower RW NUMBER
   0.439725 [D5] send_to_all: ADDCMD driver.killpower
   0.439827 [D5] send_to_all: ADDCMD driver.reload
   0.439944 [D5] send_to_all: ADDCMD driver.reload-or-exit
   0.440044 [D5] send_to_all: ADDCMD driver.reload-or-error
   0.440147 [D5] send_to_all: SETINFO driver.state "quiet"
   0.440245 [D1] Driver initialization completed, beginning regular infinite loop
   0.440345 [D6] upsnotify: failed to notify about state 2: no notification tech defined, will not spam more about it
   0.440462 [D5] send_to_all: SETINFO driver.state "updateinfo"
   0.440558 upsdrv_updateinfo
   0.440652 get_ups_nominal
   0.547347 [D3] Get nominal Ok: received byte 18
   0.547582 [D5] send_to_all: SETINFO output.power "26.00"
   0.547707 [D5] send_to_all: SETINFO driver.state "quiet"
   5.445483 [D5] send_to_all: SETINFO driver.state "updateinfo"
   5.445638 upsdrv_updateinfo
   5.445734 get_ups_nominal
   5.552291 [D3] Get nominal Ok: received byte 18
   5.552524 [D5] send_to_all: SETINFO output.power "25.00"
   5.552650 [D5] send_to_all: SETINFO driver.state "quiet"
  10.450488 [D5] send_to_all: SETINFO driver.state "updateinfo"
  10.450649 upsdrv_updateinfo
  10.450748 get_ups_nominal
  10.557250 [D3] Get nominal Ok: received byte 18
  10.557460 [D5] send_to_all: SETINFO input.voltage "127.00"
  10.560104 [D5] send_to_all: SETINFO output.power "26.00"
  10.560311 [D5] send_to_all: SETINFO driver.state "quiet"
  15.455478 [D5] send_to_all: SETINFO driver.state "updateinfo"
  15.455639 upsdrv_updateinfo
  15.455750 get_ups_nominal
  15.562207 [D3] Get nominal Ok: received byte 18
  15.562593 [D5] send_to_all: SETINFO output.power "25.00"
  15.563011 [D5] send_to_all: SETINFO driver.state "quiet"
  20.460474 [D5] send_to_all: SETINFO driver.state "updateinfo"
  20.460727 upsdrv_updateinfo
  20.461401 get_ups_nominal
  20.568129 [D3] Get nominal Ok: received byte 18
  20.568586 [D5] send_to_all: SETINFO driver.state "quiet"
^C  22.265541   [D1] set_exit_flag: raising exit flag due to signal 2
  22.266260 Signal 2: exiting
  22.266991 [D5] send_to_all: SETINFO driver.state "cleanup.upsdrv"
  22.267606 upsdrv_cleanup
  23.354773 [D5] send_to_all: SETINFO driver.state "cleanup.exit"

I can look at code on weekend, until them, there is something I can test/do right now?

jimklimov commented 1 year ago

One test that comes to mind is to ask the driver to produce an upsc-style data dump after an initial connection, and after a few update cycles, e.g.:

:; /nut/bin/sms_ser -a NobreakZenith -DDDDDD -d 1

and

:; /nut/bin/sms_ser -a NobreakZenith -DDDDDD -d 3
alexwbaule commented 1 year ago

@leleobhz and @jimklimov

Another update, (just pull from /feature/add-support-sms-brazil branch )

Following the nut-names.txt and looking another drivers, i have implemented all itens that i think is ok to the driver.

implemented all commands that the UPS has:

implemented major dstate_setinfo, from query and someones from calculations.

Implemented DELAY for shutdown and SECONDS for test.battery.start

Implemented "ups.status" based on new-drivers.txt

Now we can test it, and if is OK i will make a PullRequest to nut....

Im watching the "QX" driver, but looking for SMS Brazil documentation, there is 4 protocols, in the PowerView:

maybe if migrate to QX, create a "sms_mono", "sms_tri" ?

jimklimov commented 1 year ago

Since this is about phase count, perhaps something like sms1 and sms3? or sms1ph..?

leleobhz commented 1 year ago

AFAIK monofasico, trifasico are custom variants of Qx. May be a good idea other users of SMS nobreaks check their nobreaks that speaks upsilon and voltronic if SMS also break standards for these ones.

Particularly in Brazil, this line of nobreaks I have are very popular in SOHO environments.

I would check if monofasico and trifasico can be a nutdrv_qx variant and lead upsilon and voltronic to be checked for HCL if someone report it - since the change SMS uses standard of this protocol is relativelly high.

About @alexwbaule code, I pulled a new docker image with these new features to be tested. Also, I'll check on weekend if I can understand a way to merge it within nutdrv_qx as variant.

alexwbaule commented 1 year ago

Hi @leleobhz ,

I'm already starting the merge to nutdrv_qx, it's relatively easy to do. I was able to understand how some things worked initially, there are still some things left to understand, but it is now possible to start the merge. I'm calling "nutdrv_qx_sms-1phase" for the "mono" variant.

I'm going to reuse the already made code of the sms_ser.(c/h) driver for this.

Yesterday I did some tests with the driver I already made, and apparently it's OK, reporting status, commands working, but it's good for other people to test it too.

leleobhz commented 1 year ago

Yesterday I did some tests with the driver I already made, and apparently it's OK, reporting status, commands working, but it's good for other people to test it too.

Ones who want a Docker image to this I made it available today.

Thank you so much for this work @alexwbaule :)

leleobhz commented 1 year ago

With today version, my nobreak worked well!

This was the output of debug on Android app APCUPSD Monitor:

BEGIN LIST VAR NobreakZenith
battery.charge: 100.00
battery.charger.status: resting
battery.packs: 1
battery.voltage: 12.00
battery.voltage.nominal: 12
device.model: M3 SENOIDAL: 
device.type: ups
driver.debug: 0
driver.flag.allow_killpower: 0
driver.name: sms_ser
driver.parameter.pollinterval: 5
driver.parameter.port: /dev/ttyUSB0
driver.parameter.synchronous: auto
driver.state: quiet
driver.version: 2.8.0.1
driver.version.internal: 1.00
input.current.nominal: 000
input.voltage: 129.00
input.voltage.extended: 129.00
input.voltage.nominal: 115/220
output.frequency: 60.00
output.frequency.nominal: 60
output.voltage: 111.00
ups.beeper.status: enabled
ups.firmware: 3.0
ups.load: 24.00
ups.status: OL
ups.temperature: 40.00
END LIST VAR NobreakZenith
alexwbaule commented 1 year ago

Hi @jimklimov

im looking in the documentation to create a "qx" sub-driver, and i got some questions, if this driver is a qx compatible sub-driver.

The "leading" on "item_t", is a char, but in the "Q" command on SMS 1Phase, the valid answer can be 3 values (<.>,=).

I Thinking in maybe open a PR from this driver and after that, migrate the driver if need some changes to qx driver itself.

You are ok with that ?