...
Just my blog

Blog about everything, mostly about tech stuff I made. Here is the list of stuff I'm using at my blog. Feel free to ask me about implementations.

Soft I recommend
Py lib I recommend

I'm using these libraries so you can ask me about them.

Raspberry 5 test-to-speech using Piper

How to make your Raspberry 5 talking with python lib Piper?

I wanted to make my Raspberry tell me about power outages and air alerts near my location.

The setup is pretty simple and described ar the repo:

I didn't want to waste my time making yet another Python venv and that's why I've chosen a simple binary mode.

Setup

Now about the setup:

  • Raspberry 5.
  • USB sound card with 3.5 jack.
  • USB-powered speaker with a 3.5 jack.

Sound

CMD to change the volume programmatically:

amixer set Master 80% >> /dev/null

 Sound devices and controls

You may have a problem with playing generated WAV files and making voice directly. So you need to choose devices for a different output.

To list devices run:

# List devices
aplay -L
# I only have USB card:
hw:CARD=Audio,DEV=0
     USB Audio, USB Audio
    Direct hardware device without any conversions
plughw:CARD=Audio,DEV=0
     USB Audio, USB Audio
    Hardware device with all software conversions
sysdefault:CARD=Audio
     USB Audio, …

Read...

Installing NUT - Network Ups Tool Notifications and emails

Installing NUT - Network Ups Tool Notifications and emails

Notifications and email

Just a simple work log of installing NUT and configuring email notifications from it.

 

Simple

 Go to file:

sudo vi /etc/nut/upsmon.conf
Add at the EOF:
# Email script for NOTIFYCMD
# Simple
NOTIFYCMD "/etc/nut/notifycmd.sh"

# Notification events
NOTIFYFLAG ONLINE     SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT     SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT    SYSLOG+WALL+EXEC
NOTIFYFLAG FSD        SYSLOG+WALL+EXEC
NOTIFYFLAG COMMOK     SYSLOG+WALL+EXEC
NOTIFYFLAG COMMBAD    SYSLOG+WALL+EXEC
NOTIFYFLAG SHUTDOWN   SYSLOG+WALL+EXEC
NOTIFYFLAG REPLBATT   SYSLOG+WALL+EXEC
NOTIFYFLAG NOCOMM     SYSLOG+WALL+EXEC
NOTIFYFLAG NOPARENT   SYSLOG+WALL+EXEC

 

Simple notification script

 

sudo vi /etc/nut/notifycmd.sh

 

#!/bin/bash
EMAIL='to@YOYR_EMAIL.com'
echo -e "Subject: UPS ALERT Basic: $NOTIFYTYPE\n\nUPS: $UPSNAME\r\nAlert type: $NOTIFYTYPE\n\n\nThis is a basic notification!" | msmtp $EMAIL
Exec rights
 
# Change group to nut
sudo chown :nut /etc/nut/notifycmd.sh
# Add execution
sudo chmod 774 /etc/nut/notifycmd.sh
# Restart the NUT services
sudo systemctl restart nut-server.service
sudo systemctl restart nut-driver.service
sudo systemctl restart nut-monitor.service
 

Extra notification script by Scheduler

Read...

Installing NUT - Network Ups Tool

Install and use Network Ups Tool - an open source Uninterruptible Power Supply software

I'll describe a full path on how to install and use NUT.
My implementation is using Raspberry Pi 5 and a TP-Link router attached to 800W UPS.
RPi will be a brain unit which will send notifications to email and make a voice notification about power outages and battery levels.
 
My current surge and power loss protection scheme is the following:
  • UPS with connected devices:
    • LG TV
    • Soundbar
    • NUC as a media centre (with NUT monitor for Windows)
    • RPi5 as brain unit with NUT, Pi-Hole and DHCP.
    • TP-Link Router.

In case of a power-loss event, PRi will notify me via email, NUC will power off on its own, TV can be powered off manually.

Powered-off TV and soundbar are neglectable in total power usage on battery, so I have about 1,5 to 2 hours of running Raspberry 5 and TP-Link to keep my internet on.

Now to the setup. …

Read...