When we come to Unix domotic system supervisor, there is a wide range of software able to run on Acmesystems Unix embedded platforms. However, we even have a very simple solution, using cron as action scheduler. The origin of the name cron is from the Greek word for time, χρόνος (chronos) (source Wikipedia). Over Internet, there is a huge amount of tutorials, articles and documentation about cron, one of older and used daemon in Unix since ages. Together with a command line utility able to send commands over our domotic field bus, they are a powerful and simple way to schedule commands on purpose. I'll use here, as examples, my own BTicino SCS domotic system, working in my home since August 2001.
At that time the SCS system was entirely closed, the only software available from vendor being BTicino Visual SCS. It was running on legacy operating system and, even worst, having as user interface just a GUI one. In the end, it was just a toy, not suitable as supervisor. So, in order to run some simple automation on a Unix embedded system, I developed a small perl utility able to send commands over the bus using the BTicino interface L4686. The protocol was reversed enginereed by myself sniffing what the VisualSCS software was sending over the bus. Afterward, switching to Acmesystems Linux embedded systems, I changed it to C language in order to keep it more efficient and with less prerequisites than perl.
In the Debian distro provided by Acmesystems, there is no cron preinstalled. So, you have to install it manually:
sudo apt-get install cron
cron is ba
Now I'll provide here a short description about cron (see references section): it is a scheduler that uses as input a simple text file where each row contains one schedule item and a command to be run when the schedule applies.
The cron configuration file (in /etc/crontab in the past) is changed not directly, but using the command
that will open an editor allowing you to do the changes; saving the file will referesh cron daemon.
In order to display the crontab schedule use
All the rows starting with '#' are ignored.
As an exampl, let show how to configure crontab in order to close a window' roll-up shutter early in the morning in order to shade sun light:
30 7 * 6-9 * /usr/local/bin/scs -r1 -d1 -cdown
Now, whilst the above works perfectly, it is far from being satisfactory as in the time elapsed between June and September the sun rises at very different time and so 7:30 time will result too early in the first and last month and too late in the hottiest months. One could think to create more rows, one for each month, wit a manually crafted timestamp, but that would be quite unconvenient to maintain.
This old utility has been designed just to be used inside crontab. The base concept is to run the utility with a simple setpoint (e.g. sun rise) well in advance before the event time: the program wioll wait untile the right time is it.
sunwait sun up +01:30:00 41.8N 12.4E
So, the cron command becomes:
2 1 * 6-9 * /usr/local/bin/sunwait sun up +01:30:00 41.8N 12.4E ; /usr/local/bin/scs -r1 -d1 -cdown
please note that with that row cron daemon will start the sunwait command well in advance of sunrise. It will block quietly (without any cpu consumption !) till the time plus the offset has arrived. At the point, it terminates and the next command in the row (after the semicolon) is executed: in this case it is lowering the roll-up shade.
Last, in order to get the event right on time, the local clock of the system has to be kept well synchronized.
Build the sunwai utility does require just the gcc C compiler. The procedure follows.
cd /tmp wget http://www.risacher.org/sunwait/sunwait-20041208.tar.gz tar -xvzf sunwait-20041208.tar.gz cd sunwait-20041208/ make sudo cp sunwait /usr/local/bin
If you want to retain the sources locally, skip the first step and start the build from a suitable directory.
Really, on cron, there is a quite large literature, for a good recap see, for example:
Below a couple of references for sunwait:
Le attività del TanzoLab si svolgono ogni mercoledi sera, salvo casi speciali, dalle ore 18:30 presso i locali della Acme Systems srl e consistono in:
Le attività vengono coordinate tramite questo sito, in cui vengono pubblicati tutti i lavori svolti o in via di sviluppo, e tramite un gruppo Telegram con cui per interagire direttamente via chat con gli altri membri.
2018 Ⓒ TanzoLab