Files, scripts, howtos and more for openHAB.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Martin Sebald a644c3508d better transformation strings 7 years ago
.. minor change 7 years ago
USV_dump_log minor changes 7 years ago
ups.items minor changes 7 years ago better transformation strings 7 years ago
ups.rules added apcups 7 years ago

APC UPS devices

Receiving and using information like online status (on AC power or running on battery), battery charging level, autonomy time and more from APC UPS devices.

All you need is a APC UPS device which is connected to a apcupsd daemon. The daemon can run locally on the openHAB machine and or somewhere else. If it runs remote you need to install apcupsd as we access the remote apcupsd installation using the apcaccess command.

First you need to put the USV_dump_log bash script somewhere where you can access it. I created a directory /home/openhabian/scripts for scripts like this one.

Then create a thing in Paper UI. Use the Exec binding and enter the following parameters:

  • Name: USV_dump_log
  • Command: /home/openhabian/scripts/USV_dump_log 3551
  • Transform: REGEX((.*))
  • Interval: 60

The port (3551 is the apcupsd standard port) for accessing the UPS device through apcupsd is a parameter as I check three UPS devices and only want to use one script. This is also the reason why I configured the remote UPS devices (all my UPS devices just have a USB cable, no network interfaces) in the local apcupsd. The data is received from the remote apcupsd installations. You can also modify the IP in the script to access a remote apcupsd installation.

The new thing USV_dump_log gets an id like exec:command:a1b2c3d4 which you then need to enter in the item created through the ups.items file.

  • USV_dump_log: Put the bash script into /home/openhabian/scripts (or somewhere else you like) and chmod 755 it to make it executable.
  • ups.items: Put this file into your /etc/openhab2/items directory and modify it for your specific setup. Maybe everything suits your needs, but you need to modify the string item USV_Log and match the command id in the channel command to the thing you created earlier in Paper UI.
  • Put this file into your /etc/openhab2/transform directory.
  • ups.rules: Put this file into your /etc/openhab2/rules directory. You may want to modify it for your specific setup. You find two excamples for actions if AC power fails. In this case a XMPP message and a message through Telegram is sent.