Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    apcupsd widget error with 23.1 installed

    Scheduled Pinned Locked Moved General pfSense Questions
    16 Posts 7 Posters 2.2k Views 11 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dstacey147
      last edited by

      With 23.1 installed apcupsd widget throws the following error:

      PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 206, Message: Uncaught TypeError: ceil(): Argument #1 ($num) must be of type int|float, string given in /usr/local/www/widgets/widgets/apcupsd.widget.php:206
      Stack trace:
      #0 /usr/local/www/widgets/widgets/apcupsd.widget.php(206): ceil('29.2\xC2')
      #1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0')
      #2 {main}
      thrown @ 2023-02-16 10:50:34

      S 1 Reply Last reply Reply Quote 0
      • stephenw10S Offline
        stephenw10 Netgate Administrator
        last edited by

        Hmm, that looks new.

        Is that a clean install or an upgrade?

        Was the widget and it's config working in a previous version?

        Steve

        D 1 Reply Last reply Reply Quote 0
        • E Offline
          error1
          last edited by

          I get the same error message here after the upgrade, apcupsd itself works though and I am able to connect to it from my NetworkUPSTools install.

          I really like the widget though so I hope it gets bugfixed :)
          It worked fine on 22.05

          Screenshot 2023-02-16 at 21.10.18.png
          Screenshot 2023-02-16 at 21.09.42.png
          Screenshot 2023-02-16 at 21.13.20.png

          1 Reply Last reply Reply Quote 0
          • stephenw10S Offline
            stephenw10 Netgate Administrator
            last edited by

            https://redmine.pfsense.org/issues/13970

            Do you see it if you select °F for temperature?

            Are you both running amd64 platforms?

            Steve

            D 1 Reply Last reply Reply Quote 0
            • D Offline
              dstacey147 @stephenw10
              last edited by

              @stephenw10 Upgrade from most recent 22 release to 23.1 on a Netgate 6100.
              apcupsd was working fine previously. I tried uninstalling rand reinstalling it (with a reboot in between) and got the same result.

              1 Reply Last reply Reply Quote 0
              • D Offline
                dstacey147 @stephenw10
                last edited by

                @stephenw10 Same result regardless of C or F

                1 Reply Last reply Reply Quote 0
                • E Offline
                  error1
                  last edited by

                  I am running a Netgate 2100, ARM Cortex-A53 r0p4

                  1 Reply Last reply Reply Quote 0
                  • N Offline
                    netskillz
                    last edited by

                    I had the same issue, except on line 208. As a temp fix until the package gets updated, I just edited apcupsd.widget.php, and on line 208 change:

                    ((ceil(substr(($degc)

                    to:

                    ((ceil(substr(((int) $degc)

                    My widget started working fine after that.

                    I would assume the same modification could be made on line 206 as well, as its the same function. YMMV

                    D M 2 Replies Last reply Reply Quote 4
                    • D Offline
                      dstacey147 @netskillz
                      last edited by

                      @netskillz That did the trick. I changed it in both 206 and 208 just to be safe. Thanks!

                      1 Reply Last reply Reply Quote 1
                      • S Offline
                        SteveITS Rebel Alliance @dstacey147
                        last edited by

                        @dstacey147 Interesting, I do not have an error on the dashboard widget. 2100, new install of 22.05, restored config (from 22.05 which had apcupsd installed), upgraded to 23.01, installed apcupsd (because it wasn't installed).

                        Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                        When upgrading, allow 10-15 minutes to reboot, or more depending on packages, and device or disk speed.
                        Upvote 👍 helpful posts!

                        D 1 Reply Last reply Reply Quote 0
                        • D Offline
                          dstacey147 @SteveITS
                          last edited by dstacey147

                          @steveits Both lines (206 and 208) are part of a rather large set of nested conditional statements, my guess is you simply don't have the conditions present that trigger either of the two lines. I was triggering line 206, @netskillz, who came up with the solution, was triggering line 208, you're triggering neither.

                          1 Reply Last reply Reply Quote 1
                          • M Offline
                            manicmoose @netskillz
                            last edited by

                            @netskillz Thank you!!
                            Upgraded from 22.05 and also had this problem on line 208.
                            Your solution worked a treat. 👍

                            1 Reply Last reply Reply Quote 1
                            • J Offline
                              jrey
                              last edited by

                              just curious in the included screen capture of the settings,

                              Screen Shot 2023-02-25 at 3.47.09 PM.png

                              Don't you actually have to have numeric values that can be parsed?
                              Mine looks more like this and I have not seen this both in 22.05 and 23.01 I have not experiences this error. (the package was updated as part of the 23.01 as well and is currently at 0.3.92 (although as I just went to look this version up I see there is another update which will bring it to 0.3.92_1, and which I just installed no issues)

                              Screen Shot 2023-02-25 at 3.48.04 PM.png

                              E 1 Reply Last reply Reply Quote 0
                              • E Offline
                                error1 @jrey
                                last edited by

                                @jrey Yes, the fields had numbers in them before the 23.01 upgrade but I think the script error garbled all the values

                                Anyway, after updating the apcupsd package to 0.3.92_1 the widget has started working again here. It looks like it was published a couple hours ago!

                                J 1 Reply Last reply Reply Quote 1
                                • J Offline
                                  jrey @error1
                                  last edited by

                                  @error1

                                  okay - I did not experience any of that moved from 22.05 to 23.01 with no issue at all. Thanks

                                  E 1 Reply Last reply Reply Quote 1
                                  • E Offline
                                    error1 @jrey
                                    last edited by

                                    I am guessing it only happened for certain UPS models and connection types, my old SmartUPS 1000 is using modbus protocol over serial (with a usb rs232 dongle)

                                    Most people are probably using a direct USB connection with the usbhid driver but I never got that to work reliably with my UPS, it would stop responding to polling from apcupsd after a couple days or weeks. Maybe the temperature parsing acts differently depending on the UPS type and connection method, or maybe some UPSes don't report a temperature at all.

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post
                                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.