Project

General

Profile

Actions

Bug #14364

open

APCUPSD unable to process date string

Added by Lloyd Collins 12 months ago. Updated 6 months ago.

Status:
Confirmed
Priority:
Normal
Assignee:
-
Category:
apcupsd
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
Affected Plus Version:
23.01
Affected Architecture:
All

Description

Hi,

After upgrading on a new install from 2.6.0 to + v23.01 (on amd64 if relevant) I'm unable to use the apcupsd widget on the homepage because it can't parse the battery replacement date.

I get a crash report (attached) and the following text from the widget on the home page:

Fatal error: Uncaught Exception: Failed to parse time string (20/04/23) at position 0 (2): Unexpected character in /usr/local/www/widgets/widgets/apcupsd.widget.php:255 Stack trace: #0 /usr/local/www/widgets/widgets/apcupsd.widget.php(255): DateTime->__construct('20/04/23') #1 /usr/local/www/widgets/widgets/apcupsd.widget.php(341): compose_apc_contents('apcupsd-0') #2 {main} thrown in /usr/local/www/widgets/widgets/apcupsd.widget.php on line 255 PHP ERROR: Type: 1, File: /usr/local/www/widgets/widgets/apcupsd.widget.php, Line: 255, Message: Uncaught Exception: Failed to parse time string (20/04/23) at position 0 (2): Unexpected character in /usr/local/www/widgets/widgets/apcupsd.widget.php:255 Stack trace: #0 /usr/local/www/widgets/widgets/apcupsd.widget.php(255): DateTime->__construct('20/04/23') #1 /usr/local/www/widgets/widgets/apcupsd.widget.php(341): compose_apc_contents('apcupsd-0') #2 {main} thrown

Seems similar to #13970 to me however not the same and that bug is marked as "done" a few months ago.

Thanks!


Files

PHP_errors.log (1.45 KB) PHP_errors.log PHP error log Lloyd Collins, 05/09/2023 08:50 AM
apcupsd screenshot 1.png (110 KB) apcupsd screenshot 1.png Lloyd Collins, 06/24/2023 06:17 PM
clipboard-202307080145-bj3bd.png (14.3 KB) clipboard-202307080145-bj3bd.png Jordan G, 07/08/2023 06:45 AM
apctest battery date change 1.png (56.2 KB) apctest battery date change 1.png Lloyd Collins, 07/08/2023 07:42 AM
clipboard-202311111743-kyfno.png (246 KB) clipboard-202311111743-kyfno.png Jordan G, 11/11/2023 11:43 PM
Actions #1

Updated by Kris Phillips 11 months ago

  • Status changed from New to Incomplete

Tested with an APC UPS on 23.05 with the latest apcupsd package. Unable to reproduce this error. Can you please provide some screenshots and reproduction steps? I'm not seeing any issues here.

Actions #2

Updated by Lloyd Collins 10 months ago

Kris Phillips wrote in #note-1:

Tested with an APC UPS on 23.05 with the latest apcupsd package. Unable to reproduce this error. Can you please provide some screenshots and reproduction steps? I'm not seeing any issues here.

Sure, screenshot of the error on the firewall attached.

Reproduction steps:

1. APC SU420INET connected via serial to 23.05-RELEASE on hardware Lenovo M720Q "tiny" PC.
2. APCUPSD at version 0.3.92_1 installed from standard pfsense repos
3. Configure the battery renewal date and other EEPROM settings using the APC "smart protocol" over the serial link via pfsense command line and "apctest" command
4. Add APCUPSD widget to PFSense dashboard
5. Get error in screenshot.

Actions #3

Updated by Jordan G 10 months ago

Are you able to try with the month and then day in the first and second numbers respectively when entering the date? I think it's expecting the date format as pictured, I'm trying to recreate but I'm not having any success rewriting my eeprom with the date formatted day first via apctest.

Actions #4

Updated by Lloyd Collins 10 months ago

Done, and it's fixed the problem and the widget is working again, but apctest expects the format in DD/MM/YY and the widget should IMO cater for this as it's the default format for almost any country which isn't the USA.

Actions #5

Updated by Kris Phillips 10 months ago

  • Status changed from Incomplete to Confirmed

Yeah we should add a date format option to the widget so that it properly displayed depending on user input.

Actions #6

Updated by Lloyd Collins 10 months ago

Perfect, thanks Kris :-)

Actions #7

Updated by Jordan G 6 months ago

Not sure where the date format is being pulled from, I'm using an older bn700 APC UPS and my date format is mm/dd/yyyy as depicted when using apctest

Actions

Also available in: Atom PDF