Do you have a pointer to a recommended replacement script for the Synology?
Her is a screen shot of the script change and the link
https://www.synoforum.com/threads/another-dsm7-regression-ups.6586/post-34027
always make a backup of the original file on the Synolgoy and then put in those edits.
Access denied when connecting to NUT server on Synology (NAS DS918+, DSM 7.1.1 ) from C-7 (2.3.6.144)
The Nut server is connected to a Cyber Power CP1500PFCLCD using a USB and connected to a 2nd NAS and working fine, powering off when the power is lost.
NUT username and password denied with or without, Assess denied?
With Synology everything is more complicated.
Unfortunately, simply connecting with telnet or NC doesn't actually indicate success with Synology's pseudo firewall. You actually have to send a user name. See testing examples at the bottom of the post if you would like details.
First and foremost, you indicate that you are running DSM 7. You should confirm that the UPS network server is enabled, and that the hub's IP address has been added as a permitted device. This is new in DSM 7, and is most likely your problem.
On the Synology, this is configured in:
Control Panel -> Hardware & Power -> UPS -> Permitted DiskStation Devices
Note that access is enabled by IP address, so your hub must have either a static IP or a fixed DHCP address reservation. Dynamic addresses will not work.
Also, you didn't mention the NUT password. Just to be sure, the hardcoded password for Synology is "secret". Be sure it is correct.
You can test Synology access outside of the driver using nc.
This is what it looks like when Synology has been configured to allow a NUT connection from the IP address and the username/password is correct:
# nc -v 192.168.1.10 3493
Connection to 192.168.1.10 3493 port [tcp/nut] succeeded!
USERNAME monuser
OK
PASSWORD secret
OK
LOGIN ups
OK
This is what it looks like when Synology has not been configured to allow a NUT connection:
# nc -v 192.168.1.10 3493
Connection 192.168.1.10 3493 port [tcp/nut] succeeded!
USERNAME monuser
ERR ACCESS-DENIED
This is what is looks like when the connection is allowed but the password incorrect:
# nc -v 192.168.1.10 3493
Connection to 192.168.1.10 3493 port [tcp/nut] succeeded!
USERNAME monuser
OK
PASSWORD badpass
OK
LOGIN ups
ERR ACCESS-DENIED
Note that with an incorrect password you do not receive an access denied message until the login is attempted. An incorrect username behaves the same way.
Agree, Synology is complicated.
Just went in to confirm C-7 hub IP address on Synology Permitted DiskStation Devices for UPS and found it missing, I entered the IP and now it's ONLINE.
Solved. I feel foolish.
The network server is enabled and confirmed working when I tested the UPS, both NAS's (statis IP's) shut down and booted successfully.
Thanks for your help and all the info.
You're welcome. Glad you got it working.
I seem to be having some issues using this NUT client. It seems that it only occasionally successfully connects. Initially I could not get it to connect to the NUT Server (kept saying access denied). I left it overnight, and when I awoke in the morning it was connected and working great! Then I turned off the "shut down server" option, as this is just to monitor another UPS.. Anyway, it immediately disconnected and won't reconnect anymore. it keeps saying Access Denied. I've tried putting in the correct credentials over and over again, but it just will not work. ALL of my other NUT clients connect just fine, so I know it has nothing to do with firewalls or server configuration.
In the logs, it even appears that Hubitat IS getting information from the device, as I see parse entries in the logs with correct current values in them.
Here's the device page and recent log entries:
and here's a couple shots of other NUT clients just to illustrate that NUT Server is working correctly and allowing connections -
Windows:
Home Assistant:
Access Denied indicates that the username/password is not being accepted by the upsd server for login. Even though you are not logged in upsd will still provide basic information regarding a UPS which is why you see information on the UPS.
Odds are that the username/password are simply incorrect. Check the log for upsd on the server. If the server is on a Synology, read a few posts back for more information.
I made sure this wasn't the case before I posted, but just to be super-extra sure, I just literally copied and pasted the username and password from the config file. Same result. Anyway, it was successfully connected for a short period of time, but now simply won't anymore.
It is running as a Home Assistant Add-on.
Looking for that now
On Hubitat's log, I seem to get 2 Parse: OK entries before the Access Denied. Does that give any clues?
Just for fun, I renamed user and ups, changed the password to make it super simple:
user:user
password:123ups
ups name:ups1
created a NEW upsmon device driver. Same result:
Windows works:
Hubitat does not:
Are you sure you are looking at the right config file? Some systems obfuscate which config files they are using.
No. The first two OKs are acks for the USERNAME and PASSWORD commands. The third is the LOGIN command.
The Windows client is probably not actually performing a LOGIN. Some clients don't.
What is in the upsd log file? What version of upsd are you running?
I am trying to find out what version, although the add-on was literally updated a couple weeks ago so I would assume it's pretty current. I'm trying to figure out where it stores more detailed logs as the logs I can find are just the start up of the service, no log in details.
I mean, I don't know whats going on. I literally just went through NUT Server and changed ALL parameters with new username, password, and UPS names. Windows client logs in, shows established connection, all shutdown options are there.... Ubuntu client works fine. Home Assistant client works fine. The ONLY one that gives me any grief about login is this driver and I am absolutely certain based on my testing that the username, password, and ups name are accurate and that basically any other device I can think of trying works without any issues.
I'm trying to figure out where the logs are stored, but I'm kinda at a loss for ideas since the only outlier is Hubitat and I know for sure the username and password are correct.
The REALLY weird thing is that IT WORKED FINE for half a day! Until I changed the "shutdown Host" option, which should have NOTHING to do with logging in, on the device page in Hubitat and then it tried to reconnect again and has failed ever since then. (but I created a new driver in Hubitat so that isn't even really related now)
Go to the driver code, and at line 193, add the following 3 lines:
if (logEnable) {
log.debug("telnetSend: \"${msg}\"")
}
The result should look like this:
void telnetSend(String msg) {
if (logEnable) {
log.debug("telnetSend: \"${msg}\"")
}
sendHubCommand(new hubitat.device.HubAction("${msg}", hubitat.device.Protocol.TELNET))
}
Save the driver code.
Go to the device, and resave. Post the next 20 log lines from the driver.
This?
If so, you're running NUT inside of a docker image managed by Home Assistant. Actual NUT config files and logs are inside the container.
Curious... if you have Ubuntu, why aren't you running upsd there?
Yup thats the one. 12.2 is the version I'm running.
It's in a Hyper-V virtual machine. I tried that first, to be honest, but Hyper-V has terrible support for USB devices. Plus, that machine takes over 60 watts at idle, so it's generally one of the first machines I'd shut down in a power failure, whereas this little raspberry pi only typically consumes 2-3 watts and can keep on ticking til the last little bit of power is left in the ups batteries.
I made those additions on the driver code. I'll post update shortly.
I think you need to log into the container and get the actual config files that NUT is using. ups.conf, upsd.conf, upsd.users. Check for spaces. Check for MAXCONN.
I'll start jumping in. To be honest, I set up Home Assistant on this old Pi 3B+ I had lying around for the sole purpose of using NUT Server. This route seemed easier than just installing it on raspbian or something, plus gives me another automation platform to play with.
I just find it strange that absolutely every other client I've tried works perfectly and instantly on the very first try and Hubitat is the only one to fuss about anything.
I guess the bonus is that since NUT is actually working fine and now I also have a working Home Assistant, I can probably just share it back to Hubitat via Home Assistant Device Bridge and build some automations around it that way, but it seems clunkier going that route....
If you shut down your Windows client, does the Hubitat client work?