Skip to content

Commit

Permalink
Vorbereitung WebMatic 2.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ldittmar81 committed Mar 22, 2016
1 parent c84ae04 commit ee5b5b0
Show file tree
Hide file tree
Showing 35 changed files with 638 additions and 71 deletions.
46 changes: 27 additions & 19 deletions generate_img.sh
Original file line number Diff line number Diff line change
@@ -1,43 +1,51 @@
#!/bin/sh

mkdir -p tmp/webmatic
cp webmatic/*.* tmp/webmatic/
cp -a webmatic/cgi tmp/webmatic/
cp -a webmatic/img tmp/webmatic/
cp -a webmatic/libs tmp/webmatic/
mkdir -p tmp/webmatic/js/i18n
cp -a webmatic/js/*.min.js tmp/webmatic/js/
cp -a webmatic/js/i18n/*.min.js tmp/webmatic/js/i18n/
mkdir -p tmp/webmatic/themes
cp -a webmatic/themes/*.min.* tmp/webmatic/themes/
cp -a webmatic/themes/images tmp/webmatic/themes/
cp -a webmatic/themes/fonts tmp/webmatic/themes/
cp -a ccu1 tmp/
cp -a ccu2 tmp/
cp -a ccurm tmp/
cp -a rc.d tmp/
cp -a update_script tmp/

ISALPHA=$(cat ISALPHA)
VERSION=""
STABLEVERSION=""
FOLDER=""

if [ ${ISALPHA} = "0" ]; then
VERSION=$(cat VERSION)
STABLEVERSION=${VERSION}
FOLDER=webmatic
mkdir -p tmp/${FOLDER}
cp -a VERSION tmp/
mkdir -p tmp/rc.d
cp -a rc.d/webmatic tmp/rc.d/
cp -a update_script tmp/
elif [ ${ISALPHA} = "1" ]; then
VERSION=$(cat VERSIONALPHA)
STABLEVERSION=$(cat VERSION)
FOLDER=wmalpha
mkdir -p tmp/${FOLDER}
cp -a VERSIONALPHA tmp/VERSION
mkdir -p tmp/rc.d
cp -a rc.d/wmalpha tmp/rc.d/
cp -a update_script_alpha tmp/update_script
fi

cp webmatic/*.* tmp/${FOLDER}/
cp -a webmatic/cgi tmp/${FOLDER}/
cp -a webmatic/img tmp/${FOLDER}/
cp -a webmatic/libs tmp/${FOLDER}/
mkdir -p tmp/${FOLDER}/js/i18n
cp -a webmatic/js/*.min.js tmp/${FOLDER}/js/
cp -a webmatic/js/i18n/*.min.js tmp/${FOLDER}/js/i18n/
mkdir -p tmp/${FOLDER}/themes
cp -a webmatic/themes/*.min.* tmp/${FOLDER}/themes/
cp -a webmatic/themes/images tmp/${FOLDER}/themes/
cp -a webmatic/themes/fonts tmp/${FOLDER}/themes/
cp -a ccu1 tmp/
cp -a ccu2 tmp/
cp -a ccurm tmp/

GERDATE=$(date +"%d.%m.%y")
HASHDATE=$(date +"%y%m%d")

cd tmp

cd webmatic
cd ${FOLDER}
sed -i "s/BETAVERSION/${VERSION}/g" index.html
sed -i "s/BETAVERSION/${VERSION}/g" get.html
sed -i "s/BETAVERSION/${VERSION}/g" dlgAbout.html
Expand Down
38 changes: 38 additions & 0 deletions rc.d/wmalpha
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
WEBMATICDIR=/usr/local/etc/config/addons/www/wmalpha
CONFIG_URL=/addons/wmalpha/index.html

case "$1" in

""|start|restart|stop)
exit 0
;;

info)
VER=$(cat ${WEBMATICDIR}/VERSION)
echo "Info: <center>"
echo "Info: <b>WebMatic (TEST) ${VER}</b><br>"
echo "Info: <img src='/addons/webmatic/img/misc/webmatic.png'><br>"
echo "Info: <a href='https://github.com/jens-maus/webmatic'>Weitere Infos</a>"
echo "Info: </center>"
echo "Name: WebMatic (TEST)"
echo "Version: ${VER}"
echo "Operations: uninstall"
echo "Config-Url: ${CONFIG_URL}"
echo "Update: /addons/wmalpha/cgi/update-check-alpha.cgi"
;;

uninstall)
${WEBMATICDIR}/update_addon wmalpha
rm -rf ${WEBMATICDIR}
rm -rf ${WEBMATICDIR}_user
;;

*)
echo "Usage: wmalpha {info|uninstall}" >&2
exit 1
;;

esac

exit 0
112 changes: 112 additions & 0 deletions update_script_alpha
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
#!/bin/sh

echo "BEGINN"

ADDONNAME=wmalpha
WWWDIR=/usr/local/etc/config/addons/www/${ADDONNAME}
RCDDIR=/usr/local/etc/config/rc.d
USERDIR=/usr/local/etc/config/addons/www/${ADDONNAME}_user
USERCSS=${USERDIR}/themes/wm-user-theme.css
USERLANG=${USERDIR}/lang.json

if [ "$1" = "" ]; then
echo "CCU1"
mount -t yaffs /dev/mtdblock3 /usr/local
elif [ "$1" = "CCU2" ]; then
echo "CCU2"
mount -t ubifs ubi1:user /usr/local
elif [ "$1" = "HM-RASPBERRYMATIC" ]; then
echo "HM-RASPBERRYMATIC"
mount /usr/local
fi

echo "Installationsumgebung: $1"

# create
echo "Verzeichnisse erstellen"
mkdir -p ${WWWDIR}
chmod 755 ${WWWDIR}
mkdir -p ${RCDDIR}
chmod 755 ${RCDDIR}
mkdir -p ${USERDIR}/themes
mkdir -p ${USERDIR}/img/ids/favorites
mkdir -p ${USERDIR}/img/ids/functions
mkdir -p ${USERDIR}/img/ids/rooms
mkdir -p ${USERDIR}/img/ids/programs
mkdir -p ${USERDIR}/img/ids/variables
mkdir -p ${USERDIR}/img/ids/devices
chmod 755 ${USERDIR}

if [ ! -e "$USERCSS" ]
then
echo "User CSS Datei erstellen"
touch -- "$USERCSS"
else
echo "User CSS Datei vorhanden"
fi

# cleanup
echo "Alte Version entfernen"
rm -rf ${WWWDIR}/*
rm -f ${RCDDIR}/webmatic-dlg

# lang
if [ -e "$USERLANG" ]
then
echo "Sprachdatei vorhanden"
LANG=$(cat ${USERLANG})
echo "Installationssprache: $LANG"
if [ "$LANG" != "de" ]
then
echo "Dateien auf $LANG stellen"
sed -i 's/html lang=\"de\"/html lang=\"'"$LANG"'\"/' ${ADDONNAME}/index.html
sed -i 's/html lang=\"de\"/html lang=\"'"$LANG"'\"/' ${ADDONNAME}/get.html
sed -i 's/wmmap.de.min.js/wmmap.'"$LANG"'.min.js/' ${ADDONNAME}/webmatic.appcache
sed -i 's/wmmap.de.min.js/wmmap.'"$LANG"'.min.js/' ${ADDONNAME}/index.html
sed -i 's/wmmap.de.min.js/wmmap.'"$LANG"'.min.js/' ${ADDONNAME}/get.html
sed -i 's/jtsage-datebox.i18n.de.utf8.min.js/jtsage-datebox.i18n.'"$LANG"'.utf8.min.js/' ${ADDONNAME}/webmatic.appcache
sed -i 's/jtsage-datebox.i18n.de.utf8.min.js/jtsage-datebox.i18n.'"$LANG"'.utf8.min.js/' ${ADDONNAME}/index.html
sed -i 's/jtsage-datebox.i18n.de.utf8.min.js/jtsage-datebox.i18n.'"$LANG"'.utf8.min.js/' ${ADDONNAME}/get.html
sed -i 's/wmLang=\"de\"/wmLang=\"'"$LANG"'\"/' ${ADDONNAME}/js/wmhelper.min.js
else
echo "Installationssprache ist deutsch"
fi
else
echo "Sprachdatei $USERLANG nicht vorhanden"
fi

# copy
echo "Dateien in den richtigen Ordner kopieren"
cp -R ${ADDONNAME}/* ${WWWDIR}/
cp VERSION ${WWWDIR}/
cp rc.d/${ADDONNAME} ${RCDDIR}/
chmod +x ${RCDDIR}/${ADDONNAME}

# copy update_addon program
if [ "$1" = "" ]; then
cp -a ccu1/update_addon ${WWWDIR}/
elif [ "$1" = "CCU2" ]; then
cp -a ccu2/update_addon ${WWWDIR}/
elif [ "$1" = "HM-RASPBERRYMATIC" ]; then
cp -a ccurm/update_addon ${WWWDIR}/
fi

# add menu entry
echo "Menueintrag erstellen"
touch /usr/local/etc/config/hm_addons.cfg
${WWWDIR}/update_addon wmalpha ${WWWDIR}/wmalpha_addon.cfg

# sync filesystem to make sure all changes are written to disk
sync

if [ "$1" = "" ]; then
echo "CCU1"
elif [ "$1" = "CCU2" ]; then
echo "CCU2"
# CCU2 always reboots after Addon/Firmware Update
elif [ "$1" = "HM-RASPBERRYMATIC" ]; then
echo "HM-RASPBERRYMATIC"
# RASPBERRYMATIC always reboots after Addon/Firmware Update
fi

echo "ENDE"
1 change: 1 addition & 0 deletions webmatic/cgi/list.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ cgi_eval {
var obj = dom.GetObject(strList);
strListEnum = obj.EnumUsedIDs();
WriteLine (" -+#+-name-+#+-: -+#+-" # obj.Name() # "-+#+-,");
WriteLine (" -+#+-id-+#+-: -+#+-" # strList # "-+#+-,");
WriteLine (" -+#+-description-+#+-: -+#+-" # obj.EnumInfo() # "-+#+-,");
WriteLine (" -+#+-date-+#+-: -+#+-" # system.Date("%d.%m.%Y %H:%M:%S") # "-+#+-,");

Expand Down
28 changes: 28 additions & 0 deletions webmatic/cgi/update-check-alpha.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/tclsh

set checkURL "https://raw.githubusercontent.com/jens-maus/webmatic/master/VERSIONALPHA"
set downloadURL "https://github.com/jens-maus/webmatic/releases"


catch {
set input $env(QUERY_STRING)
set pairs [split $input &]
foreach pair $pairs {
if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
set $varname $val
}
}
}

if { [info exists cmd ] && $cmd == "download"} {
puts "<meta http-equiv='refresh' content='0; url=$downloadURL' />"
} else {
catch {
set newversion [ exec /usr/bin/wget -qO- --no-check-certificate $checkURL ]
}
if { [info exists newversion] } {
puts $newversion
} else {
puts "n/a"
}
}
87 changes: 87 additions & 0 deletions webmatic/cgi/variablesCreate.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/bin/tclsh

load tclrega.so
source [file join $env(DOCUMENT_ROOT) once.tcl]
source [file join $env(DOCUMENT_ROOT) cgi.tcl]

cgi_eval {
cgi_input
cgi_content_type "text/html; charset=iso-8859-1"

set name ""
set type ""
set description ""
set unit ""
set state ""
set val1 ""
set val2 ""

catch { import name }
catch { import type }
catch { import description }
catch { import unit }
catch { import state }
catch { import val1 }
catch { import val2 }

array set res [rega_script {
string varName = "} $name {";
string varType = "} $type {";
string varDesc = "} $description {";
string varUnit = "} $unit {";
string varState = "} $state {";
string varVal1 = "} $val1 {";
string varVal2 = "} $val2 {";

object svObj = dom.GetObject(varName);

if (!svObj){
object svObjects = dom.GetObject(ID_SYSTEM_VARIABLES);
svObj = dom.CreateObject(OT_VARDP);
svObjects.Add(svObj.ID());

svObj.Name(varName);
svObj.DPInfo(varDesc);
svObj.ValueUnit(varUnit);

if(varType == "2"){
svObj.ValueType(ivtBinary);
svObj.ValueSubType(istBool);

svObj.State(varState == "true");
svObj.ValueName0(varVal1);
svObj.ValueName1(varVal2);
}
if(varType == "4"){
svObj.ValueType(ivtFloat);
svObj.ValueSubType(istGeneric);

svObj.State(varState.ToReal());
svObj.ValueMin(varVal1.ToReal());
svObj.ValueMax(varVal2.ToReal());
}
if(varType == "16"){
svObj.ValueType(ivtBinary);
svObj.ValueSubType(istEnum);

svObj.ValueList(varVal1);
svObj.State(varState.ToInteger());
}
if(varType == "20"){
svObj.ValueType(ivtString);
svObj.ValueSubType(istChar8859);

svObj.State(varState);
}

svObj.Internal(false);
svObj.Visible(true);
dom.RTUpdate(false);

WriteLine ('{ "id" : "' # svObj.ID() # '" }');
WriteLine ('{ "name" : "' # svObj.Name() # '" }');
}
}]

puts -nonewline $res(STDOUT)
}
8 changes: 3 additions & 5 deletions webmatic/dlgAbout.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
<script src="jquery/jquery-2.1.4.min.js"></script>
<script src="jquery/jquery.mobile-1.4.5.min.js"></script>
</head>
<body>

<body>
<div data-role="dialog">

<div data-role="header" data-theme="wma">
Expand All @@ -24,7 +23,7 @@ <h1>&Uuml;ber WebMatic</h1>
<h1>WebMatic VBETAVERSION</h1>
<p>WebMatic ist eine browserbasierte Benutzeroberfl&auml;che f&uuml;r HomeMatic. Die Elemente sind f&uuml;r eine Bedienung mit mobilen Endger&auml;ten optimiert. WebMatic l&auml;uft komplett auf der CCU.</p>
<p>Eine ausführliche Anleitung findet man unter:<br/><a href="http://webmatic.lmdsoft.de/tiki-index.php?page=Inhalt" target="_blank">http://webmatic.lmdsoft.de</a></p>
<p>Bei Problemen und Verbesserungsvorschl&auml;gen bitte das HomeMatic Forum verwenden:<br/><a href="http://homematic-forum.de/forum/viewforum.php?f=39" target="_blank">http://homematic-forum.de/forum/</a></p>
<p>Bei Problemen und Verbesserungsvorschl&auml;gen bitte das HomeMatic Forum verwenden:<br/><a href="http://homematic-forum.de/forum/viewforum.php?f=39" target="_blank">http://homematic-forum.de/forum/</a> oder direkt eine E-Mail an <a href="mailto:help.webmatic@lmdsoft.de">help.webmatic@lmdsoft.de</a> schicken.</p>
<p><b>Haftungsausschluss:</b> Der Autor dieser Software &uuml;bernimmt keinerlei Verantwortung f&uuml;r die Funktionsweise der Software und keinerlei Haftung f&uuml;r Sch&auml;den, die aus der Benutzung dieser Software resultieren.</p>
<p>
<b>Verwendete Bibliotheken</b><br>
Expand All @@ -34,7 +33,7 @@ <h1>WebMatic VBETAVERSION</h1>
<a href="http://pomax.nihongoresources.com/pages/Font.js/">Font.js</a> (MIT Lizenz)<br>
<a href="http://dev.jtsage.com/DateBox/">DateBox</a><br>
<a href="https://github.com/PitPik/tinyColorPicker">tinyColorPicker</a><br>
<a href="http://roundsliderui.com/">roundSlider</a> (MIT Lizenz)<br>
<a href="http://roundsliderui.com/">roundSlider</a> (MIT Lizenz)<br>
</p>
<p><a href="https://github.com/jens-maus/webmatic">WebMatic Github Repository</a></p>
<p>Ich bedanke mich an alle Spender, Tester und Helfer. F&uuml;r die Weiterentwicklung von WebMatic werden gerne Spenden entgegen genommen.</p>
Expand All @@ -48,6 +47,5 @@ <h1>WebMatic VBETAVERSION</h1>
<a href="#" data-role="button" data-icon="check" data-rel="back" data-theme="wmb">Schlie&szlig;en</a>
</div>
</div>

</body>
</html>
2 changes: 1 addition & 1 deletion webmatic/js/i18n/wmmap.de.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webmatic/js/i18n/wmmap.en.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ var textMap = {
THERMALCONTROL_TRANSMIT__COMMUNICATION_REPORTING__FALSE: "-",
THERMALCONTROL_TRANSMIT__WINDOW_OPEN_REPORTING__TRUE: "window open",
THERMALCONTROL_TRANSMIT__WINDOW_OPEN_REPORTING__FALSE: "-",
THERMALCONTROL_TRANSMIT__BATTERY_STATE: "** THERMALCONTROL_TRANSMIT__BATTERY_STATE",
THERMALCONTROL_TRANSMIT__BATTERY_STATE: "battery voltage",
THERMALCONTROL_TRANSMIT__ACTUAL_TEMPERATURE: "temperature",
THERMALCONTROL_TRANSMIT__ACTUAL_HUMIDITY: "current humidity",
THERMALCONTROL_TRANSMIT__BOOST_MODE: "boost mode",
Expand Down
2 changes: 1 addition & 1 deletion webmatic/js/i18n/wmmap.en.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit ee5b5b0

Please sign in to comment.