Skip to content

Commit

Permalink
Merge pull request #7 from jens-maus/master
Browse files Browse the repository at this point in the history
more changes to get hm2mqtt more compatible to RaspberryMatic hardware
  • Loading branch information
owagner committed Oct 21, 2015
2 parents eb10b73 + 4f004ff commit 5b72b24
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.iml
.DS_Store
.idea/
.gradle/
build/
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ task addon(dependsOn: 'jar', type: Tar) {
from 'hm2mqtt-addon/rc.d'
}
into('') {
from 'hm2mqtt-addon/update_script', 'hm2mqtt-addon/update_addon', 'hm2mqtt-addon/hm2mqtt_addon.cfg'
from 'hm2mqtt-addon/update_script', 'hm2mqtt-addon/hm2mqtt_addon.cfg', 'hm2mqtt-addon/VERSION'
}
}

Expand Down
2 changes: 1 addition & 1 deletion hm2mqtt-addon/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.11
0.16
File renamed without changes.
Binary file added hm2mqtt-addon/addon/ccurm/update_addon
Binary file not shown.
27 changes: 27 additions & 0 deletions hm2mqtt-addon/addon/www/update-check.cgi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/tclsh

set checkURL "https://raw.githubusercontent.com/owagner/hm2mqtt/master/hm2mqtt-addon/VERSION"
set downloadURL "https://github.com/owagner/hm2mqtt/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"
}
}
9 changes: 5 additions & 4 deletions hm2mqtt-addon/rc.d/hm2mqtt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ start() {
}

info() {
echo "Info: <b>hm2mqtt</b>"
echo "Info: <a href="https://github.com/owagner/hm2mqtt" target="_blank">Readme</a>"
VER=`cat /usr/local/addons/hm2mqtt/VERSION`
echo "Info: <b>hm2mqtt CCU Addon</b><br>"
echo "Info: <a href="https://github.com/owagner/hm2mqtt" target="_blank">https://github.com/owagner/hm2mqtt</a>"
echo "Name: hm2mqtt"
echo "Version: 0.10"
echo "Version: $VER"
echo "Operations: uninstall restart"
echo "Config-Url: /addons/hm2mqtt"
echo "Update: http://raw.githubusercontent.com/owagner/hm2mqtt/master/hm2mqtt-addon/VERSION"
echo "Update: /addons/hm2mqtt/update-check.cgi"
}

uninstall() {
Expand Down
11 changes: 9 additions & 2 deletions hm2mqtt-addon/update_script
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ chmod 755 $RCD_DIR

# copy addon
chmod 666 addon/options
cp -af addon/* $ADDON_DIR
cp -af addon/* $ADDON_DIR/
cp -af VERSION $ADDON_DIR/

# copy startup script
cp -af rc.d/* $RCD_DIR
Expand All @@ -33,6 +34,12 @@ cp -af rc.d/* $RCD_DIR
ln -sf $ADDON_DIR/www $CONFIG_DIR/addons/www/hm2mqtt

# add menu
./addon/update_addon hm2mqtt hm2mqtt_addon.cfg
if [ "$1" = "CCU2" ]; then
./addon/ccu2/update_addon hm2mqtt hm2mqtt_addon.cfg
ln -sf $ADDON_DIR/ccu2/update_addon $ADDON_DIR/
elif [ "$1" == "HM-RASPBERRYMATIC" ]; then
./addon/ccurm/update_addon hm2mqtt hm2mqtt_addon.cfg
ln -sf $ADDON_DIR/ccurm/update_addon $ADDON_DIR/
fi

sync

0 comments on commit 5b72b24

Please sign in to comment.