Compare commits

..
10 Commits
Author SHA1 Message Date
jhartworks e100b8425e Mailfunction added in Multialarmer 2025-01-07 10:40:52 +01:00
J.H. Artworks 5528a73a79 Add files via upload 2024-02-26 13:10:09 +01:00
J.H. Artworks a4d37c7069 Add files via upload 2024-02-26 09:24:52 +01:00
J.H. Artworks a6e897b205 Add files via upload 2024-02-26 09:23:09 +01:00
J.H. Artworks e041f2234f Add files via upload 2024-02-22 16:45:23 +01:00
J.H. Artworks 509f8ccb8d Add files via upload 2024-02-22 14:16:40 +01:00
J.H. Artworks 97af2df0ba Add files via upload 2024-02-22 14:16:06 +01:00
J.H. Artworks b2c944911a Add files via upload 2024-02-22 10:21:59 +01:00
J.H. Artworks 148da032b6 Add files via upload 2024-02-22 10:21:16 +01:00
J.H. Artworks 9841d90570 Add files via upload 2024-01-05 13:50:47 +01:00
22 changed files with 1093 additions and 1 deletions
+17
View File
@@ -0,0 +1,17 @@
{
"elements":
[
{ "type": "SelectVariable", "name": "IdVariable", "caption": "ID Variable" }
],
"actions":
[
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{2E62C98E-A730-4A74-E8FB-5A1D95F12446}",
"name": "Do16ToWord",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTDW"
}
+133
View File
@@ -0,0 +1,133 @@
<?
// Klassendefinition
class Do16ToWord extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyInteger("IdVariable",0);
$this->RegisterVariableBoolean("Q01", "Ausgang 1","",10);
$this->EnableAction("Q01");
$this->RegisterVariableBoolean("Q02", "Ausgang 2","",20);
$this->EnableAction("Q02");
$this->RegisterVariableBoolean("Q03", "Ausgang 3","",30);
$this->EnableAction("Q03");
$this->RegisterVariableBoolean("Q04", "Ausgang 4","",40);
$this->EnableAction("Q04");
$this->RegisterVariableBoolean("Q05", "Ausgang 5","",50);
$this->EnableAction("Q05");
$this->RegisterVariableBoolean("Q06", "Ausgang 6","",60);
$this->EnableAction("Q06");
$this->RegisterVariableBoolean("Q07", "Ausgang 7","",70);
$this->EnableAction("Q07");
$this->RegisterVariableBoolean("Q08", "Ausgang 8","",80);
$this->EnableAction("Q08");
$this->RegisterVariableBoolean("Q09", "Ausgang 9","",90);
$this->EnableAction("Q09");
$this->RegisterVariableBoolean("Q10", "Ausgang 10","",100);
$this->EnableAction("Q10");
$this->RegisterVariableBoolean("Q11", "Ausgang 11","",110);
$this->EnableAction("Q11");
$this->RegisterVariableBoolean("Q12", "Ausgang 12","",120);
$this->EnableAction("Q12");
$this->RegisterVariableBoolean("Q13", "Ausgang 13","",130);
$this->EnableAction("Q13");
$this->RegisterVariableBoolean("Q14", "Ausgang 14","",140);
$this->EnableAction("Q14");
$this->RegisterVariableBoolean("Q15", "Ausgang 15","",150);
$this->EnableAction("Q15");
$this->RegisterVariableBoolean("Q16", "Ausgang 16","",160);
$this->EnableAction("Q16");
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// Diese Zeile nicht löschen
parent::ApplyChanges();
}
public function RequestAction($Ident, $Value) {
$varid = $this->GetIDForIdent($Ident);
SetValue($varid, $Value);
$this->checkValues();
}
public function checkValues(){
$Idvalue = $this->ReadPropertyInteger("IdVariable");
$IdQ01 = $this->GetIDForIdent("Q01");
$IdQ02 = $this->GetIDForIdent("Q02");
$IdQ03 = $this->GetIDForIdent("Q03");
$IdQ04 = $this->GetIDForIdent("Q04");
$IdQ05 = $this->GetIDForIdent("Q05");
$IdQ06 = $this->GetIDForIdent("Q06");
$IdQ07 = $this->GetIDForIdent("Q07");
$IdQ08 = $this->GetIDForIdent("Q08");
$IdQ09 = $this->GetIDForIdent("Q09");
$IdQ10 = $this->GetIDForIdent("Q10");
$IdQ11 = $this->GetIDForIdent("Q11");
$IdQ12 = $this->GetIDForIdent("Q12");
$IdQ13 = $this->GetIDForIdent("Q13");
$IdQ14 = $this->GetIDForIdent("Q14");
$IdQ15 = $this->GetIDForIdent("Q15");
$IdQ16 = $this->GetIDForIdent("Q16");
$outputs[0] = $this->GetValueBooleanNull($IdQ01);
$outputs[1] = $this->GetValueBooleanNull($IdQ02);
$outputs[2] = $this->GetValueBooleanNull($IdQ03);
$outputs[3] = $this->GetValueBooleanNull($IdQ04);
$outputs[4] = $this->GetValueBooleanNull($IdQ05);
$outputs[5] = $this->GetValueBooleanNull($IdQ06);
$outputs[6] = $this->GetValueBooleanNull($IdQ07);
$outputs[7] = $this->GetValueBooleanNull($IdQ08);
$outputs[8] = $this->GetValueBooleanNull($IdQ09);
$outputs[9] = $this->GetValueBooleanNull($IdQ10);
$outputs[10] = $this->GetValueBooleanNull($IdQ11);
$outputs[11] = $this->GetValueBooleanNull($IdQ12);
$outputs[12] = $this->GetValueBooleanNull($IdQ13);
$outputs[13] = $this->GetValueBooleanNull($IdQ14);
$outputs[14] = $this->GetValueBooleanNull($IdQ15);
$outputs[15] = $this->GetValueBooleanNull($IdQ16);
$out = $this->binaryArrayToInt($outputs);
RequestAction($Idvalue,$out);
}
public function binaryArrayToInt(ARRAY $bitsArray) {
// Das Bit-Array umkehren, da es andersherum übergeben wird
$reversedBitsArray = array_reverse($bitsArray);
// Das umgekehrte Bit-Array in einen Binärstring konvertieren
$binaryString = implode("", $reversedBitsArray);
// Den Binärstring in eine Ganzzahl umwandeln
$intValue = bindec($binaryString);
return $intValue;
}
public function GetValueBooleanNull(INT $id)
{
if (GetValueBoolean($id) == 1){
return 1;
}else
{
return 0;
}
}
}
?>
+17
View File
@@ -0,0 +1,17 @@
{
"elements":
[
{ "type": "SelectVariable", "name": "IdVariable", "caption": "ID Variable" }
],
"actions":
[
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{2AF7A31E-0373-D361-6AC4-83B10E742924}",
"name": "Do8ToWord",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTDW"
}
+105
View File
@@ -0,0 +1,105 @@
<?
// Klassendefinition
class Do8ToWord extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyInteger("IdVariable",0);
$this->RegisterVariableBoolean("Q01", "Ausgang 1","",10);
$this->EnableAction("Q01");
$this->RegisterVariableBoolean("Q02", "Ausgang 2","",20);
$this->EnableAction("Q02");
$this->RegisterVariableBoolean("Q03", "Ausgang 3","",30);
$this->EnableAction("Q03");
$this->RegisterVariableBoolean("Q04", "Ausgang 4","",40);
$this->EnableAction("Q04");
$this->RegisterVariableBoolean("Q05", "Ausgang 5","",50);
$this->EnableAction("Q05");
$this->RegisterVariableBoolean("Q06", "Ausgang 6","",60);
$this->EnableAction("Q06");
$this->RegisterVariableBoolean("Q07", "Ausgang 7","",70);
$this->EnableAction("Q07");
$this->RegisterVariableBoolean("Q08", "Ausgang 8","",80);
$this->EnableAction("Q08");
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// Diese Zeile nicht löschen
parent::ApplyChanges();
}
public function RequestAction($Ident, $Value) {
$varid = $this->GetIDForIdent($Ident);
SetValue($varid, $Value);
$this->checkValues();
}
public function checkValues(){
$Idvalue = $this->ReadPropertyInteger("IdVariable");
$IdQ01 = $this->GetIDForIdent("Q01");
$IdQ02 = $this->GetIDForIdent("Q02");
$IdQ03 = $this->GetIDForIdent("Q03");
$IdQ04 = $this->GetIDForIdent("Q04");
$IdQ05 = $this->GetIDForIdent("Q05");
$IdQ06 = $this->GetIDForIdent("Q06");
$IdQ07 = $this->GetIDForIdent("Q07");
$IdQ08 = $this->GetIDForIdent("Q08");
$outputs[0] = $this->GetValueBooleanNull($IdQ01);
$outputs[1] = $this->GetValueBooleanNull($IdQ02);
$outputs[2] = $this->GetValueBooleanNull($IdQ03);
$outputs[3] = $this->GetValueBooleanNull($IdQ04);
$outputs[4] = $this->GetValueBooleanNull($IdQ05);
$outputs[5] = $this->GetValueBooleanNull($IdQ06);
$outputs[6] = $this->GetValueBooleanNull($IdQ07);
$outputs[7] = $this->GetValueBooleanNull($IdQ08);
$out = $this->binaryArrayToInt($outputs);
RequestAction($Idvalue,$out);
}
public function binaryArrayToInt(ARRAY $bitsArray) {
// Das Bit-Array umkehren, da es andersherum übergeben wird
$reversedBitsArray = array_reverse($bitsArray);
// Das umgekehrte Bit-Array in einen Binärstring konvertieren
$binaryString = implode("", $reversedBitsArray);
// Den Binärstring in eine Ganzzahl umwandeln
$intValue = bindec($binaryString);
return $intValue;
}
public function GetValueBooleanNull(INT $id)
{
if (GetValueBoolean($id) == 1){
return 1;
}else
{
return 0;
}
}
}
?>
+16
View File
@@ -0,0 +1,16 @@
{
"elements":
[
{ "type": "SelectCategory", "name": "PropertyCategoryID", "caption": "Target" },
{ "type": "SelectInstance", "name": "PropertyArchiveID", "caption": "Archiver" }
],
"actions":
[
{ "type": "Button", "label": "Set Logging", "onClick": "VTLS_setLogging($id);" }
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{C4E5FD62-B7D1-453D-1A9D-CC21592702B6}",
"name": "LogSetter",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTLS"
}
+42
View File
@@ -0,0 +1,42 @@
<?
// Klassendefinition
class LogSetter extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyInteger("PropertyCategoryID",0);
$this->RegisterPropertyInteger("PropertyArchiveID",0);
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// 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:
*
*
*/
public function setLogging() {
$idKat = $this->ReadPropertyInteger("PropertyCategoryID");
$idArch = $this->ReadPropertyInteger("PropertyArchiveID");
$katChilds = IPS_GetChildrenIDs($idKat);
foreach ($katChilds as $katChild) {
$chilid = IPS_GetChildrenIDs($katChild)[0];
AC_SetLoggingStatus($idArch,$chilid,true);
}
}
}
?>
+17
View File
@@ -0,0 +1,17 @@
{
"elements":
[
{ "type": "SelectInstance", "name": "VisuId", "caption": "Web Visu" },
{ "type": "SelectVariable", "name": "ValueId", "validVariableTypes": [2],"caption": "Überwachter Wert" }
],
"actions":
[
{ "type": "Button", "label": "Set Init Values", "onClick": "VTMM_setInitValues($id);" }
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{DB82A921-58A5-A363-01E4-C5672ECFC150}",
"name": "MinMax",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTMM"
}
+182
View File
@@ -0,0 +1,182 @@
<?
// Klassendefinition
class MinMax extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->createHystprofile();
$this->createLimitprofile();
$this->createLimitEnprofile();
$this->RegisterPropertyInteger("VisuId",0);
$this->RegisterPropertyInteger("ValueId",0);
SetValue($this->RegisterVariableFloat("ActualValue", "Aktueller Wert","",0),123.4);
$this->RegisterVariableFloat("MinValue", "Minimalwert","LimitValue",10);
$this->EnableAction("MinValue");
SetValue($this->RegisterVariableBoolean("MinValueEn", "Minimalwert auswerten?","LimitEn",20),true);
$this->EnableAction("MinValueEn");
$this->RegisterVariableBoolean("IsMinValue", "Minimalwert","~Alert",30);
$this->RegisterVariableFloat("MaxValue", "Maximalwert","LimitValue",50);
$this->EnableAction("MaxValue");
SetValue($this->RegisterVariableBoolean("MaxValueEn", "Maximalwert auswerten?","LimitEn",60),true);
$this->EnableAction("MaxValueEn");
$this->RegisterVariableBoolean("IsMaxValue", "Maximalwert","~Alert",70);
SetValue($this->RegisterVariableFloat("Hysterese", "Hysterese","Hysteresis",80),1);
$this->EnableAction("Hysterese");
SetValue($this->RegisterVariableBoolean("NotifyEn", "Benachrichtigen?","LimitEn",100),true);
$this->EnableAction("NotifyEn");
SetValue($this->RegisterVariableString("NotifyTitel", "Titel der Benachrichtigung","~TextBox",100),"Störung!");
$this->EnableAction("NotifyTitel");
SetValue($this->RegisterVariableString("NotifyTextMin", "Text bei Min","~TextBox",120),"Grenzwert unterschritten");
$this->EnableAction("NotifyTextMin");
SetValue($this->RegisterVariableString("NotifyTextMax", "Text bei Max","~TextBox",140),"Grenzwert überschritten");
$this->EnableAction("NotifyTextMax");
$this->RegisterTimer("Update", 0, 'VTMM_checkValues('.$this->InstanceID.');');
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// Diese Zeile nicht löschen
parent::ApplyChanges();
$this->SetTimerInterval("Update", 10 * 1000);
}
public function createHystprofile(){
if(!IPS_VariableProfileExists ("Hysteresis") ){
IPS_CreateVariableProfile("Hysteresis", 2);
IPS_SetVariableProfileDigits ("Hysteresis", 1);
IPS_SetVariableProfileValues("Hysteresis", -20,20,0.5);
}
}
public function createLimitprofile(){
if(!IPS_VariableProfileExists ("LimitValue") ){
IPS_CreateVariableProfile("LimitValue", 2);
IPS_SetVariableProfileDigits ("LimitValue", 0);
IPS_SetVariableProfileValues("LimitValue", -350,350,1);
}
}
public function createLimitEnprofile(){
if(!IPS_VariableProfileExists ("LimitEn") ){
IPS_CreateVariableProfile("LimitEn", 0);
IPS_SetVariableProfileAssociation("LimitEn", true, "Ja", "", 0x00FF00);
IPS_SetVariableProfileAssociation("LimitEn", false, "Nein", "", 0xFFFF00);
}
}
public function RequestAction($Ident, $Value) {
$varid = $this->GetIDForIdent($Ident);
SetValue($varid, $Value);
$this->checkValues();
}
public function checkValues(){
$valueId = $this->ReadPropertyInteger("ValueId");
$value = GetValue($valueId);
$ActualValueId = $this->GetIDForIdent("ActualValue");
SetValue($ActualValueId,$value);
$MinValue = GetValue($this->GetIDForIdent("MinValue"));
$MaxValue = GetValue($this->GetIDForIdent("MaxValue"));
$Hysterese = GetValue($this->GetIDForIdent("Hysterese"));
$NotifyEn = GetValue($this->GetIDForIdent("NotifyEn"));
$MinValueEn = GetValue($this->GetIDForIdent("MinValueEn"));
$MaxValueEn = GetValue($this->GetIDForIdent("MaxValueEn"));
$IsMinValueId = $this->GetIDForIdent("IsMinValue");
$IsMaxValueId = $this->GetIDForIdent("IsMaxValue");
if ($MinValueEn == true){
if($value + $Hysterese < $MinValue){
SetValue($IsMinValueId,true);
}
if($value - $Hysterese > $MinValue){
SetValue($IsMinValueId,false);
}
}else
{
SetValue($IsMinValueId,false);
}
if ($MaxValueEn == true){
if($value - $Hysterese > $MaxValue){
SetValue($IsMaxValueId,true);
}
if($value + $Hysterese < $MaxValue){
SetValue($IsMaxValueId,false);
}
}else
{
SetValue($IsMaxValueId,false);
}
$webId = $this->ReadPropertyInteger("VisuId");
$NotifyTitel = GetValue($this->GetIDForIdent("NotifyTitel"));
$NotifyTextMin = GetValue($this->GetIDForIdent("NotifyTextMin"));
$NotifyTextMax = GetValue($this->GetIDForIdent("NotifyTextMax"));
if($NotifyEn == true){
$this->notify($IsMinValueId, $webId, $IsMinValueId, $NotifyTitel, $NotifyTextMin, "Snowflake");
$this->notify($IsMaxValueId, $webId, $IsMaxValueId, $NotifyTitel, $NotifyTextMax, "Flame");
}
}
private function notify($trigid, $webfrontid, $targetid, $art, $smname, $ico){
if (GetValueBoolean($trigid) == true && ($this->GetBuffer($smname) == "true")) {
$this->SetBuffer($smname, "false");
VISU_PostNotification($webfrontid, $art, $smname, $ico, $targetid);
}
elseif (GetValueBoolean($trigid) == false) {
$this->SetBuffer($smname, "true");
}
if (GetValueBoolean($trigid) == true){
return true;
}else{
return false;
}
}
public function setInitValues(){
SetValue($this->GetIDForIdent("NotifyTitel"),"Störung!");
SetValue($this->GetIDForIdent("NotifyTextMin"),"Grenzwert unterschritten");
SetValue($this->GetIDForIdent("NotifyTextMax"),"Grenzwert überschritten");
SetValue($this->GetIDForIdent("Hysterese"),1);
}
}
?>
+25
View File
@@ -0,0 +1,25 @@
{
"elements":
[
{ "type": "SelectInstance", "name": "VisuId", "caption": "Kachelvisu ID" },
{ "type": "SelectInstance", "name": "MailerId", "caption": "Email SMTP ID" },
{ "type": "ValidationTextBox", "name": "MailAddresses", "caption": "E-Mail Adresses (Commaseperated)" , "width": "40%"},
{ "type": "SelectVariable", "name": "ValueId01", "validVariableTypes": [0],"caption": "Überwachter Wert 1" },
{ "type": "SelectVariable", "name": "ValueId02", "validVariableTypes": [0],"caption": "Überwachter Wert 2" },
{ "type": "SelectVariable", "name": "ValueId03", "validVariableTypes": [0],"caption": "Überwachter Wert 3" },
{ "type": "SelectVariable", "name": "ValueId04", "validVariableTypes": [0],"caption": "Überwachter Wert 4" }
],
"actions":
[
{ "type": "Button", "label": "Set Init Values", "onClick": "VTMA_setInitValues($id);" },
{ "type": "Button", "label": "Send a Mail", "onClick": "VTMA_sendTestmail($id);" }
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{B702BA08-68ED-A0F6-BD98-857B4B302B63}",
"name": "Multialarmer",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTMA"
}
+203
View File
@@ -0,0 +1,203 @@
<?
// Klassendefinition
class Multialarmer extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyInteger("VisuId",0);
$this->RegisterPropertyInteger("MailerId",0);
$this->RegisterPropertyString("MailAddresses","jh@se-inno.de, info@se-inno.de");
$this->RegisterPropertyInteger("ValueId01",0);
$this->RegisterPropertyInteger("ValueId02",0);
$this->RegisterPropertyInteger("ValueId03",0);
$this->RegisterPropertyInteger("ValueId04",0);
$this->RegisterVariableBoolean("NotifyEn01", "Variable 01 Melden?","LimitEn",95);
$this->EnableAction("NotifyEn01");
$this->RegisterVariableBoolean("NotifyEn02", "Variable 02 Melden?","LimitEn",115);
$this->EnableAction("NotifyEn02");
$this->RegisterVariableBoolean("NotifyEn03", "Variable 03 Melden?","LimitEn",135);
$this->EnableAction("NotifyEn03");
$this->RegisterVariableBoolean("NotifyEn04", "Variable 04 Melden?","LimitEn",155);
$this->EnableAction("NotifyEn04");
SetValue($this->RegisterVariableString("NotifyTitel01", "Titel der Benachrichtigung Var 01","~TextBox",100),"Störung!");
$this->EnableAction("NotifyTitel01");
SetValue($this->RegisterVariableString("NotifyTitel02", "Titel der Benachrichtigung Var 02","~TextBox",120),"Störung!");
$this->EnableAction("NotifyTitel02");
SetValue($this->RegisterVariableString("NotifyTitel03", "Titel der Benachrichtigung Var 03","~TextBox",140),"Störung!");
$this->EnableAction("NotifyTitel03");
SetValue($this->RegisterVariableString("NotifyTitel04", "Titel der Benachrichtigung Var 04","~TextBox",160),"Störung!");
$this->EnableAction("NotifyTitel04");
/*
SetValue($this->RegisterVariableString("NotifyText01", "Störungstext Var 01","~TextBox",110),"Störung 1");
$this->EnableAction("NotifyText01");
SetValue($this->RegisterVariableString("NotifyText02", "Störungstext Var 02","~TextBox",130),"Störung 2");
$this->EnableAction("NotifyText02");
SetValue($this->RegisterVariableString("NotifyText03", "Störungstext Var 03","~TextBox",150),"Störung 3");
$this->EnableAction("NotifyText03");
SetValue($this->RegisterVariableString("NotifyText04", "Störungstext Var 04","~TextBox",170),"Störung 4");
$this->EnableAction("NotifyText04");
*/
$this->RegisterTimer("Update", 0, 'VTMA_checkValues('.$this->InstanceID.');');
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// Diese Zeile nicht löschen
parent::ApplyChanges();
$this->SetTimerInterval("Update", 5 * 1000);
}
public function RequestAction($Ident, $Value) {
$varid = $this->GetIDForIdent($Ident);
SetValue($varid, $Value);
$this->checkValues();
}
public function checkValues(){
$webId = $this->ReadPropertyInteger("VisuId");
$IdVariable01 = $this->ReadPropertyInteger("ValueId01");
$IdVariable02 = $this->ReadPropertyInteger("ValueId02");
$IdVariable03 = $this->ReadPropertyInteger("ValueId03");
$IdVariable04 = $this->ReadPropertyInteger("ValueId04");
$NotifyEn01 = GetValue($this->GetIDForIdent("NotifyEn01"));
$NotifyEn02 = GetValue($this->GetIDForIdent("NotifyEn02"));
$NotifyEn03 = GetValue($this->GetIDForIdent("NotifyEn03"));
$NotifyEn04 = GetValue($this->GetIDForIdent("NotifyEn04"));
$NotifyTitel01 = GetValue($this->GetIDForIdent("NotifyTitel01"));
$NotifyText01 = IPS_GetName($IdVariable01);//GetValue($this->GetIDForIdent("NotifyText01"));
$NotifyTitel02 = GetValue($this->GetIDForIdent("NotifyTitel02"));
$NotifyText02 = IPS_GetName($IdVariable02);//GetValue($this->GetIDForIdent("NotifyText02"));
$NotifyTitel03 = GetValue($this->GetIDForIdent("NotifyTitel03"));
$NotifyText03 = IPS_GetName($IdVariable03);//GetValue($this->GetIDForIdent("NotifyText03"));
$NotifyTitel04 = GetValue($this->GetIDForIdent("NotifyTitel04"));
$NotifyText04 = IPS_GetName($IdVariable04);//GetValue($this->GetIDForIdent("NotifyText04"));
if($NotifyEn01 == true && $IdVariable01 > 0){
$value01 = GetValue($IdVariable01);
$this->notify($IdVariable01, $webId, $IdVariable01, $NotifyTitel01, $NotifyText01, "Flame");
}
if($NotifyEn02 == true && $IdVariable02 > 0){
$value02 = GetValue($IdVariable02);
$this->notify($IdVariable02, $webId, $IdVariable02, $NotifyTitel02, $NotifyText02, "Flame");
}
if($NotifyEn03 == true && $IdVariable03 > 0){
$value03 = GetValue($IdVariable03);
$this->notify($IdVariable03, $webId, $IdVariable03, $NotifyTitel03, $NotifyText03, "Flame");
}
if($NotifyEn04 == true && $IdVariable04 > 0){
$value04 = GetValue($IdVariable04);
$this->notify($IdVariable04, $webId, $IdVariable04, $NotifyTitel04, $NotifyText04, "Flame");
}
}
public function setInitValues(){
SetValue($this->GetIDForIdent("NotifyTitel01"),"Störung!");
SetValue($this->GetIDForIdent("NotifyTitel02"),"Störung!");
SetValue($this->GetIDForIdent("NotifyTitel03"),"Störung!");
SetValue($this->GetIDForIdent("NotifyTitel04"),"Störung!");
}
public function sendTestmail(){
$art= "";
$smname = "";
$this->sendMail($art, $smname, true);
}
private function sendMail($art, $smname, $testmail){
$MailerId = $this->ReadPropertyInteger("MailerId");
$MailAddresses = $this->ReadPropertyString("MailAddresses");
$MailAddresses = str_replace(" ", "", $MailAddresses);
$MailAddresses = str_replace(";", ",", $MailAddresses);
$MailAddresses = explode(",",$MailAddresses);
//print_r($MailAddresses);
if ($testmail == true){
$art= "MAILSYSTEMTEST";
$smname = "It was just a Test to be ready for a real emergency ;-)";
}
if ($MailerId > 0){
foreach ($MailAddresses as $MailAddress){
SMTP_SendMailEx($MailerId, $MailAddress, "SE Inno Mailservice ".$art, $smname);
}
}
}
private function notify($trigid, $webfrontid, $targetid, $art, $smname, $ico){
$MailerId = $this->ReadPropertyInteger("MailerId");
$MailAddresses = array($this->ReadPropertyString("MailAddresses"));
if (GetValueBoolean($trigid) == true && ($this->GetBuffer($smname) == "true")) {
$this->SetBuffer($smname, "false");
VISU_PostNotification($webfrontid, $art, $smname, $ico, $targetid);
$this->sendMail($art, $smname, false);
}
elseif (GetValueBoolean($trigid) == false) {
$this->SetBuffer($smname, "true");
}
if (GetValueBoolean($trigid) == true){
return true;
}else{
return false;
}
}
}
?>
+20
View File
@@ -0,0 +1,20 @@
{
"elements":
[
{ "type": "SelectVariable", "name": "IdVariable01", "caption": "ID Variable 1" },
{ "type": "SelectVariable", "name": "IdVariable02", "caption": "ID Variable 2" },
{ "type": "SelectVariable", "name": "IdVariable03", "caption": "ID Variable 3" },
{ "type": "SelectVariable", "name": "IdVariable04", "caption": "ID Variable 4" }
],
"actions":
[
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{3E5C6478-498E-0E1A-2EF3-E584A38ADBAB}",
"name": "Varnamer",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTVN"
}
+87
View File
@@ -0,0 +1,87 @@
<?
// Klassendefinition
class Varnamer extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyInteger("IdVariable01",0);
$this->RegisterPropertyInteger("IdVariable02",0);
$this->RegisterPropertyInteger("IdVariable03",0);
$this->RegisterPropertyInteger("IdVariable04",0);
$this->RegisterVariableString("Name01", "Name Variable 1","~TextBox",10);
$this->EnableAction("Name01");
$this->RegisterVariableString("Name02", "Name Variable 2","~TextBox",20);
$this->EnableAction("Name02");
$this->RegisterVariableString("Name03", "Name Variable 3","~TextBox",30);
$this->EnableAction("Name03");
$this->RegisterVariableString("Name04", "Name Variable 4","~TextBox",40);
$this->EnableAction("Name04");
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// Diese Zeile nicht löschen
parent::ApplyChanges();
$this->getInitValues();
}
public function RequestAction($Ident, $Value) {
$varid = $this->GetIDForIdent($Ident);
SetValue($varid, $Value);
$this->checkValues();
}
public function checkValues(){
$Idvalue01 = $this->ReadPropertyInteger("IdVariable01");
$Idvalue02 = $this->ReadPropertyInteger("IdVariable02");
$Idvalue03 = $this->ReadPropertyInteger("IdVariable03");
$Idvalue04 = $this->ReadPropertyInteger("IdVariable04");
$Name01 = GetValue($this->GetIDForIdent("Name01"));
$Name02 = GetValue($this->GetIDForIdent("Name02"));
$Name03 = GetValue($this->GetIDForIdent("Name03"));
$Name04 = GetValue($this->GetIDForIdent("Name04"));
if ($Idvalue01 > 0){
IPS_SetName($Idvalue01, $Name01);
}
if ($Idvalue02 > 0){
IPS_SetName($Idvalue02, $Name02);
}
if ($Idvalue03 > 0){
IPS_SetName($Idvalue03, $Name03);
}
if ($Idvalue04 > 0){
IPS_SetName($Idvalue04, $Name04);
}
}
public function getInitValues(){
$Idvalue01 = $this->ReadPropertyInteger("IdVariable01");
$Idvalue02 = $this->ReadPropertyInteger("IdVariable02");
$Idvalue03 = $this->ReadPropertyInteger("IdVariable03");
$Idvalue04 = $this->ReadPropertyInteger("IdVariable04");
SetValue($this->GetIDForIdent("Name01"),IPS_GetName($Idvalue01));
SetValue($this->GetIDForIdent("Name02"),IPS_GetName($Idvalue02));
SetValue($this->GetIDForIdent("Name03"),IPS_GetName($Idvalue03));
SetValue($this->GetIDForIdent("Name04"),IPS_GetName($Idvalue04));
}
}
?>
+17
View File
@@ -0,0 +1,17 @@
{
"elements":
[
{ "type": "SelectVariable", "name": "IdVariable", "caption": "ID Variable" }
],
"actions":
[
],
"status":
[
]
}
+14
View File
@@ -0,0 +1,14 @@
{
"id": "{C5BCEBA7-A3E5-E246-7D45-979148112439}",
"name": "WordTo16Di",
"type": 3,
"vendor": "J.H. Artworks",
"aliases":
[
],
"url": "https://jh-artworks.com",
"parentRequirements": [],
"childRequirements": [],
"implemented": [],
"prefix": "VTWD"
}
+113
View File
@@ -0,0 +1,113 @@
<?
// Klassendefinition
class WordTo16Di extends IPSModule {
// Überschreibt die interne IPS_Create($id) Funktion
public function Create() {
// Diese Zeile nicht löschen.
parent::Create();
$this->RegisterPropertyInteger("IdVariable",0);
$this->RegisterVariableBoolean("E01", "Eingang 1","",10);
$this->RegisterVariableBoolean("E02", "Eingang 2","",20);
$this->RegisterVariableBoolean("E03", "Eingang 3","",30);
$this->RegisterVariableBoolean("E04", "Eingang 4","",40);
$this->RegisterVariableBoolean("E05", "Eingang 5","",50);
$this->RegisterVariableBoolean("E06", "Eingang 6","",60);
$this->RegisterVariableBoolean("E07", "Eingang 7","",70);
$this->RegisterVariableBoolean("E08", "Eingang 8","",80);
$this->RegisterVariableBoolean("E09", "Eingang 9","",90);
$this->RegisterVariableBoolean("E10", "Eingang 10","",100);
$this->RegisterVariableBoolean("E11", "Eingang 11","",110);
$this->RegisterVariableBoolean("E12", "Eingang 12","",120);
$this->RegisterVariableBoolean("E13", "Eingang 13","",130);
$this->RegisterVariableBoolean("E14", "Eingang 14","",140);
$this->RegisterVariableBoolean("E15", "Eingang 15","",150);
$this->RegisterVariableBoolean("E16", "Eingang 16","",160);
$this->RegisterTimer("Update", 0, 'VTWD_checkValues('.$this->InstanceID.');');
}
// Überschreibt die intere IPS_ApplyChanges($id) Funktion
public function ApplyChanges() {
// Diese Zeile nicht löschen
parent::ApplyChanges();
$this->SetTimerInterval("Update", 1 * 1000);
}
public function RequestAction($Ident, $Value) {
$varid = $this->GetIDForIdent($Ident);
SetValue($varid, $Value);
$this->checkValues();
}
public function checkValues(){
$Idvalue = $this->ReadPropertyInteger("IdVariable");
$IdE01 = $this->GetIDForIdent("E01");
$IdE02 = $this->GetIDForIdent("E02");
$IdE03 = $this->GetIDForIdent("E03");
$IdE04 = $this->GetIDForIdent("E04");
$IdE05 = $this->GetIDForIdent("E05");
$IdE06 = $this->GetIDForIdent("E06");
$IdE07 = $this->GetIDForIdent("E07");
$IdE08 = $this->GetIDForIdent("E08");
$IdE09 = $this->GetIDForIdent("E09");
$IdE10 = $this->GetIDForIdent("E10");
$IdE11 = $this->GetIDForIdent("E11");
$IdE12 = $this->GetIDForIdent("E12");
$IdE13 = $this->GetIDForIdent("E13");
$IdE14 = $this->GetIDForIdent("E14");
$IdE15 = $this->GetIDForIdent("E15");
$IdE16 = $this->GetIDForIdent("E16");
$inputs = $this->intTo16BitBinary(GetValue($Idvalue));
SetValueBoolean($IdE01,$inputs[0]);
SetValueBoolean($IdE02,$inputs[1]);
SetValueBoolean($IdE03,$inputs[2]);
SetValueBoolean($IdE04,$inputs[3]);
SetValueBoolean($IdE05,$inputs[4]);
SetValueBoolean($IdE06,$inputs[5]);
SetValueBoolean($IdE07,$inputs[6]);
SetValueBoolean($IdE08,$inputs[7]);
SetValueBoolean($IdE09,$inputs[8]);
SetValueBoolean($IdE10,$inputs[9]);
SetValueBoolean($IdE11,$inputs[10]);
SetValueBoolean($IdE12,$inputs[11]);
SetValueBoolean($IdE13,$inputs[12]);
SetValueBoolean($IdE14,$inputs[13]);
SetValueBoolean($IdE15,$inputs[14]);
SetValueBoolean($IdE16,$inputs[15]);
}
public function intTo16BitBinary(INT $number) {
// Überprüfen, ob die Zahl im gültigen 16-Bit-Bereich liegt
if ($number < 0 || $number > 65535) {
return "Die Zahl liegt nicht im gültigen 16-Bit-Bereich.";
}
// Umwandlung in 16-Bit-Binärdarstellung
$binary = decbin($number);
// Auffüllen mit Nullen auf 16 Bits
$paddedBinary = str_pad($binary, 16, '0', STR_PAD_LEFT);
// Jedes Bit einzeln als Array ausgeben, aber umgekehrt
$bitsArray = array_reverse(str_split($paddedBinary));
return $bitsArray;
}
}
?>
+1 -1
View File
@@ -7,7 +7,7 @@
"version": "6.0", "version": "6.0",
"date": 1491343200 "date": 1491343200
}, },
"version": "1.0", "version": "1.6",
"build": 1, "build": 1,
"date": 0 "date": 0
} }