Code: Alles auswählen
! Version prüfen
! ==============
! CCU-Hardware
string tmpD= "cat /boot/VERSION";
string tmpE;
string tmpF;
system.Exec(tmpD, &tmpE, &tmpF);
integer tmpG= tmpE.Length();
if (tmpE.Length() < 18) {var tmpA = "http://update.homematic.com/firmware/download?cmd=js_check_version&version=12345&product=HM-CCU2&serial=12345";}
else {var tmpA = "https://gitcdn.xyz/repo/jens-maus/RaspberryMatic/master/release/LATEST-VERSION.js";}
! Firmwareupdate auslesen und reagieren (c) by Alchy
var tmpB;
system.Exec("cat /boot/VERSION | cut -d'=' -f2", &tmpB);
dom.GetObject("CUxD.CUX2801001:2.CMD_SETS").State("wget -q -O - '"#tmpA#"'");
dom.GetObject("CUxD.CUX2801001:2.CMD_QUERY_RET").State(1);
var tmpC= dom.GetObject("CUxD.CUX2801001:2.CMD_RETS").State().StrValueByIndex("'",1);
if (tmpB.Find(tmpC)==0) {WriteLine("No Update, weil alt: "#tmpB#" und neu "#tmpC);
dom.GetObject("SV_Update_vorhanden").State(true);
dom.GetObject("SV_Update_Version").State("kein Update vorhanden");}
else
{WriteLine("New Version, weil alt: "#tmpB#" und neu "#tmpC);
dom.GetObject("SV_Update_vorhanden").State(false);
dom.GetObject("SV_Update_Version").State("Update vorhanden: "#tmpC);}
WriteLine(dom.GetObject("SV_Update_vorhanden").State());
tmpC ist auf jedenfall die Version aus dem Netz.
Ich habe noch die Systemvariable "SV_Update_vorhanden" Boolean genommen um bei einem vorhandenen Update darauf zu reagieren. Bsp. Sprachansage oder im Tablet wird das entsprechend angezeigt.
Die Sytemvariable "SV_Update_Version" ist nur als Text "Update vorhanden: XXXXX" oder "Kein Update vorhanden"
In dem Zusammenhang die Frage an die Cracks. Wieso ist hinter tmpC ein Umbruch?
Code: Alles auswählen
WriteLine(tmpC);
WriteLine("----");
Code: Alles auswählen
VERSION
-----
Eine besinnliche und schöne Weihnachtszeit wünsch ich Euch allen.
Andi