{"id":849,"date":"2022-09-16T08:42:45","date_gmt":"2022-09-16T06:42:45","guid":{"rendered":"http:\/\/blog.peychev.net\/?p=849"},"modified":"2022-11-15T14:54:43","modified_gmt":"2022-11-15T12:54:43","slug":"monitoring-of-small-ups-over-usb-port","status":"publish","type":"post","link":"https:\/\/blog.peychev.net\/?p=849","title":{"rendered":"Monitoring of small UPS over USB port"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I have small offline PowerWalker UPS in one of the service rooms in my apartment in order to keep some home gadgets safe during power outages. As the other small UPS appliances I had in the past this one is not an exception &#8211; the settings are reset if the UPS run out of battery or being restarted. This includes the beeper settings. So if for some reason the UPS is restarted and the next night when you fall asleep late it is most likely the energy supply company to make their maintenance and turn off your house for some time and you will be bring up by this annoying beeper. Well at this moment the first solution that come to my mind was to open the UPS and to take off the beeper, but that wasn&#8217;t the best solution as many bad things may happened during this hardware intervention.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One of my friends point me to <a href=\"https:\/\/networkupstools.org\/\">NUT (Network UPS Tools)<\/a>. Having small debian server around the UPS I immediately looked for a cable and connected the UPS to one of the free USB ports and &#8216;voala&#8217; after some small config adjustments everything worked well and I can put some cronjobs to disable the beeper. Here is what I did:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Installation of the NUT server:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ apt install nut<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Updating of \/etc\/nut\/nut.conf to configure the server as standalone instance:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MODE=standalone<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the nut-scanner for the UPS settings:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># nut-scanner\nSNMP library not found. SNMP search disabled.\nNeon library not found. XML search disabled.\nIPMI library not found. IPMI search disabled.\nScanning USB bus.\nNo start IP, skipping NUT bus (old connect method)\n&#91;nutdev1]\n\tdriver = \"usbhid-ups\"\n\tport = \"auto\"\n\tvendorid = \"06DA\"\n\tproductid = \"FFFF\"\n\tproduct = \"Offline UPS\"\n\tserial = \"000000000\"\n\tvendor = \"PPC\"\n\tbus = \"002\"\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">I grab the settings from the nut-scanner and put them in \/etc\/nut\/ups.conf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>maxretry = 3\n\n&#91;ups]\n\tdriver = \"usbhid-ups\" \n\tport = \"auto\" \n\tvendorid = \"06DA\" \n\tproductid = \"FFFF\" \n\tproduct = \"Offline UPS\" \n\tserial = \"000000000\" \n\tvendor = \"PPC\"\n        bus = \"002\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Update of \/etc\/nut\/upsd.conf:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MAXAGE 40<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Update of \/etc\/nut\/upsmon.conf<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MINSUPPLIES 1\nSHUTDOWNCMD \"\/sbin\/shutdown -h +0\"\nPOLLFREQ 20\nPOLLFREQALERT 10\nHOSTSYNC 15\nDEADTIME 60\nPOWERDOWNFLAG \/etc\/killpower\nRBWARNTIME 43200\nNOCOMMWARNTIME 300\nFINALDELAY 5<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And finally adding a new user in \/etc\/nut\/upsd.users:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;admin]\n     password = 123456\n     actions = SET\n     instcmds = ALL<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Restarting the NUT server to load updated configs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># \/etc\/init.d\/nut-server restart<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the current parameters of the UPS with the upsc command line client:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># upsc ups\nInit SSL without certificate database\nbattery.charge: 100\nbattery.runtime: 2117\nbattery.type: PbAc\ndevice.mfr: PPC\ndevice.model: Offline UPS HID UPS\ndevice.serial: 000000000   \ndevice.type: ups\ndriver.name: usbhid-ups\ndriver.parameter.bus: 002\ndriver.parameter.pollfreq: 30\ndriver.parameter.pollinterval: 2\ndriver.parameter.port: auto\ndriver.parameter.product: Offline UPS\ndriver.parameter.productid: FFFF\ndriver.parameter.serial: 000000000\ndriver.parameter.synchronous: no\ndriver.parameter.vendor: PPC\ndriver.parameter.vendorid: 06DA\ndriver.version: 2.7.4\ndriver.version.data: MGE HID 1.40\ndriver.version.internal: 0.41\ninput.voltage: 234.0\noutlet.1.status: on\noutput.frequency: 50.5\noutput.frequency.nominal: 50\noutput.voltage: 234.0\noutput.voltage.nominal: 230\nups.beeper.status: enabled\nups.delay.shutdown: 20\nups.delay.start: 30\nups.load: 15\nups.mfr: PPC\nups.model: Offline UPS HID UPS\nups.power.nominal: 3\nups.productid: ffff\nups.serial: 000000000   \nups.status: OL\nups.test.result: No test initiated\nups.timer.shutdown: 0\nups.timer.start: 0\nups.type: offline \/ line interactive\nups.vendorid: 06da\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Disabling the beeper:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># upscmd -u admin -p 123456 ups beeper.disable<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check other available commands:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># upscmd -l ups\nInstant commands supported on UPS &#91;ups]:\nbeeper.disable - Disable the UPS beeper\nbeeper.enable - Enable the UPS beeper\nbeeper.mute - Temporarily mute the UPS beeper\nbeeper.off - Obsolete (use beeper.disable or beeper.mute)\nbeeper.on - Obsolete (use beeper.enable)\nload.off - Turn off the load immediately\nload.off.delay - Turn off the load with a delay (seconds)\nload.on - Turn on the load immediately\nload.on.delay - Turn on the load with a delay (seconds)\nshutdown.return - Turn off the load and return when power is back\nshutdown.stayoff - Turn off the load and remain off\nshutdown.stop - Stop a shutdown in progress\ntest.battery.start.deep - Start a deep battery test\ntest.battery.start.quick - Start a quick battery test\ntest.battery.stop - Stop the battery test\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After writing writing a small bash script to check the nut server and restart it if the UPS connection fails for some reason and disabling the beeper I put it as a cronjob and fall to sleep like a baby without annoying beeper sounds \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have small offline PowerWalker UPS in one of the service rooms in my apartment in order to keep some home gadgets safe during power outages. As the other small UPS appliances I had in the past this one is &hellip; <a href=\"https:\/\/blog.peychev.net\/?p=849\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[406,446,444],"class_list":["post-849","post","type-post","status-publish","format-standard","hentry","category-it","tag-linux","tag-nut","tag-ups"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.peychev.net\/index.php?rest_route=\/wp\/v2\/posts\/849","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.peychev.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.peychev.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.peychev.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.peychev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=849"}],"version-history":[{"count":3,"href":"https:\/\/blog.peychev.net\/index.php?rest_route=\/wp\/v2\/posts\/849\/revisions"}],"predecessor-version":[{"id":857,"href":"https:\/\/blog.peychev.net\/index.php?rest_route=\/wp\/v2\/posts\/849\/revisions\/857"}],"wp:attachment":[{"href":"https:\/\/blog.peychev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.peychev.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.peychev.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}