I’m trying to implement a fix for a problem I encounter using NUT. From time to time, the Thing goes off line and when I check the status on my Pi, the driver isn’t working. I can resolve it 100% of the time by restarting the driver with systemctl restart nut-driver.
I tried setting up an Exec Binding Thing with this command. I added the command to the whitelist. But I get a permission error when I try to run it.
3-06 12:08:56.960 [INFO ] [openhab.event.ItemCommandEvent ] - Item 'Restart_NUTdriver_Running' received command ON
2024-03-06 12:08:56.970 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item 'Restart_NUTdriver_Running' predicted to become ON
2024-03-06 12:08:56.971 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Restart_NUTdriver_Running' updated to ON
2024-03-06 12:08:56.971 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Restart_NUTdriver_Running' changed from OFF to ON
2024-03-06 12:08:56.981 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Restart_NUTdriver_Running' updated to ON
2024-03-06 12:08:57.019 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Restart_NUTdriver_Running' updated to OFF
2024-03-06 12:08:57.020 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item 'Restart_NUTdriver_Running' changed from ON to OFF
2024-03-06 12:08:57.021 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Restart_NUTdriver_Exit_Value' updated to 1
2024-03-06 12:08:57.022 [INFO ] [openhab.event.ItemStateUpdatedEvent ] - Item 'Restart_NUTdriver_Output' updated to Failed to restart nut-driver.service: Interactive authentication required.
See system logs and 'systemctl status nut-driver.service' for details.
Failed to restart nut-driver.service: Interactive authentication required.
See system logs and 'systemctl status nut-driver.service' for details.
I am running openHAB 4.1.1-1 using openhabian (bullseye) on a Pi 4B. I did some internet searches about how to grant permission for a user (in my case openhabian) to execute a command without having to provide an authentication password, but feared I would either create an unintended security vulnerability or mess things up if I experimented with ways to do this.
(I know that the better answer is to figure out why my NUT driver fails. I have spent time researching that and have fiddled with some settings, but don’t see a clear path to resolution, so I’m going with what I hoped would be an easier bandaid solution.)
Running the command from within OH would require the sudo command to be executed by user openhab not openhabian. openhabian is used on the commandline.
Thanks. I think that is exactly what I was looking for. I had seen that suggestion with my internet search, but wasn’t sure how risky it might be.
I don’t think it is the same issue, as it works (until it doesn’t).
I discussed this problem in this thread: NUT-Driver Stale Data
It is on a new SD card
I installed NUT using openHABian. When I migrated to openHAB 4.1, I decided to clean up this install. After running the upgrade, I backed up the openHAB files (using openHABian) and created a clean SD with a fresh download of the latest openHABian. That is when I used openHABian to install NUT, and other than the intermittent failures, it works (and as I said, I can fix it 100% of the time by restarting nut-driver.)
Yes, I replaced the UPS some time last year (I always swap them out when their Connected Equipment guarantee expires.).
I will try the settings suggested in the link you provided. Better to solve the problem than use a work around.
I had in my own research played with the MAXAGE parameter. It was not in the /etc/nut/upsmon.conf file as a default or in the commented sections. (Doesn’t mean it wouldn’t work, just not as obvious). I did change MAXAGE to 25 in the upsd.conf file where it is included in the defaults and comments, but it didn’t seem to make any difference.
I think I will first trying changing the DEADTIME parameter from 15 to 25 in the upsmon.conf file and see if that helps.