<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello!</p>
    <p>I left this line uncommented in powercom-hid.c for battery
      voltage:<br>
      { "battery.voltage", 0, 0, "UPS.Battery.Voltage", NULL, "%.2f", 0,
      NULL },<br>
      and got some data different from the input voltage values</p>
    <p>The Powercom support staff gave the following response to my
      question:<br>
    </p>
    <pre class="moz-quote-pre" wrap="">Dear Alex, 
First of all , thank you for purchasing PCM MRT-3000 ups. 
Regarding of your question, see our reply in below 


==> Please take your data with below rules :
•     DEX : 5378 
•     HEX : 1502  (Low : 15 / High : 02)  
•     Battery one cell voltage : [High + (Low/100)] : 2.21 
•     Battery voltage : 2.21 * 6 * 6 = 79.56 Vol   (1 package with 6 cells / MRT has 6 packages)

Best regards
Sandy Chang, Powercom Taiwan HQ


-----Original Message-----
From: Alex Rydzewski [<a class="moz-txt-link-freetext" href="mailto:arydzewski@elyland.net">mailto:arydzewski@elyland.net</a>] 
Sent: Thursday, January 12, 2023 5:47 PM
To: <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:pcm.eu@upspowercom.com">pcm.eu@upspowercom.com</a>
Subject: MRT-3000 USB battery.voltage

Hello!

I have the MRT-3000 UPS and try to get real battery voltage through USB. 
USB protocol reference has specify for battery.voltage:
report id | Usage  |    Usage Name     | Data Access | Length
    26         0X8430  Battery Voltage          R/O            3 Byte

But I get for this position the next data:
    0.544555     [D4] Entering libusb_get_report
    0.549533     [D3] Report[get]: (3 bytes) => 1a 02 15
    0.549550     [D5] PhyMax = 0, PhyMin = 0, LogMax = 9216, LogMin = 2304
    0.549561     [D5] Unit = 00000000, UnitExp = 0
    0.549569     [D5] Exponent = 0
    0.549576     [D5] hid_lookup_path: 00840004 -> UPS
    0.549583     [D5] hid_lookup_path: 00840012 -> Battery
    0.549591     [D5] hid_lookup_path: 00840030 -> Voltage
    0.549603     [D1] Path: UPS.Battery.Voltage, Type: Feature,
ReportID: 0x1a, Offset: 0, Size: 16, Value: 5378

Suggest me, please, how I can interpret the battery.voltage value "5378?  How I can get real battery.voltage data?</pre>
    <p>Perhaps it is possible implement this algorithm to "nut" project
      for a UPS like this?<br>
    </p>
    <div class="moz-cite-prefix">On 10.01.23 19:14, Jim Klimov wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAJYg8v+ELkYEvPBYooeWWK=bkuw7z_biOs7bpCjQ_-LJMxLwSA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">I suppose that should have read "correct
        battery.voltage" ;)
        <div dir="auto"><br>
        </div>
        <div dir="auto">Not sure really - this is the standard endpoint
          for that info, so firmware is broken for USB HID power device
          support.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">If you start the driver with higher debug
          verbosity, it prints the reports from USB. If you can decipher
          those (online tools exist but I don't have a link handy),
          maybe some other field (possibly with an untranslated hex
          name) conveys data that looks like what you need.</div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Jim</div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Tue, Jan 10, 2023, 18:09
          Alex Rydzewski <<a href="mailto:arydzewski@elyland.net"
            moz-do-not-send="true" class="moz-txt-link-freetext">arydzewski@elyland.net</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0 0 0
          .8ex;border-left:1px #ccc solid;padding-left:1ex">
          <div>
            <p>Thank You for your attention, Jim!<br>
              I compiled and ran the 2.8.0 version with this part
              uncomment<br>
               *    { "battery.voltage", 0, 0,
              "UPS.PowerSummary.Voltage", NULL, "%.2f", 0, NULL },<br>
               *    { "battery.voltage", 0, 0, "UPS.Battery.Voltage",
              NULL, "%.2f", 0, NULL },<br>
               *    { "battery.voltage.nominal", 0, 0,
              "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f",
              HU_FLAG_STATIC, NULL },<br>
               *    { "battery.voltage.nominal", 0, 0,
              "UPS.Battery.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC,
              NULL },<br>
              from powercom-hid.c, and it is so, it is duplicates for
              output.voltage.<br>
              <br>
              Is there anything I can do to find the correct
              output.voltage?<br>
            </p>
            <div>On 10.01.23 14:12, Jim Klimov wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Hello,</div>
                <div><br>
                </div>
                <div>  One thing that pops out in your report is that
                  NUT 2.7.2 is used, which is pretty old now. If you
                  have a chance to install 2.8.0 or newer (custom build
                  of current git master) to confirm if the problem is
                  still there, it could be helpful.</div>
                <div><br>
                </div>
                <div>  Other than that, current source says at <a
href="https://github.com/networkupstools/nut/blob/1deab1638322e9e64a0cf3200dadc93dbe3a3f41/drivers/powercom-hid.c#L362-L368"
                    target="_blank" rel="noreferrer"
                    moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/networkupstools/nut/blob/1deab1638322e9e64a0cf3200dadc93dbe3a3f41/drivers/powercom-hid.c#L362-L368</a>
                  that "battery.voltage" is served in USB reports, but
                  is not useful (same as output voltage). Nearby,
                  "battery.runtime" and "battery.mfr.date" do come from
                  USB reports, but per <a
                    href="https://github.com/networkupstools/nut/issues/1644"
                    target="_blank" rel="noreferrer"
                    moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/networkupstools/nut/issues/1644</a>
                  the latter was previously wrongly reported as
                  "battery.date" (for replacement). Note that generally
                  fixes are based on user reports about devices which
                  misbehaved; if a vendor has multiple devices with
                  different behaviors (including bug fixes in newer
                  firmwares) it can get messy and need some more
                  elaborate fixes :-\<br>
                </div>
                <div><br>
                </div>
                <div>  Something in your question does ring a bell -
                  please revise <a
                    href="https://github.com/networkupstools/nut/issues?q=+label%3APowercom"
                    target="_blank" rel="noreferrer"
                    moz-do-not-send="true">https://github.com/networkupstools/nut/issues?q=label%3APowercom</a>
                  and/or <a
                    href="https://github.com/networkupstools/nut/issues?q=powercom"
                    target="_blank" rel="noreferrer"
                    moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/networkupstools/nut/issues?q=powercom</a>
                  to see if that was discussed earlier in more detail.<br>
                </div>
                <div><br>
                </div>
                <div>Hope this helps,</div>
                <div>Jim Klimov<br>
                </div>
                <div><br>
                </div>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Tue, Jan 10, 2023
                  at 11:42 AM Alex Rydzewski <<a
                    href="mailto:arydzewski@elyland.net" target="_blank"
                    rel="noreferrer" moz-do-not-send="true"
                    class="moz-txt-link-freetext">arydzewski@elyland.net</a>>
                  wrote:<br>
                </div>
                <blockquote class="gmail_quote" style="margin:0px 0px
                  0px 0.8ex;border-left:1px solid
                  rgb(204,204,204);padding-left:1ex">Hello!<br>
                  <br>
                  I have not been able to get the battery.voltage data
                  from the Powercom <br>
                  Macan MRT-3000, although there is data in the log that
                  does not match <br>
                  the value I see on the device's display. Please tell
                  me how I can <br>
                  control this. And please tell me, if possible, how to
                  get the absolute <br>
                  value of the load on this device.<br>
                  Debug log is attached<br>
                  <br>
                  ~ # upsc 004-0D9F-000<br>
                  Init SSL without certificate database<br>
                  battery.charge: 100<br>
                  battery.charge.low: 10<br>
                  battery.charge.warning: 30<br>
                  battery.date: 2014/01/15             I'm not sure that
                  it is right<br>
                  battery.runtime: 800                    Is this data
                  from the device or <br>
                  from the driver?<br>
                  battery.type: PbAc<br>
                  battery.voltage.high: 81.60<br>
                  battery.voltage.low: 63.60<br>
                  battery.voltage.nominal: 75.60<br>
                  device.mfr: POWERCOM Co.,LTD<br>
                  device.model: HID UPS Battery<br>
                  device.serial: 004-0D9F-000<br>
                  device.type: ups<br>
                  <a href="http://driver.name" rel="noreferrer
                    noreferrer" target="_blank" moz-do-not-send="true">driver.name</a>:
                  usbhid-ups<br>
                  driver.version: 2.7.2<br>
                  driver.version.data: PowerCOM HID 0.4<br>
                  driver.version.internal: 0.38<br>
                  ...<br>
                  <br>
                  -- <br>
                  З найкращими побажаннями, Олександр Ридзевський |With
                  best regards, Mr. Alexander Rydzewski,    |С
                  наилучшими пожеланиями, Александр Рыдзевский<br>
                  Системний та мережевий інженер, Elyland ltd.   
                  |System and Network Engineer at Elyland ltd.   
                  |Системный и сетевой инженер, Elyland ltd.<br>
                </blockquote>
              </div>
            </blockquote>
            <pre cols="72">-- 
З найкращими побажаннями, Олександр Ридзевський       |With best regards, Mr. Alexander Rydzewski,    |С наилучшими пожеланиями, Александр Рыдзевский
Системний та мережевий інженер, Elyland ltd. |System and Network Engineer at Elyland ltd.    |Системный и сетевой инженер, Elyland ltd.</pre>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
З найкращими побажаннями, Олександр Ридзевський       |With best regards, Mr. Alexander Rydzewski,    |С наилучшими пожеланиями, Александр Рыдзевский
Системний та мережевий інженер, Elyland ltd. |System and Network Engineer at Elyland ltd.    |Системный и сетевой инженер, Elyland ltd.</pre>
  </body>
</html>