forked from Freetz/freetz
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wfrog: add support for weather station software for the web, ftp and …
…more. Highly extensible based on python, with start-up script and freetz gui
- Loading branch information
Showing
28 changed files
with
880 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
config FREETZ_PACKAGE_WFROG_WS28XX | ||
bool "ws28xx master" | ||
depends on FREETZ_PACKAGE_WFROG | ||
select FREETZ_PACKAGE_PYTHON_CONFIGOBJ | ||
default n | ||
help | ||
Linux driver based on reverse engineering HeavyWeather | ||
software for La Crosse Technology WS-2813U-IT | ||
(and perhaps WS-28xx series). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
languages | ||
{ de en } | ||
default | ||
{ en } | ||
files | ||
{ | ||
etc/default.wfrog/WV5Datastore_cfg.def | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
wfrog-ws-28xx Freetz package | ||
__ _ __ __ ___ __ | ||
|__ |_) |__ |__ | / | ||
| |\ |__ |__ | /_ | ||
|
||
Copyright (C) 2014 Dirk H <dirk at dhu.homeip.net> | ||
|
||
This is a package for Freetz: http://www.freetz.org/ | ||
|
||
wfrog-ws-28xx sources are available here: | ||
https://github.com/dpeddi/ws-28xx | ||
|
||
This package derives its ideas from the wfrog package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/tmp/flash/wfrog/WV5Datastore.cfg |
18 changes: 18 additions & 0 deletions
18
make/wfrog-ws28xx/files/root/etc/default.wfrog/WV5Datastore.cfg.default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[DataStore] | ||
TransceiverSerNo = ?????????????? | ||
[Settings] | ||
DeviceID = ??? | ||
[TransceiverSettings] | ||
TransmissionFrequency = 1 | ||
[ws28xx] | ||
CheckSumm = 1363 | ||
ClockMode = 0 | ||
TemperatureFormat = 1 | ||
PressureFormat = 1 | ||
RainFormat = 0 | ||
WindspeedFormat = 3 | ||
WeatherThreshold = 3 | ||
StormThreshold = 5 | ||
LCDContrast = 4 | ||
LowBatFlags = 8 | ||
HistoryInterval = 7 |
9 changes: 9 additions & 0 deletions
9
make/wfrog-ws28xx/files/root/etc/default.wfrog/WV5Datastore_cfg.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CAPTION='ws-28xx: WV5Datastore.cfg' | ||
DESCRIPTION='$(lang de:"ws-28xx Treiber Einstellungen" en:"ws-28xx driver settings")' | ||
|
||
CONFIG_FILE='/tmp/flash/wfrog/WV5Datastore.cfg' | ||
CONFIG_SAVE='modsave flash; /mod/etc/init.d/rc.wfrog restart' | ||
CONFIG_TYPE='text' | ||
|
||
TEXT_ROWS=15 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
$(call PKG_INIT_BIN, master) | ||
$(PKG)_SOURCE_MD5:d634bd20e5870d99b98e8772a11dc493 | ||
$(PKG)_DIR:=$($(PKG)_SOURCE_DIR)/ws-28xx-master | ||
$(PKG)_SOURCE:=$($(PKG)_VERSION).zip | ||
$(PKG)_SITE:=https://github.com/dpeddi/ws-28xx/archive | ||
$(PKG)_BINARY:=$($(PKG)_DIR)/*.py | ||
$(PKG)_TARGET_BINARY:=$($(PKG)_DEST_DIR)/usr/lib/wfrog/ws-28xx | ||
|
||
$(PKG_SOURCE_DOWNLOAD) | ||
$(PKG_UNPACKED) | ||
$(PKG_CONFIGURED_NOP) | ||
|
||
$($(PKG)_BINARY): $($(PKG)_DIR)/.configured | ||
|
||
|
||
$($(PKG)_TARGET_BINARY): $($(PKG)_BINARY) | ||
mkdir -p $@ | ||
cp $(WFROG_WS28XX_DIR)/*.py $@ | ||
cp -R $(WFROG_WS28XX_DIR)/wfrog $@ | ||
|
||
$(pkg): | ||
|
||
$(pkg)-precompiled: $($(PKG)_TARGET_BINARY) | ||
|
||
$(pkg)-clean: | ||
$(RM) $(WFROG_WS28XX_DIR)/.configured | ||
|
||
$(pkg)-uninstall: | ||
$(RM) $(WFROG_WS28XX_TARGET_BINARY) | ||
|
||
$(PKG_FINISH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
config FREETZ_PACKAGE_WFROG | ||
bool "wfrog 0.8.2+svn953" | ||
select FREETZ_PACKAGE_PYTHON | ||
select FREETZ_PACKAGE_PYTHON_MOD_ELEMENTTREE | ||
select FREETZ_PACKAGE_PYTHON_MOD_CSV | ||
select FREETZ_PACKAGE_PYTHON_MOD_JSON | ||
select FREETZ_PACKAGE_PYTHON_MOD_SYSLOG | ||
select FREETZ_PACKAGE_PYTHON_MOD_TERMIOS | ||
select FREETZ_PACKAGE_PYTHON_CHEETAH | ||
select FREETZ_PACKAGE_PYTHON_LXML | ||
select FREETZ_PACKAGE_PYTHON_PYGOOGLECHART | ||
select FREETZ_PACKAGE_PYTHON_PYUSB | ||
select FREETZ_PACKAGE_PYTHON_PYYAML | ||
|
||
default n | ||
help | ||
wfrog is a web-based weather station software with nice charts | ||
and many ways to publish them on the web, and much more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[ "$EXTERNAL_FREETZ_PACKAGE_WFROG" == "y" -a "$EXTERNAL_SUBDIRS" == "y" ] && EXTERNAL_FILES+=" /usr/lib/wfrog" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
config EXTERNAL_FREETZ_PACKAGE_WFROG | ||
depends on EXTERNAL_ENABLED && FREETZ_PACKAGE_WFROG | ||
bool "wfrog" | ||
default n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[ "$EXTERNAL_FREETZ_PACKAGE_WFROG" == "y" ] && EXTERNAL_SERVICES+=" wfrog" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
languages | ||
{ de en } | ||
default | ||
{ en } | ||
files | ||
{ | ||
usr/lib/cgi-bin/wfrog.cgi | ||
etc/default.wfrog/settings_yaml.def | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
wfrog Freetz package | ||
__ _ __ __ ___ __ | ||
|__ |_) |__ |__ | / | ||
| |\ |__ |__ | /_ | ||
|
||
Copyright (C) 2014 Dirk H <dirk at dhu.homeip.net> | ||
|
||
This is a package for Freetz: http://www.freetz.org/ | ||
|
||
wfrog sources are available here: | ||
http://www.wfrog.org/ | ||
|
||
This package derives its ideas from the dovecot package. |
8 changes: 8 additions & 0 deletions
8
make/wfrog/files/root/etc/default.wfrog/settings.yaml.default
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
altitude: 70 | ||
station: | ||
driver: auto | ||
units: | ||
press: hPa | ||
rain: mm | ||
temp: C | ||
wind: m/s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CAPTION='wfrog: settings.yaml' | ||
DESCRIPTION='$(lang de:"Wfrog Einstellungen" en:"Wfrog settings")' | ||
|
||
CONFIG_FILE='/tmp/flash/wfrog/settings.yaml' | ||
CONFIG_SAVE='modsave flash; /mod/etc/init.d/rc.wfrog restart' | ||
CONFIG_TYPE='text' | ||
|
||
TEXT_ROWS=15 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export WFROG_ENABLED='no' | ||
export WFROG_CMDLINE='' | ||
export WFROG_LOCATION='' | ||
export WFROG_WS28XX_GREP_IDS='no' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apply_changes() { | ||
/mod/etc/init.d/rc.wfrog config | ||
} | ||
|
||
rc_status() { :; } | ||
|
||
pkg_post_save() { :; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
#!/bin/sh | ||
|
||
DAEMON=wfrog | ||
DAEMON_LONG_NAME="Wfrog - Weather Station Software" | ||
WFROG_HOME=/usr/lib/wfrog | ||
WFROG_DATA=/mod/etc/wfrog | ||
PID_FILE=/var/run/wfrog/wfrog.pid | ||
|
||
PYTHON_ENV="PYTHONPATH=$PYTHONPATH:${WFROG_HOME}/ws-28xx" | ||
WFLOGGER="--backend -m" | ||
WFRENDERER="--renderer -m" | ||
if [ "$(basename $0)" = "wflogger" ] ; then | ||
ARGS=$WFLOGGER | ||
elif [ "$(basename $0)" = "wfrenderer" ] ; then | ||
ARGS=$WFRENDERER | ||
else | ||
ARGS= | ||
fi | ||
|
||
. /etc/init.d/modlibrc | ||
|
||
|
||
export PATH=/usr/local/bin:$PATH | ||
RESTART_TERM1="CRITICAL.*Consumer of events" | ||
|
||
cleanup() { | ||
rm -rf /mod/etc/$DAEMON | ||
rm -rf /var/run/$DAEMON | ||
} | ||
|
||
config() { | ||
[ -d ${WFROG_DATA} ] || mkdir -p ${WFROG_DATA} | ||
if [ ! -e /tmp/flash/${DAEMON}/settings.yaml ]; then | ||
echo -n "Creating $DAEMON configuration ... " | ||
cat /mod/etc/default.${DAEMON}/settings.yaml.default > /tmp/flash/${DAEMON}/settings.yaml | ||
fi | ||
if [ ! -e ${WFROG_DATA}/settings.yaml ]; then | ||
ln -s /tmp/flash/${DAEMON}/settings.yaml ${WFROG_DATA}/settings.yaml | ||
fi | ||
if [ ! -e /tmp/flash/${DAEMON}/WV5Datastore.cfg ] && [ -e /mod/etc/default.${DAEMON}/WV5Datastore.cfg.default ]; then | ||
echo -n "Creating ws-28xx driver configuration ... " | ||
cat /mod/etc/default.${DAEMON}/WV5Datastore.cfg.default > /tmp/flash/${DAEMON}/WV5Datastore.cfg | ||
fi | ||
} | ||
|
||
configure() { | ||
[ -d $(dirname $PID_FILE) ] || mkdir -p $(dirname $PID_FILE) | ||
[ -d ${WFROG_DATA} ] || mkdir -p ${WFROG_DATA} | ||
[ -d ${WFROG_LOCATION} ] || mkdir -p ${WFROG_LOCATION} | ||
[ -d ${WFROG_LOCATION}/data ] || mkdir -p ${WFROG_LOCATION}/data | ||
[ -d ${WFROG_LOCATION}/www ] || mkdir -p ${WFROG_LOCATION}/www | ||
if [ -d ${WFROG_LOCATION}/data ] && [ ! -e ${WFROG_DATA}/data ]; then | ||
ln -s ${WFROG_LOCATION}/data ${WFROG_DATA}/data | ||
fi | ||
if [ -d ${WFROG_LOCATION}/www ] && [ ! -e ${WFROG_DATA}/www ]; then | ||
ln -s ${WFROG_LOCATION}/www ${WFROG_DATA}/www | ||
fi | ||
if [ ! -e ${WFROG_LOCATION}/www/index.html ] && [ -e ${WFROG_LOCATION}/www/3hours.html ]; then | ||
(cd ${WFROG_LOCATION}/www; ln -s 3hours.html index.html) | ||
fi | ||
if [ ! -e $(dirname $0)/restart_WFROG ]; then | ||
ln -s $(dirname $0)/rc.${DAEMON} $(dirname $0)/restart_WFROG | ||
fi | ||
ARGS="$WFROG_CMDLINE $ARGS" | ||
} | ||
|
||
start() { | ||
echo -n "Starting ${DAEMON_LONG_NAME} ... " | ||
|
||
[ -r /etc/options.cfg ] && . /etc/options.cfg | ||
|
||
if [ -z "${WFROG_LOCATION}" ]; then | ||
echo "Warning[$DAEMON]: location is not set" 1>&2 | ||
return 1 | ||
fi | ||
configure | ||
|
||
start-stop-daemon -S -b -m -p $PID_FILE -x /usr/bin/env $PYTHON_ENV $WFROG_HOME/bin/$DAEMON -N15 -- $ARGS | ||
|
||
if [ "${WFROG_WS28XX_GREP_IDS}" = 'yes' ]; then | ||
sleep 60; echo ""; grep -e ID= -e inp= /var/log/wfrog*.log; | ||
fi | ||
|
||
echo "done." | ||
} | ||
|
||
|
||
case $1 in | ||
""|load) | ||
[ ! -d "/tmp/flash/$DAEMON" ] && mkdir -p /tmp/flash/$DAEMON | ||
[ ! -d /mod/etc/wfrog ] && mkdir -p /mod/etc/wfrog | ||
|
||
config | ||
|
||
modreg file $DAEMON yaml 'settings.yaml' 1 "settings_yaml" | ||
[ -e /mod/etc/default.${DAEMON}/WV5Datastore.cfg.default ] && modreg file $DAEMON cfg 'WV5Datastore.cfg' 1 "WV5Datastore_cfg" ||: | ||
modreg cgi $DAEMON wfrog | ||
modreg daemon $DAEMON | ||
|
||
modlib_start $WFROG_ENABLED | ||
;; | ||
unload) | ||
modunreg file $DAEMON | ||
modunreg daemon $DAEMON | ||
modunreg cgi $DAEMON | ||
|
||
modlib_stop | ||
cleanup | ||
;; | ||
config) | ||
config | ||
;; | ||
start) | ||
modlib_start && $(dirname $0)/restart_WFROG restart_WFROG & | ||
;; | ||
restart_WFROG) | ||
sleep 30 | ||
while true; do | ||
tail -1 /var/log/wfrog.log | grep -q -e "$RESTART_TERM1" | ||
if [ $? -eq 0 ] ; then | ||
echo restart $DAEMON | logger -t $DAEMON | ||
$(dirname $0)/rc.${DAEMON} restart | ||
break | ||
else | ||
sleep 60 | ||
fi | ||
done | ||
;; | ||
stop) | ||
killall restart_WFROG | ||
modlib_stop | ||
;; | ||
restart) | ||
modlib_restart | ||
;; | ||
reload) | ||
modlib_reload | ||
;; | ||
status) | ||
modlib_status | ||
;; | ||
*) | ||
echo "Usage: $0 [load|unload|config|start|stop|restart|reload|status]" 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rc.wfrog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rc.wfrog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rc.wfrog |
Oops, something went wrong.