From eda387abf484cd2577bc391a92381eda4d34f302 Mon Sep 17 00:00:00 2001 From: jhartworks Date: Mon, 2 Mar 2026 22:38:34 +0100 Subject: [PATCH] Added App but not ready --- Awtrix App/form.json | 18 ++ Awtrix App/module.json | 14 + Awtrix App/module.php | 633 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 665 insertions(+) create mode 100644 Awtrix App/form.json create mode 100644 Awtrix App/module.json create mode 100644 Awtrix App/module.php diff --git a/Awtrix App/form.json b/Awtrix App/form.json new file mode 100644 index 0000000..2baaaac --- /dev/null +++ b/Awtrix App/form.json @@ -0,0 +1,18 @@ +{ + "elements": + [ + { "type": "ValidationTextBox", "name": "AwtrixIp", "caption": "IP or Hostname of Awtrix Clock" }, + { "type": "ValidationTextBox", "name": "Prefix", "caption": "" }, + { "type": "ValidationTextBox", "name": "Suffix", "caption": "" } + + + ], + "actions": + [ + { "type": "Button", "label": "Send App", "onClick": "AWAPP_SendApp($id);" } + ], + "status": + [ + + ] +} \ No newline at end of file diff --git a/Awtrix App/module.json b/Awtrix App/module.json new file mode 100644 index 0000000..0513181 --- /dev/null +++ b/Awtrix App/module.json @@ -0,0 +1,14 @@ +{ + "id": "{6637E1B4-E90A-68C3-4FFD-CE8969F9F693}", + "name": "Awtrix App", + "type": 3, + "vendor": "Awtrix", + "aliases": + [ + ], + "url": "https://blueforcer.github.io/", + "parentRequirements": [], + "childRequirements": [], + "implemented": [], + "prefix": "AWAPP" +} \ No newline at end of file diff --git a/Awtrix App/module.php b/Awtrix App/module.php new file mode 100644 index 0000000..ff54c99 --- /dev/null +++ b/Awtrix App/module.php @@ -0,0 +1,633 @@ +RegisterAttributeString('Settings',''); + + + $this->RegisterPropertyString('AwtrixIp','172.78.88.67'); + $this->RegisterPropertyString('Prefix','You App says '); + $this->RegisterPropertyString('Suffix',''); + + $this->RegisterVariableString('finaltext', 'Displayed Text', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_TEXT + ], 0); + + $this->RegisterVariableInteger ('textCase', 'Text Case', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 2, + 'STEP_SIZE' => 1, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => '', + ], 0); + $this->EnableAction("textCase"); + SetValueInteger($this->GetIDForIdent("textCase"),7); + + $this->RegisterVariableBoolean('topText', 'Display Text on Top', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 170); + $this->EnableAction("topText"); + SetValueBoolean($this->GetIDForIdent("topText"),0); + + $this->RegisterVariableBoolean('center', 'Display Text Center', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 170); + $this->EnableAction("center"); + SetValueBoolean($this->GetIDForIdent("center"),0); + + + $this->RegisterVariableInteger ('color', 'Global App Color',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 30); + $this->EnableAction("color"); + SetValueInteger($this->GetIDForIdent("color"),16777215); ///is white...Frank White + + $this->RegisterVariableBoolean('gradient', 'Display Color Gradient', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 170); + $this->EnableAction("gradient"); + SetValueBoolean($this->GetIDForIdent("gradient"),0); + + $this->RegisterVariableInteger ('gradient01', 'Gradient Color 01',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 30); + $this->EnableAction("gradient01"); + SetValueInteger($this->GetIDForIdent("gradient01"),16777215); ///is white...Frank White + + $this->RegisterVariableInteger ('gradient02', 'Gradient Color 02',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 30); + $this->EnableAction("gradient02"); + SetValueInteger($this->GetIDForIdent("gradient02"),16777215); ///is white...Frank White + + $this->RegisterVariableInteger ('blinkText', 'Blinktime Text', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 2000, + 'STEP_SIZE' => 50, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => ' ms' + ], 20); + $this->EnableAction("blinkText"); + SetValueInteger($this->GetIDForIdent("blinkText"),0); + + $this->RegisterVariableInteger ('fadeText', 'Fade Text', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 2000, + 'STEP_SIZE' => 50, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => ' ms' + ], 20); + $this->EnableAction("fadeText"); + SetValueInteger($this->GetIDForIdent("fadeText"),0); + + $this->RegisterVariableInteger ('background', 'Backgroundcolor',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 30); + $this->EnableAction("background"); + SetValueInteger($this->GetIDForIdent("background"),0); ///Jack Black + + $this->RegisterVariableBoolean('rainbow', 'Rainbow', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 170); + $this->EnableAction("rainbow"); + SetValueBoolean($this->GetIDForIdent("rainbow"),0); + + + $this->RegisterVariableInteger ('icon', 'Icon (must be downloaded on WebIf)', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_VALUE_INPUT, + 'SUFFIX' => '', + ], 0); + $this->EnableAction("icon"); + SetValueInteger($this->GetIDForIdent("icon"),0); + + $this->RegisterVariableInteger ('pushIcon', 'Push Icon', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 2, + 'STEP_SIZE' => 1, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => '', + ], 0); + $this->EnableAction("pushIcon"); + SetValueInteger($this->GetIDForIdent("pushIcon"),7); + + + $this->RegisterVariableInteger ('repeat', 'Repeat', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => -1, + 'MAX' => 20, + 'STEP_SIZE' => 1, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => '' + ], 10); + $this->EnableAction("repeat"); + SetValueInteger($this->GetIDForIdent("repeat"),-1); + + $this->RegisterVariableInteger ('duration', 'Duration', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 1, + 'MAX' => 60, + 'STEP_SIZE' => 1, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => '' + ], 10); + $this->EnableAction("duration"); + SetValueInteger($this->GetIDForIdent("duration"),-1); + + + + + + + + + + + + + + + + + + + $this->RegisterVariableInteger ('TCOL', 'Global Text Color',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 30); + $this->EnableAction("TCOL"); + SetValueInteger($this->GetIDForIdent("TCOL"),16777215); ///is white...Frank White + + $this->RegisterVariableInteger ('TMODE', 'Time App Style',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 6, + 'STEP_SIZE' => 1, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => '' + ], 40); + $this->EnableAction("TMODE"); + SetValueInteger($this->GetIDForIdent("TMODE"),1); + + $this->RegisterVariableInteger ('CHCOL', 'Calendar Header Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 50); + $this->EnableAction("CHCOL"); + SetValueInteger($this->GetIDForIdent("CHCOL"),16711680); //Red like Reddington + + + $this->RegisterVariableInteger ('CBCOL', 'Calendar Body Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 60); + $this->EnableAction("CBCOL"); + SetValueInteger($this->GetIDForIdent("CBCOL"),16777215); //white + + + $this->RegisterVariableInteger ('CTCOL', 'Calendar Text Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 70); + $this->EnableAction("CTCOL"); + SetValueInteger($this->GetIDForIdent("CTCOL"),0); //i see black for you + + $this->RegisterVariableBoolean ('WD', 'show Weekday', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 80); + $this->EnableAction("WD"); + SetValueBoolean($this->GetIDForIdent("WD"),0); + + $this->RegisterVariableInteger ('WDCA', 'Active Weekday Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 90); + $this->EnableAction("WDCA"); + SetValueInteger($this->GetIDForIdent("WDCA"),65535); + + $this->RegisterVariableInteger ('WDCI', 'Inactive Weekday Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 100); + $this->EnableAction("WDCI"); + SetValueInteger($this->GetIDForIdent("WDCI"),35071); + + $this->RegisterVariableInteger ('BRI', 'Brightness', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 255, + 'PERCENTAGE' => true, + 'USAGE_TYPE' => 2, ///5 = none + 'SUFFIX' => ' %' + ], 110); + $this->EnableAction("BRI"); + SetValueInteger($this->GetIDForIdent("BRI"),128); + + $this->RegisterVariableBoolean ('ABRI', 'Automatic Brightness', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 120); + $this->EnableAction("ABRI"); + SetValueBoolean($this->GetIDForIdent("ABRI"),0); + + $this->RegisterVariableBoolean ('ATRANS', 'Automatic Transsions to next App', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 130); + $this->EnableAction("ATRANS"); + SetValueBoolean($this->GetIDForIdent("ATRANS"),1); + + $this->RegisterVariableBoolean('BLOCKN', 'Local Key Enable', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 160); + $this->EnableAction("BLOCKN"); + SetValueBoolean($this->GetIDForIdent("BLOCKN"),1); + + + + $this->RegisterVariableInteger ('TIME_COL', 'Time Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 180); + $this->EnableAction("TIME_COL"); + SetValueInteger($this->GetIDForIdent("TIME_COL"),16777215); + + $this->RegisterVariableInteger ('DATE_COL', 'Date Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 190); + $this->EnableAction("DATE_COL"); + SetValueInteger($this->GetIDForIdent("DATE_COL"),16777215); + + $this->RegisterVariableInteger ('TEMP_COL', 'Temperature Color',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 200); + $this->EnableAction("TEMP_COL"); + SetValueInteger($this->GetIDForIdent("TEMP_COL"),16777215); + + $this->RegisterVariableInteger ('HUM_COL', 'Humidity Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 210); + $this->EnableAction("HUM_COL"); + SetValueInteger($this->GetIDForIdent("HUM_COL"),16777215); + + $this->RegisterVariableInteger ('BAT_COL', 'Battery Color', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_COLOR, + 'ENCODING' => 0, + 'COLOR_SPACE' => 0, + 'COLOR_CURVE' => 0 + ], 220); + $this->EnableAction("BAT_COL"); + SetValueInteger($this->GetIDForIdent("BAT_COL"),16777215); + + $this->RegisterVariableInteger ('SSPEED', 'Scrollspeed',[ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 100, + 'PERCENTAGE' => true, + 'USAGE_TYPE' => 2, ///5 = none + 'SUFFIX' => ' %' + ], 230); + $this->EnableAction("SSPEED"); + SetValueInteger($this->GetIDForIdent("SSPEED"),100); + + $this->RegisterVariableBoolean('MATP', 'Powerswitch', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH + ], 240); + $this->EnableAction("MATP"); + SetValueBoolean($this->GetIDForIdent("MATP"),1); + + $this->RegisterVariableString ('OVERLAY', 'Effectsoverlay', [ + 'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER, + 'MIN' => 0, + 'MAX' => 2000, + 'STEP_SIZE' => 50, + 'USAGE_TYPE' => 5, ///5 = none + 'SUFFIX' => ' ms' + ], 250); + /*Overlay effects: + + "clear" + "snow" + "rain" + "drizzle" + "storm" + "thunder" + "frost"*/ + + // Diese Zeile nicht löschen. + $this->UpdateConfig(); + + $this->RegisterTimer("Update", 0, 'AWSET_UpdateConfig('.$this->InstanceID.');'); + $this->SetTimerInterval("Update", 10 * 1000); + + parent::Create(); + + } + + // Überschreibt die intere IPS_ApplyChanges($id) Funktion + public function ApplyChanges() { + + $this->SendSetting(); + $this->SendReboot(); + + // Diese Zeile nicht löschen + parent::ApplyChanges(); + } + /** + * Die folgenden Funktionen stehen automatisch zur Verfügung, wenn das Modul über die "Module Control" eingefügt wurden. + * Die Funktionen werden, mit dem selbst eingerichteten Prefix, in PHP und JSON-RPC wiefolgt zur Verfügung gestellt: + * + * DWM_SendMessage($id); + * + */ + public function RequestAction($Ident, $Value) { + $varid = $this->GetIDForIdent($Ident); + SetValue($varid, $Value); + + + $this->SendSetting(); + } + + public function SendSetting() { + + // Discord webhook URL + $awtrixIp = $this->ReadPropertyString("AwtrixIp"); + $url="http://{$awtrixIp}/api/settings"; + + $atime = GetValue($this->GetIDForIdent('ATIME')); + $teff = GetValue($this->GetIDForIdent('TEFF')); + $tspeed = GetValue($this->GetIDForIdent('TSPEED')); + $tcol = GetValue($this->GetIDForIdent('TCOL')); + $tmode = GetValue($this->GetIDForIdent('TMODE')); + + $chcol = GetValue($this->GetIDForIdent('CHCOL')); + $cbcol = GetValue($this->GetIDForIdent('CBCOL')); + $ctcol = GetValue($this->GetIDForIdent('CTCOL')); + $wd = GetValueBoolean($this->GetIDForIdent('WD')); + $wdca = GetValue($this->GetIDForIdent('WDCA')); + $wdci = GetValue($this->GetIDForIdent('WDCI')); + $bri = GetValue($this->GetIDForIdent('BRI')); + $abri = GetValueBoolean($this->GetIDForIdent('ABRI')); + $atrans = GetValueBoolean($this->GetIDForIdent('ATRANS')); + + $ccorrection = $this->ReadPropertyInteger("CCORRECTION"); + $ctemp = $this->ReadPropertyInteger("CTEMP"); + + $tformat = $this->ReadPropertyString("TFORMAT"); + $dformat = $this->ReadPropertyString("DFORMAT"); + + $som = $this->ReadPropertyBoolean("SOM"); + $cel = $this->ReadPropertyBoolean("CEL"); + + $blockn = GetValueBoolean($this->GetIDForIdent('BLOCKN')); + $uppercase = GetValueBoolean($this->GetIDForIdent('UPPERCASE')); + + $time_col = GetValue($this->GetIDForIdent('TIME_COL')); + $date_col = GetValue($this->GetIDForIdent('DATE_COL')); + $temp_col = GetValue($this->GetIDForIdent('TEMP_COL')); + $hum_col = GetValue($this->GetIDForIdent('HUM_COL')); + $bat_col = GetValue($this->GetIDForIdent('BAT_COL')); + + $sspeed = GetValue($this->GetIDForIdent('SSPEED')); + + $tim = $this->ReadPropertyBoolean("TIM"); + $dat= $this->ReadPropertyBoolean("DAT"); + $hum = $this->ReadPropertyBoolean("HUM"); + $temp = $this->ReadPropertyBoolean("TEMP"); + $bat = $this->ReadPropertyBoolean("BAT"); + + $matp = GetValueBoolean($this->GetIDForIdent('MATP')); + + + $settings = [ + + // Anzeige + "ATIME" => $atime, + "TEFF" => $teff, + "TSPEED" => $tspeed, + "TMODE" => $tmode, + + // Farben + "TCOL" => dechex($tcol), + "TIME_COL" => dechex($time_col), + "DATE_COL" => dechex($date_col), + "TEMP_COL" => dechex($temp_col), + "HUM_COL" => dechex($hum_col), + "BAT_COL" => dechex($bat_col), + + "CHCOL" => dechex($chcol), + "CBCOL" => dechex($cbcol), + "CTCOL" => dechex($ctcol), + + "WDCA" => dechex($wdca), + "WDCI" => dechex($wdci), + + // Time / Date + "TFORMAT" => $tformat, + "DFORMAT" => $dformat, + + // Verhalten + "WD" => $wd, + "SOM" => $som, + "CEL" => $cel, + + // Matrix + "BRI" => $bri, + "ABRI" => $abri, + "ATRANS" => $atrans, + "CCORRECTION" => $ccorrection, + "CTEMP" => $ctemp, + "BLOCKN" => $blockn, + "UPPERCASE" => $uppercase, + "MATP" => $matp, + + // Apps aktivieren + "TIM" => $tim, + "DAT" => $dat, + "TEMP" => $temp, + "HUM" => $hum, + "BAT" => $bat, + + // Overlay Effekt + "OVERLAY" => "clear", + + // Scroll Speed + "SSPEED" => $sspeed, + + // Sound + "VOL" => 10 + ]; + + // ============================= + // CURL Request + // ============================= + $ch = curl_init($url); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + "Content-Type: application/json" + ]); + + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($settings)); + + $response = curl_exec($ch); + $error = curl_error($ch); + + curl_close($ch); + + //$this->WriteAttributeString('Settings',$settings); + + + } + public function UpdateConfig() { + + $awtrixIp = $this->ReadPropertyString("AwtrixIp"); + $url="http://{$awtrixIp}/api/settings"; + + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HTTPGET, true); + + $response = curl_exec($ch); + $error = curl_error($ch); + + curl_close($ch); + + if ($error) { + echo "CURL Error: " . $error; + exit; + } + + $data = json_decode($response, true); + + // $persData = $this->ReadAttributeString('Settings'); + + + Setvalue($this->GetIDForIdent('ATIME'),$data['ATIME']); + Setvalue($this->GetIDForIdent('TEFF'),$data['TEFF']); + Setvalue($this->GetIDForIdent('TSPEED'),$data['TSPEED']); + Setvalue($this->GetIDForIdent('TCOL'),$data['TCOL']); + Setvalue($this->GetIDForIdent('TMODE'),$data['TMODE']); + Setvalue($this->GetIDForIdent('CHCOL'),$data['CHCOL']); + Setvalue($this->GetIDForIdent('CBCOL'),$data['CBCOL']); + Setvalue($this->GetIDForIdent('CTCOL'),$data['CTCOL']); + SetValueBoolean($this->GetIDForIdent('WD'),$data['WD'] ?? false); + Setvalue($this->GetIDForIdent('WDCA'),$data['WDCA']); + Setvalue($this->GetIDForIdent('WDCI'),$data['WDCI']); + Setvalue($this->GetIDForIdent('BRI'),$data['BRI']); + SetValueBoolean($this->GetIDForIdent('ABRI'),$data['ABRI'] ?? false); + SetValueBoolean($this->GetIDForIdent('ATRANS'),$data['ATRANS'] ?? false); + + $this->UpdateFormField("CCORRECTION",'value',hexdec($data['CCORRECTION']) ?? 0); + $this->UpdateFormField("CTEMP",'value',hexdec($data['CTEMP']) ?? 0); + + $this->UpdateFormField("TFORMAT",'value',$data['TFORMAT']); + $this->UpdateFormField("DFORMAT",'value',$data['DFORMAT']); + + $this->UpdateFormField("SOM",'value',$data['SOM'] ?? true); + $this->UpdateFormField("CEL",'value',$data['CEL'] ?? true); + + SetValueBoolean($this->GetIDForIdent('BLOCKN'), $data['BLOCKN'] ?? false); + SetValueBoolean($this->GetIDForIdent('UPPERCASE'), $data['UPPERCASE'] ?? false); + + Setvalue($this->GetIDForIdent('TIME_COL'),hexdec($data['TIME_COL'])); + Setvalue($this->GetIDForIdent('DATE_COL'),hexdec($data['DATE_COL'])); + Setvalue($this->GetIDForIdent('TEMP_COL'),hexdec($data['TEMP_COL'])); + Setvalue($this->GetIDForIdent('HUM_COL'),hexdec($data['HUM_COL'])); + Setvalue($this->GetIDForIdent('BAT_COL'),hexdec($data['BAT_COL'])); + + Setvalue($this->GetIDForIdent('SSPEED'),$data['SSPEED']); + + $this->UpdateFormField("TIM",'value',$data['TIM']); + $this->UpdateFormField("DAT",'value',$data['DAT']); + $this->UpdateFormField("HUM",'value',$data['HUM']); + $this->UpdateFormField("TEMP",'value',$data['TEMP']); + $this->UpdateFormField("BAT",'value',$data['BAT']); + + SetValueBoolean($this->GetIDForIdent('MATP'),$data['MATP'] ?? false); + + //$this->WriteAttributeString('Settings',$data); + + + + + } + + public function SendReboot() { + + // Discord webhook URL + $awtrixIp = $this->ReadPropertyString("AwtrixIp"); + $url="http://{$awtrixIp}/api/reboot"; + + $settings = [ + + // Anzeige + + ]; + + // ============================= + // CURL Request + // ============================= + $ch = curl_init($url); + + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + "Content-Type: application/json" + ]); + + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($settings)); + + $response = curl_exec($ch); + $error = curl_error($ch); + + curl_close($ch); + + } + +} + +?> \ No newline at end of file