Skip to content

Commit

Permalink
V3.0.0
Browse files Browse the repository at this point in the history
~ Breaking Release / Support für (und nur noch!) InfluxDB V2.x / Issue #41
~ Mindestintervall von 65 Sekunden beim Datenversand an AWEKAS.at
+ Support Zusatzsensor Curconsa FT0300 / Pull Request #55 (LukasTr1980)
~ Anzahl maximaler interner Sensoren von 30 auf 35 angehoben
  • Loading branch information
SBorg2014 committed Mar 17, 2023
1 parent 74e83fb commit 30a6ee3
Showing 1 changed file with 55 additions and 6 deletions.
61 changes: 55 additions & 6 deletions ws_updater.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

UPDATE_VER=V2.21.0
UPDATE_VER=V3.0.0

### Farbdefinition
GR='\e[1;32m'
Expand Down Expand Up @@ -54,7 +54,7 @@ checker() {
sudo systemctl daemon-reload
sudo systemctl restart wetterstation
fi
if [ ! -z ${INFLUX_API} ] && [ $(which influxd) ]; then check_prog influx; fi
if [ ! -z ${INFLUX_API} ]; then check_prog influx; fi
check_prog bc
check_prog jq
check_prog dc
Expand All @@ -67,7 +67,7 @@ checker() {

check_prog() {
if [ $1 == "influx" ]; then
if [ ! $(influxd version|cut -d" " -f2|grep v1.) ]; then echo -e "${RE} Offizieller Support nur für Influx V1.x!\n\n${WE}"; sleep 5; fi
if [ ! $(curl -skL -I "${INFLUX_WEB}://${INFLUX_API}/ping" | grep X-Influxdb-Version | cut -d" " -f2 | grep v2.[0-9].[0-9]) ]; then echo -e "${RE} Offizieller Support nur noch für Influx V2.x!\n\n${WE}"; sleep 5; fi
return
fi
if [ $1 == "restapi" ]; then
Expand Down Expand Up @@ -102,7 +102,7 @@ FEHLER() {
}

patcher() {
echo -en "\n${WE} Soll die ${RE}wetterstation.conf ${WE}nun auf eine neue Version gepatcht werden? [${GR}J/N${WE}]"
echo -en "\n${WE} Soll die ${RE}wetterstation.conf ${WE}nun auf die neue Version ${GE}${UPDATE_VER}${WE} gepatcht werden? [${GR}J/N${WE}]"
read -n 1 -p ": " JN
if [ "$JN" = "J" ] || [ "$JN" = "j" ]; then
echo -e "\n\n\n"
Expand Down Expand Up @@ -143,8 +143,10 @@ patcher() {
V2.17.0) PATCH2180 ;;
V2.18.0) PATCH2190 ;;
V2.19.0) PATCH2200 ;;
V2.20.0) PATCH2210 && exit 0;;
V2.21.0) echo -e "$GE Version ist bereits aktuell...\n" && exit 0;;
V2.20.0) PATCH2210 ;;
V2.21.0) PATCH2220 ;;
V2.22.0) PATCH3000 && exit 0;;
V3.0.0) echo -e "$GE Version ist bereits aktuell...\n" && exit 0;;
*) FEHLER
esac

Expand Down Expand Up @@ -485,6 +487,53 @@ PATCH2210(){
}


#Patch Version V2.21.0 auf V2.22.0
PATCH2220(){
backup
echo -e "${WE}\n Patche wetterstation.conf auf V2.22.0 ..."
sed -i 's/### Settings V2.21.0/### Settings V2.22.0/' ./wetterstation.conf
sed -i 's/Anzahl der vorhandenen Zusatzsensoren/Anzahl der vorhandenen Zusatzsensoren Froggit, Ecowitt und Bresser/' ./wetterstation.conf
sed -i '/^.*ANZAHL_DP300=.*/a \ ANZAHL_7009999=0' ./wetterstation.conf
echo -e "\n${WE} Fertig...\n"
echo -e " ${GE}Eventuelle Zusatzsensoren Bresser #7009999 können nun eingetragen werden!${WE}"
echo -e " ${GE}Dazu noch 'wetterstation.js' im ioB ersetzen, konfigurieren und einmalig ausführen.\n${WE}"
}


#Patch Version V2.22.0 auf V3.0.0
PATCH3000(){
echo -e "${RE}"'
___ __ __ __
/ | _____/ /_ / /___ ______ ____ _ / /
/ /| |/ ___/ __ \/ __/ / / / __ \/ __ `/ / /
/ ___ / /__/ / / / /_/ /_/ / / / / /_/ / /_/
/_/ |_\___/_/ /_/\__/\__,_/_/ /_/\__, / (_)
/____/'"${WE}"

echo -e "\n${GE} ┌──────────────────────────────────────────────────────┐"
echo -e " │ V3.0.0 ist ein Breaking-Release! │"
echo -e " │ Es wird zwingend bei der Nutzung der Influx-Features │"
echo -e " │ InfluxDB mindestens in der Version 2.x oder höher │"
echo -e " │ benötigt ! │"
echo -e " └──────────────────────────────────────────────────────┘${WE}\n"

jn_abfrage "${WE}\n Möchten Sie ${BL}WLAN-Wetterstation${WE} auf Version V3.0.0 updaten?"
if [ -z $antwort ]; then echo -e "\n ${RE}Abbruch...${WE}\n\n"; exit 1; fi
unset antwort

backup
echo -e "${WE}\n Patche wetterstation.conf auf V3.0.0 ..."
sed -i 's/### Settings V2.22.0/### Settings V3.0.0/' ./wetterstation.conf
sed -i 's/#Name, User und Passwort der InfluxDB-Datenbank/#Bucket, Token und Organisation der InfluxDB/' ./wetterstation.conf
sed -i 's/INFLUX_DB=/INFLUX_BUCKET=/' ./wetterstation.conf
sed -i 's/INFLUX_USER=.*/INFLUX_TOKEN=/' ./wetterstation.conf
sed -i 's/INFLUX_PASSWORD=.*/INFLUX_ORG=/' ./wetterstation.conf
sed -i '/^.*#InfluxDB-Konfiguration \/ ohne InfluxDB alles leer lassen.*/a \ #Protokoll (HTTP oder HTTPS) / default: HTTP\n INFLUX_WEB=HTTP' ./wetterstation.conf
echo -e "\n${WE} Fertig...\n"
echo -e " ${GE}InfluxDB in Version 2.x kann nun in der Konfiguration aktiviert werden.\n${WE}"
}


patch_260() {
cat <<EoD >patch
--- wetterstation.conf_250 2021-05-13 13:45:06.297750501 +0200
Expand Down

0 comments on commit 30a6ee3

Please sign in to comment.