first alpha release
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
{ "caption": "1.30 PM", "value": "%l %M %p" }
|
{ "caption": "1.30 PM", "value": "%l %M %p" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{ "type": "Select", "name": "DFORMAT", "caption": "Time-Format",
|
{ "type": "Select", "name": "DFORMAT", "caption": "Date-Format",
|
||||||
"options": [
|
"options": [
|
||||||
{ "caption": "16.04.22", "value": "%d.%m.%y" },
|
{ "caption": "16.04.22", "value": "%d.%m.%y" },
|
||||||
{ "caption": "16.04", "value": "%d.%m" },
|
{ "caption": "16.04", "value": "%d.%m" },
|
||||||
@@ -39,7 +39,8 @@
|
|||||||
],
|
],
|
||||||
"actions":
|
"actions":
|
||||||
[
|
[
|
||||||
{ "type": "Button", "label": "Send Message", "onClick": "AWSET_SendSetting($id);" }
|
{ "type": "Button", "label": "Send Settings", "onClick": "AWSET_SendSetting($id);" },
|
||||||
|
{ "type": "Button", "label": "Get Settings", "onClick": "AWSET_UpdateConfig($id);" }
|
||||||
],
|
],
|
||||||
"status":
|
"status":
|
||||||
[
|
[
|
||||||
|
|||||||
+138
-56
@@ -8,6 +8,8 @@ class AwtrixSettings extends IPSModule {
|
|||||||
|
|
||||||
public function Create() {
|
public function Create() {
|
||||||
|
|
||||||
|
$this->RegisterAttributeString('Settings','');
|
||||||
|
|
||||||
|
|
||||||
$this->RegisterPropertyString('AwtrixIp','172.78.88.67');
|
$this->RegisterPropertyString('AwtrixIp','172.78.88.67');
|
||||||
$this->RegisterPropertyBoolean('TIM',true);
|
$this->RegisterPropertyBoolean('TIM',true);
|
||||||
@@ -153,39 +155,18 @@ class AwtrixSettings extends IPSModule {
|
|||||||
$this->EnableAction("ATRANS");
|
$this->EnableAction("ATRANS");
|
||||||
SetValueBoolean($this->GetIDForIdent("ATRANS"),1);
|
SetValueBoolean($this->GetIDForIdent("ATRANS"),1);
|
||||||
|
|
||||||
$this->RegisterVariableInteger ('CCORRECTION', 'CCORRECTION',[
|
$this->RegisterVariableBoolean('BLOCKN', 'Local Key Enable', [
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH
|
||||||
'MIN' => 0,
|
|
||||||
'MAX' => 2000,
|
|
||||||
'STEP_SIZE' => 50,
|
|
||||||
'USAGE_TYPE' => 5, ///5 = none
|
|
||||||
'SUFFIX' => ' ms'
|
|
||||||
], 140);
|
|
||||||
$this->RegisterVariableInteger ('CTEMP', 'CTEMP', [
|
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
|
||||||
'MIN' => 0,
|
|
||||||
'MAX' => 2000,
|
|
||||||
'STEP_SIZE' => 50,
|
|
||||||
'USAGE_TYPE' => 5, ///5 = none
|
|
||||||
'SUFFIX' => ' ms'
|
|
||||||
], 150);
|
|
||||||
|
|
||||||
$this->RegisterVariableInteger ('BLOCKN', 'BLOCKN', [
|
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
|
||||||
'MIN' => 0,
|
|
||||||
'MAX' => 2000,
|
|
||||||
'STEP_SIZE' => 50,
|
|
||||||
'USAGE_TYPE' => 5, ///5 = none
|
|
||||||
'SUFFIX' => ' ms'
|
|
||||||
], 160);
|
], 160);
|
||||||
$this->RegisterVariableBoolean ('UPPERCASE', 'UPPERCASE', [
|
$this->EnableAction("BLOCKN");
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
SetValueBoolean($this->GetIDForIdent("BLOCKN"),1);
|
||||||
'MIN' => 0,
|
|
||||||
'MAX' => 2000,
|
$this->RegisterVariableBoolean('UPPERCASE', 'Display Uppercase', [
|
||||||
'STEP_SIZE' => 50,
|
'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH
|
||||||
'USAGE_TYPE' => 5, ///5 = none
|
|
||||||
'SUFFIX' => ' ms'
|
|
||||||
], 170);
|
], 170);
|
||||||
|
$this->EnableAction("UPPERCASE");
|
||||||
|
SetValueBoolean($this->GetIDForIdent("UPPERCASE"),0);
|
||||||
|
|
||||||
$this->RegisterVariableInteger ('TIME_COL', 'Time Color', [
|
$this->RegisterVariableInteger ('TIME_COL', 'Time Color', [
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
|
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
|
||||||
'ENCODING' => 0,
|
'ENCODING' => 0,
|
||||||
@@ -210,35 +191,45 @@ class AwtrixSettings extends IPSModule {
|
|||||||
'COLOR_SPACE' => 0,
|
'COLOR_SPACE' => 0,
|
||||||
'COLOR_CURVE' => 0
|
'COLOR_CURVE' => 0
|
||||||
], 200);
|
], 200);
|
||||||
|
$this->EnableAction("TEMP_COL");
|
||||||
|
SetValueInteger($this->GetIDForIdent("TEMP_COL"),16777215);
|
||||||
|
|
||||||
$this->RegisterVariableInteger ('HUM_COL', 'HUM_COL', [
|
$this->RegisterVariableInteger ('HUM_COL', 'HUM_COL', [
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
|
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
|
||||||
'ENCODING' => 0,
|
'ENCODING' => 0,
|
||||||
'COLOR_SPACE' => 0,
|
'COLOR_SPACE' => 0,
|
||||||
'COLOR_CURVE' => 0
|
'COLOR_CURVE' => 0
|
||||||
], 210);
|
], 210);
|
||||||
|
$this->EnableAction("HUM_COL");
|
||||||
|
SetValueInteger($this->GetIDForIdent("HUM_COL"),16777215);
|
||||||
|
|
||||||
$this->RegisterVariableInteger ('BAT_COL', 'BAT_COL', [
|
$this->RegisterVariableInteger ('BAT_COL', 'BAT_COL', [
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
|
'PRESENTATION' => VARIABLE_PRESENTATION_COLOR,
|
||||||
'ENCODING' => 0,
|
'ENCODING' => 0,
|
||||||
'COLOR_SPACE' => 0,
|
'COLOR_SPACE' => 0,
|
||||||
'COLOR_CURVE' => 0
|
'COLOR_CURVE' => 0
|
||||||
], 220);
|
], 220);
|
||||||
$this->RegisterVariableInteger ('SSPEED', 'SSPEED',[
|
$this->EnableAction("BAT_COL");
|
||||||
|
SetValueInteger($this->GetIDForIdent("BAT_COL"),16777215);
|
||||||
|
|
||||||
|
$this->RegisterVariableInteger ('SSPEED', 'Scrollspeed',[
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
||||||
'MIN' => 0,
|
'MIN' => 0,
|
||||||
'MAX' => 2000,
|
'MAX' => 100,
|
||||||
'STEP_SIZE' => 50,
|
'PERCENTAGE' => true,
|
||||||
'USAGE_TYPE' => 5, ///5 = none
|
'USAGE_TYPE' => 2, ///5 = none
|
||||||
'SUFFIX' => ' ms'
|
'SUFFIX' => ' %'
|
||||||
], 230);
|
], 230);
|
||||||
$this->RegisterVariableInteger ('MATP', 'MATP', [
|
$this->EnableAction("SSPEED");
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
SetValueInteger($this->GetIDForIdent("SSPEED"),100);
|
||||||
'MIN' => 0,
|
|
||||||
'MAX' => 2000,
|
$this->RegisterVariableBoolean('MATP', 'Powerswitch', [
|
||||||
'STEP_SIZE' => 50,
|
'PRESENTATION' => VARIABLE_PRESENTATION_SWITCH
|
||||||
'USAGE_TYPE' => 5, ///5 = none
|
|
||||||
'SUFFIX' => ' ms'
|
|
||||||
], 240);
|
], 240);
|
||||||
$this->RegisterVariableInteger ('OVERLAY', 'OVERLAY', [
|
$this->EnableAction("MATP");
|
||||||
|
SetValueBoolean($this->GetIDForIdent("MATP"),1);
|
||||||
|
|
||||||
|
$this->RegisterVariableString ('OVERLAY', 'Effectsoverlay', [
|
||||||
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
'PRESENTATION' => VARIABLE_PRESENTATION_SLIDER,
|
||||||
'MIN' => 0,
|
'MIN' => 0,
|
||||||
'MAX' => 2000,
|
'MAX' => 2000,
|
||||||
@@ -257,6 +248,11 @@ class AwtrixSettings extends IPSModule {
|
|||||||
"frost"*/
|
"frost"*/
|
||||||
|
|
||||||
// Diese Zeile nicht löschen.
|
// Diese Zeile nicht löschen.
|
||||||
|
$this->UpdateConfig();
|
||||||
|
|
||||||
|
$this->RegisterTimer("Update", 0, 'AWSET_UpdateConfig('.$this->InstanceID.');');
|
||||||
|
$this->SetTimerInterval("Update", 10 * 1000);
|
||||||
|
|
||||||
parent::Create();
|
parent::Create();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -313,8 +309,19 @@ class AwtrixSettings extends IPSModule {
|
|||||||
$tformat = $this->ReadPropertyString("TFORMAT");
|
$tformat = $this->ReadPropertyString("TFORMAT");
|
||||||
$dformat = $this->ReadPropertyString("DFORMAT");
|
$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'));
|
$time_col = GetValue($this->GetIDForIdent('TIME_COL'));
|
||||||
$date_col = GetValue($this->GetIDForIdent('DATE_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");
|
$tim = $this->ReadPropertyBoolean("TIM");
|
||||||
$dat= $this->ReadPropertyBoolean("DAT");
|
$dat= $this->ReadPropertyBoolean("DAT");
|
||||||
@@ -322,6 +329,7 @@ class AwtrixSettings extends IPSModule {
|
|||||||
$temp = $this->ReadPropertyBoolean("TEMP");
|
$temp = $this->ReadPropertyBoolean("TEMP");
|
||||||
$bat = $this->ReadPropertyBoolean("BAT");
|
$bat = $this->ReadPropertyBoolean("BAT");
|
||||||
|
|
||||||
|
$matp = GetValueBoolean($this->GetIDForIdent('MATP'));
|
||||||
|
|
||||||
|
|
||||||
$settings = [
|
$settings = [
|
||||||
@@ -336,6 +344,9 @@ class AwtrixSettings extends IPSModule {
|
|||||||
"TCOL" => dechex($tcol),
|
"TCOL" => dechex($tcol),
|
||||||
"TIME_COL" => dechex($time_col),
|
"TIME_COL" => dechex($time_col),
|
||||||
"DATE_COL" => dechex($date_col),
|
"DATE_COL" => dechex($date_col),
|
||||||
|
"TEMP_COL" => dechex($temp_col),
|
||||||
|
"HUM_COL" => dechex($hum_col),
|
||||||
|
"BAT_COL" => dechex($bat_col),
|
||||||
|
|
||||||
"CHCOL" => dechex($chcol),
|
"CHCOL" => dechex($chcol),
|
||||||
"CBCOL" => dechex($cbcol),
|
"CBCOL" => dechex($cbcol),
|
||||||
@@ -350,8 +361,8 @@ class AwtrixSettings extends IPSModule {
|
|||||||
|
|
||||||
// Verhalten
|
// Verhalten
|
||||||
"WD" => $wd,
|
"WD" => $wd,
|
||||||
"SOM" => true,
|
"SOM" => $som,
|
||||||
"CEL" => true,
|
"CEL" => $cel,
|
||||||
|
|
||||||
// Matrix
|
// Matrix
|
||||||
"BRI" => $bri,
|
"BRI" => $bri,
|
||||||
@@ -359,6 +370,9 @@ class AwtrixSettings extends IPSModule {
|
|||||||
"ATRANS" => $atrans,
|
"ATRANS" => $atrans,
|
||||||
"CCORRECTION" => $ccorrection,
|
"CCORRECTION" => $ccorrection,
|
||||||
"CTEMP" => $ctemp,
|
"CTEMP" => $ctemp,
|
||||||
|
"BLOCKN" => $blockn,
|
||||||
|
"UPPERCASE" => $uppercase,
|
||||||
|
"MATP" => $matp,
|
||||||
|
|
||||||
// Apps aktivieren
|
// Apps aktivieren
|
||||||
"TIM" => $tim,
|
"TIM" => $tim,
|
||||||
@@ -371,7 +385,7 @@ class AwtrixSettings extends IPSModule {
|
|||||||
"OVERLAY" => "clear",
|
"OVERLAY" => "clear",
|
||||||
|
|
||||||
// Scroll Speed
|
// Scroll Speed
|
||||||
"SSPEED" => 50,
|
"SSPEED" => $sspeed,
|
||||||
|
|
||||||
// Sound
|
// Sound
|
||||||
"VOL" => 10
|
"VOL" => 10
|
||||||
@@ -395,17 +409,84 @@ class AwtrixSettings extends IPSModule {
|
|||||||
|
|
||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
// =============================
|
//$this->WriteAttributeString('Settings',$settings);
|
||||||
// Debug Output
|
|
||||||
// =============================
|
|
||||||
/* if ($error) {
|
|
||||||
echo "CURL Error: " . $error;
|
|
||||||
} else {
|
|
||||||
echo "Response:\n";
|
|
||||||
echo $response;
|
|
||||||
} */
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
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() {
|
public function SendReboot() {
|
||||||
|
|
||||||
// Discord webhook URL
|
// Discord webhook URL
|
||||||
@@ -437,6 +518,7 @@ class AwtrixSettings extends IPSModule {
|
|||||||
curl_close($ch);
|
curl_close($ch);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
Reference in New Issue
Block a user