apcupsd crashes when trying to connect to NIS
-
Hi everyone,
i tried to set up apcupsd (Version 0.3.91_10) on my pfsense 2.5.2. I want to connect to an other apcupsd instance (NIS) on the network. After configuring and enabling apcupsd it crashes with the following error:
[26-Jan-2022 14:49:12 Europe/Berlin] PHP Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (31/03/20) at position 0 (3): Unexpected character in /usr/local/www/widgets/widgets/apcupsd.widget.php:253
Stack trace:
#0 /usr/local/www/widgets/widgets/apcupsd.widget.php(253): DateTime->__construct('31/03/20')
#1 /usr/local/www/widgets/widgets/apcupsd.widget.php(339): compose_apc_contents('apcupsd-0')
#2 {main}
thrown in /usr/local/www/widgets/widgets/apcupsd.widget.php on line 253The time string '31/03/20' is the BATTDATE of the ups, so it looks like the network configuration is right.
I'm not an php expert, so maybe some has a solution for this problem? Is there a setting to set the expected date format?Thanks in advance for your help.
-
I know this is an older post but I will respond in case it helps someone with the same error. I agree it appears to be related to how the widget handles the date format pulled from the APC UPS EEPROM.
I ran into the same error after replacing a battery and updating the "battery change date" in the EEPROM. After this change the widget threw the same error as you have posted.
In troubleshooting I referenced the APCUPSD user manual and noticed it shows two different date formats: BATTDATE [ mm/dd/yy | dd/mm/yy ] ... Last battery replacement date. Maximum of 8 characters.
When I saw this I remembered that when I changed the date using APCTEST it had prompted for the "DD/MM/YY" format.
This made me also think it might be related to the date format so I updated the battery date again using "MM/DD/YY" just to test, and this resolved the widget issue in my case.
Summary:
- stop APCUPSD service
- ssh/ open shell
- run apctest
- select option #5 to program EEPROM
- select option #2 to change battery date
- update as MM/DD/YY to make widget happy :)
- save, quit and exit shell
- restart service and enable daemon /NIS
- enable widget and check dashboard
Hope this helps.
-