WebNUT: Integrate UPS into the SmartHome

Learn how to install and configure WebNUT in Docker and integrate it into HomeAssistant to monitor your UPS devices in your smart home. 🏠

In this article, I will show you how to install and configure WebNUT in Docker and then integrate it into Home…


This content originally appeared on DEV Community and was authored by Marco

Learn how to install and configure WebNUT in Docker and integrate it into HomeAssistant to monitor your UPS devices in your smart home. 🏠

In this article, I will show you how to install and configure WebNUT in Docker and then integrate it into HomeAssistant. WebNUT is a web interface for Network UPS Tools (NUT) that allows you to monitor UPS devices (uninterruptible power supplies) in your network. The integration with HomeAssistant allows you to integrate the UPS data directly into your smart home system, giving you even more control and overview.

What is WebNUT and why should you use it? 🤔

WebNUT is a practical tool for anyone who has a UPS in their network. With WebNUT, you can:

  • Monitor the status of your UPS in real time.
  • Receive alerts and notifications in the event of power outages or other problems.
  • Have centralized management for multiple UPSs.

Through integration with HomeAssistant, you can also create automated actions based on UPS status, such as shutting down devices during power outages or sending notifications.

Preparation: What you need 🛠️

Before we get started, make sure you have the following things:

  • A Docker-enabled server (e.g. a Raspberry Pi or a Raspberry Pi).e.g. a Raspberry Pi or a NAS)
  • An installed and working Docker environment.
  • HomeAssistant (already installed and configured).

Install WebNUT in Docker 🐳

Step 1: Create a Docker container for WebNUT

Create a new Docker container for WebNUT. To do this, open a terminal and execute the following command:

docker run -d \
  --name=webnut \
  -e TZ=Europe/Berlin \
  -p 80:80 \
  --restart unless-stopped \
  --cap-add=NET_ADMIN \
  christronyxyocum/webnut

This command starts a new Docker container for WebNUT with the necessary settings. Make sure that port 80 is available or adjust the port forwarding accordingly.

Step 2: Configure WebNUT

After the container has started, you should edit the configuration file to add your UPS devices. You can find the configuration file under /etc/nut/ups.conf. You can enter the container and edit the file with an editor such as nano:

docker exec -it webnut /bin/bash
nano /etc/nut/ups.conf

Add the information about your UPS to the file, e.g.:

[myups]
    driver = usbhid-ups
    port = auto
    desc = "My UPS"

Save the file and exit the editor. Restart the NUT service for the changes to take effect.

Integrate WebNUT in HomeAssistant 🏠

Step 1: Add NUT integration in HomeAssistant

Open your HomeAssistant instance and go to the integrations. Add a new integration and search for "Network UPS Tools (NUT)". Select it and configure it with the appropriate settings:

  • Host: IP address_your_WebNUT_container
  • Port: 3493
  • Username: Your_NUT_username (if configured)
  • Password: Your_NUT_password (if configured)

Step 2: Use WebNUT in HomeAssistant

After successful configuration, the UPS data should be available in HomeAssistant. You can now create sensors, notifications and automations based on the UPS status. Example of an automation:

alias: 'Notification in case of power failure'
trigger:
  - platform: state
    entity_id: sensor.myups_status
    to: 'OB Discharging'
action:
  - service: notify.notify
    data:
      message: "Attention! Power failure detected. UPS is running on battery power."

Conclusion 🎉

With WebNUT and Docker, you can monitor your UPS easily and effectively. Integration with HomeAssistant also gives you the opportunity to make your smart home even smarter by setting up automated actions based on the UPS status. Have fun setting it up and trying it out!

If you like my posts, it would be nice if you follow my Blog for more tech stuff.


This content originally appeared on DEV Community and was authored by Marco


Print Share Comment Cite Upload Translate Updates
APA

Marco | Sciencx (2024-07-06T18:02:35+00:00) WebNUT: Integrate UPS into the SmartHome. Retrieved from https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/

MLA
" » WebNUT: Integrate UPS into the SmartHome." Marco | Sciencx - Saturday July 6, 2024, https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/
HARVARD
Marco | Sciencx Saturday July 6, 2024 » WebNUT: Integrate UPS into the SmartHome., viewed ,<https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/>
VANCOUVER
Marco | Sciencx - » WebNUT: Integrate UPS into the SmartHome. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/
CHICAGO
" » WebNUT: Integrate UPS into the SmartHome." Marco | Sciencx - Accessed . https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/
IEEE
" » WebNUT: Integrate UPS into the SmartHome." Marco | Sciencx [Online]. Available: https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/. [Accessed: ]
rf:citation
» WebNUT: Integrate UPS into the SmartHome | Marco | Sciencx | https://www.scien.cx/2024/07/06/webnut-integrate-ups-into-the-smarthome/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.