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