Linux service and command line tool for Cristobal Garcia's EMA Weather Station
ema is a software package that talks to the EMA Weather Station through a serial port. Since EMA hardware is rather smart, the server has really very little processing to do, so it can run happily on a Raspberry Pi.
Server main activities are:
-
Maintaining a vector of measurements for the different sensors
-
If voltage threshold is reached it triggers a custom alarm script. Supplied script sends an SMS using the gammu-python package
-
If the roof relay changes state (from open to close and viceversa), it triggers a custom script.
-
Periodically generates a simpe HTML page with the current values, threshold values and callibration constants. This page can be set under the document root of a given webserver.
-
Maintains periodic sync with the host computer RTC.
-
Generates an HTML page with current, averages measurements to be used with a local web server
-
Publishes current, averages and historic data to an MQTT broker
-
Manages active/inactive auxiliar relay time windows. Shuts down host computer if needed.
-
Receives commands from the ema command line tool to manually open or close relays or extending aux relay the Timed mode.
Most of the files contain desing notes explaining its intent. Enjoy !
Simply type:
sudo ./setup.sh
All executables and custom scripts are copied to /usr/local/bin
Type emad -k
to start the service on foreground with console output
An available startup service script for debian-based systems is provided.
Type sudo service emad start
to start it
Type sudo update-rc.d emad defaults
to install it at boot time
By default, file /etc/ema/config
provdes the configuration options needed.
This file is self explanatory.
Log file is placed under /var/log/emad.log
.
Default log level is INFO. It generates very litte logging at this level
File is rotated by a logrotate policy installed under /etc/logrotate.d
.
ema is a command line utility that ends commands to the emad service. It only works in the same LAN, not through Internet.
Commands implemented so far are:
- roof relay force open
- roof relay force close
- aux relay status
- aux relay force open
- aux relay force close
- aux relay, set switch off time to a given HH:MM
- auxrelay, extends switch time by N minutes
Type ema -h
or ema --help
to see actual command line options.