Brief: The question is about whether I should modify my Ubuntu 16.04 system to accomplish a task, or is there an easier way.
This is a complex system of computers, involving a mix of languages and operating systems.
After setting up the Ubuntu 16.04 primary system for the solar plant to speak, as per:
16.04 LTS How to make the system announce the time at the top of the hour with eSpeak
EXCERPT: Use espeak
sudo apt-get update
sudo apt-get install espeak
the next step is then to find a way for the remote data-logging systems (8 screens, generated mostly by Ubuntu 16.04 desktops and a Rpi3B) to command the primary Ubuntu 16.04 control system to verbally speak out alerts.
They all are running Python programs to do the logging and sending data to the Prime Ubuntu control system for archiving, image manipulation and uploading to the web hosting service.
Current data plots are created on the Prime Ubuntu 16.04 system using
montage
inImagemagick
to format the plots which can be seen here: https://www.SDsolarBlog.com/montage
To get voice alerts, the first attempt was to have them simply use scp
to update a file in a directory and have the Ubuntu system detect the change to a file and respond by running a script that uses espeak
to announce, for example, that a low-voltage condition exists. All the systems use RSA passwordless logins, so doing the copy is simple.
The go-to-tool for monitoring file and directory changes is incron
- which is similar to cron
except that it triggers based on file system events instead of the clock.
Here is the info on using incron
:
Monitor file and directory activity with incron
EXCERPT:
Start with installing
incron
andinotify-tools
on the Ubuntu 16.04 control system.**
sudo apt-get update
sudo apt-get install incron
sudo apt-get install inotify-tools
sudo apt-get autoremove
then use incrontab -e
to set up a simple entry like so:
/home/me/alarms IN_CREATE /home/me/alarms/saylow24
where the contents of /home/me/scripts/saylow24
are
#!/bin/bash
espeak "Low Voltage on 24"
sleep 10
espeak "Low Voltage on 24"
...so the indoor Ubuntu 16.04 data logger can command the Prime console to speak out a voice alert when the 6 kWh battery bank falls below a threshold voltage.
Then I began to set up a similar script for the outside data logger for the solar panel positioning system, which has its own separate PV panel and battery. Cloudy days are a killer for it.
At that point I stopped and asked myself whether I really wanted to add the extra complexity of using the incron
daemon on the Ubuntu 16.04 console at all. I prefer things to be simple.
Question: Is there an easier way to do this without having to make major changes to Ubuntu?