From 3a0a452172a5da2f11c27d193764e208335b05a1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mario=20H=C3=B6llein?= Date: Sun, 6 Nov 2016 13:44:49 +0100 Subject: [PATCH] scripte --- homematic/alle_alarmzonen_scharf_schalten.hm | 9 + .../alle_alarmzonen_unscharf_schalten.hm | 10 + homematic/batterie_pruefung_mit_variable | 109 ++++++++ homematic/batterie_pruefung_neu | 38 +++ homematic/batterie_pruefung_neu_with_debug | 41 +++ homematic/display_teg_test.hm | 208 +++++++++++++++ homematic/oled_Display_kurz | 249 ++++++++++++++++++ homematic/oled_Display_lang | 221 ++++++++++++++++ homematic/tuer_entriegeln_alarmanlage_aus.hm | 13 + 9 files changed, 898 insertions(+) create mode 100644 homematic/alle_alarmzonen_scharf_schalten.hm create mode 100644 homematic/alle_alarmzonen_unscharf_schalten.hm create mode 100644 homematic/batterie_pruefung_mit_variable create mode 100644 homematic/batterie_pruefung_neu create mode 100644 homematic/batterie_pruefung_neu_with_debug create mode 100644 homematic/display_teg_test.hm create mode 100644 homematic/oled_Display_kurz create mode 100644 homematic/oled_Display_lang create mode 100644 homematic/tuer_entriegeln_alarmanlage_aus.hm diff --git a/homematic/alle_alarmzonen_scharf_schalten.hm b/homematic/alle_alarmzonen_scharf_schalten.hm new file mode 100644 index 0000000..6d17bfc --- /dev/null +++ b/homematic/alle_alarmzonen_scharf_schalten.hm @@ -0,0 +1,9 @@ +string alarm_zonen="Alarmzone_EGR_soll,Alarmzone_EGL_soll,Alarmzone_KEL_soll,Alarmzone_WKG_soll,Alarmzone_WDG_soll,Alarmzone_TKG_soll,Alarmzone_TEG_soll,Alarmzone_TDG_soll"; +string zone; + +foreach(zone,alarm_zonen.Split(",")) { + var zScharf = dom.GetObject(zone); + if (zScharf != null) { + zScharf.State(true); + } +} diff --git a/homematic/alle_alarmzonen_unscharf_schalten.hm b/homematic/alle_alarmzonen_unscharf_schalten.hm new file mode 100644 index 0000000..b2d7c9e --- /dev/null +++ b/homematic/alle_alarmzonen_unscharf_schalten.hm @@ -0,0 +1,10 @@ +string sysVars="Haustuer_verschlossen,Alarmanlage,Alarm_WDG,Alarm_EGL,Alarm_EGR,Alarm_KEL,Alarm_WKG,Alarmzone_EGL_soll,Alarmzone_EGR_soll,Alarmzone_KEL_soll,Alarmzone_WDG_soll,Alarmzone_WKG_soll,Alarm_TKG,Alarm_TEG,Alarm_TDG,Alarmzone_TKG_soll,Alarmzone_TEG_soll,Alarmzone_TDG_soll"; + +string sysVar; + +foreach(sysVar,sysVars.Split(",")) { + var theVar = dom.GetObject(sysVar); + if (theVar != null) { + theVar.State(false); + } +} diff --git a/homematic/batterie_pruefung_mit_variable b/homematic/batterie_pruefung_mit_variable new file mode 100644 index 0000000..d44f878 --- /dev/null +++ b/homematic/batterie_pruefung_mit_variable @@ -0,0 +1,109 @@ +! Email-Warnung über niedrigen Batterie - Ladestand +! www.meine-homematic.de Beispiel Skript +! Anleitung: +! Folgendes Skript per Zeitmpodul 1x täglich ausführen +! Lösung basierend auf einem Skript von "saschahb" +! http://www.homematic-inside.de/tecbase.html?view=item&item_id=138 +! Dank auch an Marc Hoffmann für die Review des Skriptes +! Alle Batteriebetriebenen Geräte müssen in folgendem Gewerk sein: +var myAssembly = dom.GetObject("Batterie betrieben"); +! Geändert für Email-Addon / CUXD / TCL von PIX + +! Variablen initialisieren +string itemID; +string text = ""; +integer counter = 0; +string cr2016 = "HM-RC-4\tHM-RC-4-B\tHM-RC-Sec3\tHM-RC-Sec3-B\tHM-RC-P1\tHM-RC-Key3\tHM-RC-Key3-B"; +string cr2032 = "HM-PB-2-WM\tHM-SwI-3-FM\tHM-PBI-4-FM\tHM-Sec-TiS\tHM-SCI-3-FM\tHM-PBI-4-FM"; +string lr44 = "HM-Sec-SC\tHM-Sec-RHS\tHM-Sec-SC-2"; +string lr6 = "HM-Sec-MDIR\tHM-CC-TC\tHM-WDS100-C6-O\tHM-WDS40-TH-I\tHM-WDS10-TH-O\tHM-WDS30-T-O\tHM-Sec-Key\tHM-Sec-SD\tHM-Sec-WDS\tHM-CC-RT-DN\tHM-Sen-MDIR-O-2\tHM-Sec-MDIR-2\tHM-WDS30-OT2-SM\tHM-Sec-SCo"; +string lr3 = "HM-RC-12\tHM-PB-4Dis-WM\tHM-Sen-EP"; +string lr61 = "HM-LC-Sw4-Ba-PCB"; +string batlink; +string index; + +! Durch alle angemeldeten Geräte iterieren +foreach(itemID, myAssembly.EnumUsedIDs()) { + ! Gerätedetails & Schnittstelle holen + var item = dom.GetObject(itemID); + var device = dom.GetObject(item.Device()); + var interface = dom.GetObject(item.Interface()); + + ! Name, Adresse und Kanal auslesen + string interface_name = interface.Name(); + string device_address = device.Address(); + device_address = device_address.StrValueByIndex(":", 0); + string channel_name = interface_name # "." # device_address # ":0.LOWBAT"; + var channel = dom.GetObject(channel_name); + + ! Batterie leer? + if ( (channel.State() == true) && (channel.Value() == true) ) { + ! Gerät enthält CR2016-Batterie? + batlink = "unbekannt"; + foreach (index, cr2016) { + if (index == device.HssType()) { + batlink = "CR2016"; + } + } + + ! Gerät enthält CR2032-Batterie? + foreach (index, cr2032) { + if (index == device.HssType()) { + batlink = "CR2032"; + } + } + + ! Gerät enthält LR44-Batterie? + foreach (index, lr44) { + if (index == device.HssType()) { + batlink = "LR44"; + } + } + + ! Gerät enthält LR6-Batterie? + foreach (index, lr6) { + if (index == device.HssType()) { + batlink = "LR6"; + } + } + + ! Gerät enthält LR3-Batterie? + foreach (index, lr3) { + if (index == device.HssType()) { + batlink = "LR3"; + } + } + + ! Gerät enthält LR61-Batterie? + foreach (index, lr61) { + if (index == device.HssType()) { + batlink = "LR61"; + } + } + + ! Text zusammensetzen + text = text # "- " # item.Name() # " vom Typ " # batlink # " \r\n"; + + ! Counter erhöhen (Anzahl leerer Batterien) + counter = counter + 1; + } + } + + ! Mail-Text zusammensetzen + string Nachricht; + string sDate = system.Date("%d.%m.%Y"); + Nachricht = " \r\n Prüfung des Ladestandes der Batterien vom " # sDate # ". \r\n"; + +! Mind. eine leere Batterie gefunden? +if ( counter > 0 ) { + Nachricht = Nachricht # "\r\n Der Ladezustand folgender Batterien ist niedrig: \r\n" # text; + Nachricht = Nachricht # "\r\n Bitte tauschen Sie die Batterien zeitnah aus. "; +} else { + Nachricht = Nachricht # "\r\n Keine Batterie muss getauscht werden. "; +} + + ! Nachricht in Variable füllen und E-Mail absenden + !-------------------------------------------------- + dom.GetObject("Mailtext").State(Nachricht); + + dom.GetObject("CUxD.CUX2801001:1.CMD_EXEC").State("/etc/config/addons/email/email 04"); diff --git a/homematic/batterie_pruefung_neu b/homematic/batterie_pruefung_neu new file mode 100644 index 0000000..188b4b9 --- /dev/null +++ b/homematic/batterie_pruefung_neu @@ -0,0 +1,38 @@ +var myAssembly = dom.GetObject("Batteriebetrieben"); +string itemID; +string text = ""; +integer counter = 0; + +foreach(itemID, myAssembly.EnumUsedIDs()) { + var item = dom.GetObject(itemID); + var device = dom.GetObject(item.Device()); + var interface = dom.GetObject(item.Interface()); + string interface_name = interface.Name(); + string device_address = device.Address(); + device_address = device_address.StrValueByIndex(":", 0); + string channel_name = interface_name # "." # device_address # ":0.LOWBAT"; + var channel = dom.GetObject(channel_name); + if ( (channel.State() == true) && (channel.Value() == true) ) { + if ( counter == 0 ) { + text = item.Name(); + } else { + text = text # ", " # + item.Name(); + } + } + counter = counter + 1; +} + +if ( text != "" ) { + string stdout; + string stderr; + var batmeldung = system.Date("%d.%m.%Y %H:%M:%S") + " - Komponenten " + text + " melden niedrigen Batteriestand!"; + var WarnRep = dom.GetObject("WarnReport"); + WarnRep.Variable(batmeldung); + system.Exec("/etc/config/addons/email/email 03", &stdout, &stderr); +} else { + string stdout; + string stderr; + var batmeldung = system.Date("%d.%m.%Y %H:%M:%S") + "Batterieprüfung erledigt, keine leeren Batterien!"; + system.Exec("/etc/config/addons/email/email 04", &stdout, &stderr); +} diff --git a/homematic/batterie_pruefung_neu_with_debug b/homematic/batterie_pruefung_neu_with_debug new file mode 100644 index 0000000..65228ab --- /dev/null +++ b/homematic/batterie_pruefung_neu_with_debug @@ -0,0 +1,41 @@ +var myAssembly = dom.GetObject("Batteriebetrieben"); +string itemID; +string text = ""; +integer counter = 0; + +foreach(itemID, myAssembly.EnumUsedIDs()) { + WriteLine("foreach"); + var item = dom.GetObject(itemID); + var device = dom.GetObject(item.Device()); + var interface = dom.GetObject(item.Interface()); + string interface_name = interface.Name(); + string device_address = device.Address(); + device_address = device_address.StrValueByIndex(":", 0); + string channel_name = interface_name # "." # device_address # ":0.LOWBAT"; + var channel = dom.GetObject(channel_name); + if ( (channel.State() == true) && (channel.Value() == true) ) { + if ( counter == 0 ) { + text = item.Name(); + } else { + text = text # ", " # + item.Name(); + } + } + counter = counter + 1; +} + +if ( text != "" ) { + WriteLine("Es sind Batterien leer"); + string stdout; + string stderr; + var batmeldung = system.Date("%d.%m.%Y %H:%M:%S") + " - Komponenten " + text + " melden niedrigen Batteriestand!"; + var WarnRep = dom.GetObject("WarnReport"); + WarnRep.Variable(batmeldung); + system.Exec("/etc/config/addons/email/email 03", &stdout, &stderr); +} else { + WriteLine("Es sind keine Batterien leer"); + string stdout; + string stderr; + var batmeldung = system.Date("%d.%m.%Y %H:%M:%S") + "Batterieprüfung erledigt, keine leeren Batterien!"; + system.Exec("/etc/config/addons/email/email 04", &stdout, &stderr); +} diff --git a/homematic/display_teg_test.hm b/homematic/display_teg_test.hm new file mode 100644 index 0000000..538851f --- /dev/null +++ b/homematic/display_teg_test.hm @@ -0,0 +1,208 @@ +! ### Homatic-Statusanzeige HM-Dis-WM55 #### +! Farben +! 0x80 weiß +! 0x81 rot +! 0x82 orange +! 0x83 gelb +! 0x84 gruen +! 0x85 blau +! Symbole +! 0x80 AUS +! 0x81 EIN +! 0x82 OFFEN +! 0x83 geschlossen +! 0x84 fehler +! 0x85 alles ok +! 0x86 information +! 0x87 neue nachricht +! 0x88 servicemeldung +! 0x89 Signal grün +! 0x8A Signal gelb +! 0x8B Signal rot + +! Zugriff auf vordefinierte Texte +! +! 0x80 Text 0 (Kanal 1 Text Zeile 1) +! 0x81 Text 1 (Kanal 1 Text Zeile 2) +! 0x82 Text 2 (Kanal 2 Text Zeile 3) +! 0x83 Text 3 (Kanal 2 Text Zeile 4) +! 0x84 Text 4 (Kanal 3 Text Zeile 5) +! 0x85 Text 5 (Kanal 3 Text Zeile 6) +! 0x86 Text 6 (Kanal 4 Text Zeile 7) +! 0x87 Text 7 (Kanal 4 Text Zeile 8) +! 0x88 Text 8 (Kanal 5 Text Zeile 9) +! 0x89 Text 9 (Kanal 5 Text Zeile 10) +! 0x8A Text 10 (Kanal 6 Text Zeile 11) +! 0x8B Text 11 (Kanal 6 Text Zeile 12) +! 0x8C Text 12 (Kanal 7 Text Zeile 13) +! 0x8D Text 13 (Kanal 7 Text Zeile 14) +! 0x8E Text 14 (Kanal 8 Text Zeile 15) +! 0x8F Text 15 (Kanal 8 Text Zeile 16) +! 0x90 Text 16 (Kanal 9 Text Zeile 17) +! 0x91 Text 17 (Kanal 9 Text Zeile 18) +! 0x92 Text 18 (Kanal 10 Text Zeile 19) +! 0x93 Text 19 (Kanal 10 Text Zeile 20) + + +!jede Seite des Displays hat 6 Zeilen +!hier legen wir die Variablen fest, die +!wir auf jeder Seite nutzen können +string zeile1 = ""; +string color1 = "0x80"; +string icon1 = ""; + +string zeile2 = ""; +string color2 = "0x80"; +string icon2 = ""; + +string zeile3 = ""; +string color3 = "0x80"; +string icon3 = ""; + +string zeile4 = ""; +string color4 = "0x80"; +string icon4 = ""; + +string zeile5 = ""; +string color5 = "0x80"; +string icon5 = ""; + +string zeile6 = ""; +string color6 = "0x80"; +string icon6 = ""; + +! ####### wie viele Seiten auf dem Display sollen durchlaufen werden? ########### +integer seitenzahl = 5; +! ### Systemvariable seitenzaehler01 holen ### +var seitenZaehler = dom.GetObject("seitenzaehler01"); +integer aktuelleSeite = seitenZaehler.Value(); +if (aktuelleSeite < seitenzahl) { + seitenZaehler.State(aktuelleSeite++); +} else { + seitenZaehler.State(1); +} + +! ###################### Seite 1 ###################### +if (aktuelleSeite==1) { + var oSysvar = dom.GetObject("Alarmanlage"); + var obj = dom.GetObject("Fenster"); + string itemID; + var cntopen=0; + foreach(itemID, obj.EnumUsedIDs()) { + var item = dom.GetObject(itemID); + if(item.IsTypeOf(OT_CHANNEL)) { + var state=item.DPByHssDP("STATE"); + if(state.Value()!=0) { + cntopen=cntopen+1; + } + } + } + if (oSysvar.State()==1) { + zeile1 = ""; + color1 = "0x80"; + icon1 = ""; + zeile2 = "Alarm an"; + color2 = "0x80"; + icon2 = ""; + zeile5 = ""; + color5 = "0x81"; + icon5 = ""; + zeile6 = ""; + color6 = "0x80"; + icon6 = ""; + } else { + + zeile1 = ""; + color1 = "0x80"; + icon1 = ""; + zeile2 = "Alarm aus"; + color2 = "0x80"; + icon2 = ""; + zeile3 = ""; + color3="0x80"; + icon3 = ""; + zeile4 = ""; + color4 = "0x84"; + icon4 = ""; + zeile5 = ""; + color5 = "0x84"; + icon5 = ""; + zeile6 = ""; + color6 = "0x80"; + icon6 = ""; + } + + if (cntopen>0) { + zeile3 = cntopen # " Fenster"; + color3 = "0x81"; + icon3 = ""; + zeile4 = "offen"; + color4 = "0x81"; + icon4 = ""; + } else { + zeile3 = "Fenster zu"; + color3 = "0x84"; + icon3 = ""; + zeile4 = ""; + color4 = "0x81"; + icon4 = ""; + } +} + + + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + ! System Routine do not change anything below ! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + + string splitter="|"; + string msgBuffer = zeile1 # splitter # color1 # splitter # icon1 # "\t"; + msgBuffer = msgBuffer # zeile2 # splitter # color2 # splitter # icon2 # "\t"; + msgBuffer = msgBuffer # zeile3 # splitter # color3 # splitter # icon3 # "\t"; + msgBuffer = msgBuffer # zeile4 # splitter # color4 # splitter # icon4 # "\t"; + msgBuffer = msgBuffer # zeile5 # splitter # color5 # splitter # icon5 # "\t"; + msgBuffer = msgBuffer # zeile6 # splitter # color6 # splitter # icon6; + + string substitutions = "A,0x41\tB,0x42\tC,0x43\tD,0x44\tE,0x45\tF,0x46\tG,0x47\tH,0x48\tI,0x49\tJ,0x4A\tK,0x4B\tL,0x4C\tM,0x4D\tN,0x4E\tO,0x4F\tP,0x50\tQ,0x51\tR,0x52\tS,0x53\tT,0x54\tU,0x55\tV,0x56\tW,0x57\tX,0x58\tY,0x59\tZ,0x5A"; + substitutions = substitutions # "\ta,0x61\tb,0x62\tc,0x63\td,0x64\te,0x65\tf,0x66\tg,0x67\th,0x68\ti,0x69\tj,0x6A\tk,0x6B\tl,0x6C\tm,0x6D\tn,0x6E\to,0x6F\tp,0x70\tq,0x71\tr,0x72\ts,0x73\tt,0x74\tu,0x75\tv,0x76\tw,0x77\tx,0x78\ty,0x79\tz,0x7A"; + substitutions = substitutions # "\t0,0x30\t1,0x31\t2,0x32\t3,0x33\t4,0x34\t5,0x35\t6,0x36\t7,0x37\t8,0x38\t9,0x39\t ,0x20\t!,0x21\t\",0x22\t%,0x25\t&,0x26\t=,0x27\t(,0x28\t),0x29\t*,0x2A\t+,0x2B\t,,0x2C\t-,0x2D\t.,0x2E\t/,0x2F"; + substitutions = substitutions # "\tÄ,0x5B\tÖ,0x23\tÜ,0x24\tä,0x7B\tö,0x7C\tü,0x7D\tß,0x5F\t:,0x3A\t;,0x3B\t@,0x40\t>,0x3E"; + + string bufferLine; + string substEntry; + integer i; + string char; + string line; + string icon; + + string command = "0x02"; + foreach(bufferLine, msgBuffer) { + line = bufferLine.StrValueByIndex(splitter, 0); + icon = bufferLine.StrValueByIndex(splitter, 2); + if ((line <> "") || (icon <> "")) { + command = command # ",0x12"; + if ((line.Substr(0,2) == "0x") && (line.Length() == 4)) { + command = command # "," # line; + i = 12; + } + else { + i = 0; + } + while ((i < line.Length()) && (i < 12)) { + char = line.Substr(i, 1); + foreach(substEntry, substitutions){ + if (char == substEntry.Substr(0,1)){command = command # substEntry.Substr(1,5);} + } + i = i + 1; + } + command = command # ",0x11," # bufferLine.StrValueByIndex(splitter, 1); + if (icon <> "") { + command = command # ",0x13," # icon; + } + } + command = command # ",0x0A"; + } + command = command # ",0x03"; + + dom.GetObject("BidCos-RF." # dom.GetObject("$src$").Name().StrValueByIndex(".",1) # ".SUBMIT").State(command); + + ! ##### FERTIG ##### diff --git a/homematic/oled_Display_kurz b/homematic/oled_Display_kurz new file mode 100644 index 0000000..0825c84 --- /dev/null +++ b/homematic/oled_Display_kurz @@ -0,0 +1,249 @@ +! ### Homatic-Statusanzeige HM-Dis-WM55 #### +! ### Stausanzeige 2 , Vers. 1.0; +! ### Anzeige der Zysternen Füllstand, Zysternen Filter stand, Außentemperatur, Status der Türen, Fenster und Lichter + +!! Universalprogramm zum Füllen +!! (c) DrTob +!! optimized by thkl +!! changed by wortmann30 +!! Seitenzähler von Brufi + +!! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedinung des Programms + +! Farben +! 0x80 weiß +! 0x81 rot +! 0x82 orange +! 0x83 gelb +! 0x84 gruen +! 0x85 blau + +! Symbole +! 0x80 AUS +! 0x81 EIN +! 0x82 OFFEN +! 0x83 geschlossen +! 0x84 fehler +! 0x85 alles ok +! 0x86 information +! 0x87 neue nachricht +! 0x88 servicemeldung +! 0x89 Signal grün +! 0x8A Signal gelb +! 0x8B Signal rot + +! Zugriff auf vordefinierte Texte +! +! 0x80 Text 0 (Kanal 1 Text Zeile 1) +! 0x81 Text 1 (Kanal 1 Text Zeile 2) +! 0x82 Text 2 (Kanal 2 Text Zeile 3) +! 0x83 Text 3 (Kanal 2 Text Zeile 4) +! 0x84 Text 4 (Kanal 3 Text Zeile 5) +! 0x85 Text 5 (Kanal 3 Text Zeile 6) +! 0x86 Text 6 (Kanal 4 Text Zeile 7) +! 0x87 Text 7 (Kanal 4 Text Zeile 8) +! 0x88 Text 8 (Kanal 5 Text Zeile 9) +! 0x89 Text 9 (Kanal 5 Text Zeile 10) +! 0x8A Text 10 (Kanal 6 Text Zeile 11) +! 0x8B Text 11 (Kanal 6 Text Zeile 12) +! 0x8C Text 12 (Kanal 7 Text Zeile 13) +! 0x8D Text 13 (Kanal 7 Text Zeile 14) +! 0x8E Text 14 (Kanal 8 Text Zeile 15) +! 0x8F Text 15 (Kanal 8 Text Zeile 16) +! 0x90 Text 16 (Kanal 9 Text Zeile 17) +! 0x91 Text 17 (Kanal 9 Text Zeile 18) +! 0x92 Text 18 (Kanal 10 Text Zeile 19) +! 0x93 Text 19 (Kanal 10 Text Zeile 20) + +string zeile1 = ""; +string color1 = "0x80"; +string icon1 = ""; + +string zeile2 = ""; +string color2 = "0x80"; +string icon2 = ""; + +string zeile3 = ""; +string color3 = "0x80"; +string icon3 = ""; + +string zeile4 = ""; +string color4 = "0x80"; +string icon4 = ""; + +string zeile5 = ""; +string color5 = "0x80"; +string icon5 = ""; + +string zeile6 = ""; +string color6 = "0x80"; +string icon6 = ""; + +! ####### wie viele Seiten auf dem Display sollen durchlaufen werden? ########### + +integer seitenzahl = 2; + +! ############################################################### + +! ####################### Zähler entsprechend der Anzahl Tastendrücke verändern ################# + + +integer obj = dom.GetObject("seitenzaehler01"); ! ######## rausholen +integer xyz = obj.State(); +xyz = xyz-1; !######## rueckwaerts nach unten zaehlen +if (xyz <= 0) { + obj.Variable(seitenzahl); ! #### Seitenzähler auf Ausgang setzen +} else { + obj.State(xyz); ! ######### reinschreiben +} +! ############################################################################################### + +! --------- Anfang Ermitteln der Systemzustände und Zuweisung zu den einzelnen Zeilen ------------- +! ### Systemvariable seitenzaehler01 holen ### +var seitenZaehler = dom.GetObject("seitenzaehler01"); + +! ###################### Seite 1 ###################### + + +if (seitenZaehler.State()==1) { + ! ### Alarm an oder aus? #### + var oSysvar = dom.GetObject("Alarmanlage"); + if (oSysvar.State()==1) { + zeile1 = ""; + color1 = "0x80"; + icon1 = ""; + zeile2 = "Alarm:"; + color2 = "0x80"; + icon2 = ""; + zeile3 = ""; + color3="0x80"; + icon3 = ""; + zeile4 = "scharf-"; + color4="0x81"; + icon4 = ""; + zeile5 = "geschaltet"; + color5 = "0x81"; + icon5 = ""; + zeile6 = ""; + color6 = "0x80"; + icon6 = ""; + } else { + + zeile1 = ""; + color1 = "0x80"; + icon1 = ""; + zeile2 = "Alarm:"; + color2 = "0x80"; + icon2 = ""; + zeile3 = ""; + color3="0x80"; + icon3 = ""; + zeile4 = "ausge-"; + color4 = "0x84"; + icon4 = ""; + zeile5 = "schaltet"; + color5 = "0x84"; + icon5 = ""; + zeile6 = ""; + color6 = "0x80"; + icon6 = ""; + } +} + +! ###################### Seite 2 ###################### + + +if (seitenZaehler.State()==2) { + + ! ### Übersicht #### + + zeile1 = "Übersicht:"; + color1 = "0x80"; + icon1 = ""; + + ! #### Zeile 2 und 3 - Alle Fenster zu? Wie viele sind offen? ####### + ! # Gewerk mit dem Namen Verschluss wird gezählt + + var obj = dom.GetObject("Verschluss"); + string itemID; + var cntopen=0; + foreach(itemID, obj.EnumUsedIDs()) { + var item = dom.GetObject(itemID); + if(item.IsTypeOf(OT_CHANNEL)) { + var state=item.DPByHssDP("STATE"); + if(state.Value()<>0) { + cntopen=cntopen+1; + } + } + } + + if (cntopen>0) { + zeile2 = cntopen # " Fenster"; + color2 = "0x81"; + icon2 = ""; + zeile3 = "offen"; + color3 = "0x81"; + icon3 = ""; + } else { + zeile2 = "Fenster zu"; + color2 = "0x84"; + icon2 = ""; + } +} + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! System Routine do not change anything below ! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +string splitter="|"; +msgBuffer = zeile1 # splitter # color1 # splitter # icon1 # "\t"; +msgBuffer = msgBuffer # zeile2 # splitter # color2 # splitter # icon2 # "\t"; +msgBuffer = msgBuffer # zeile3 # splitter # color3 # splitter # icon3 # "\t"; +msgBuffer = msgBuffer # zeile4 # splitter # color4 # splitter # icon4 # "\t"; +msgBuffer = msgBuffer # zeile5 # splitter # color5 # splitter # icon5 # "\t"; +msgBuffer = msgBuffer # zeile6 # splitter # color6 # splitter # icon6; + + string substitutions = "A,0x41\tB,0x42\tC,0x43\tD,0x44\tE,0x45\tF,0x46\tG,0x47\tH,0x48\tI,0x49\tJ,0x4A\tK,0x4B\tL,0x4C\tM,0x4D\tN,0x4E\tO,0x4F\tP,0x50\tQ,0x51\tR,0x52\tS,0x53\tT,0x54\tU,0x55\tV,0x56\tW,0x57\tX,0x58\tY,0x59\tZ,0x5A"; + substitutions = substitutions # "\ta,0x61\tb,0x62\tc,0x63\td,0x64\te,0x65\tf,0x66\tg,0x67\th,0x68\ti,0x69\tj,0x6A\tk,0x6B\tl,0x6C\tm,0x6D\tn,0x6E\to,0x6F\tp,0x70\tq,0x71\tr,0x72\ts,0x73\tt,0x74\tu,0x75\tv,0x76\tw,0x77\tx,0x78\ty,0x79\tz,0x7A"; + substitutions = substitutions # "\t0,0x30\t1,0x31\t2,0x32\t3,0x33\t4,0x34\t5,0x35\t6,0x36\t7,0x37\t8,0x38\t9,0x39\t ,0x20\t!,0x21\t\",0x22\t%,0x25\t&,0x26\t=,0x27\t(,0x28\t),0x29\t*,0x2A\t+,0x2B\t,,0x2C\t-,0x2D\t.,0x2E\t/,0x2F"; + substitutions = substitutions # "\tÄ,0x5B\tÖ,0x23\tÜ,0x24\tä,0x7B\tö,0x7C\tü,0x7D\tß,0x5F\t:,0x3A\t;,0x3B\t@,0x40\t>,0x3E"; + + string bufferLine; + string substEntry; + integer i; + string char; + string line; + string icon; + + string command = "0x02"; + foreach(bufferLine, msgBuffer) { + line = bufferLine.StrValueByIndex(splitter, 0); + icon = bufferLine.StrValueByIndex(splitter, 2); + if ((line <> "") || (icon <> "")) { + command = command # ",0x12"; + if ((line.Substr(0,2) == "0x") && (line.Length() == 4)) { + command = command # "," # line; + i = 12; + } + else { + i = 0; + } + while ((i < line.Length()) && (i < 12)) { + char = line.Substr(i, 1); + foreach(substEntry, substitutions){ + if (char == substEntry.Substr(0,1)){command = command # substEntry.Substr(1,5);} + } + i = i + 1; + } + command = command # ",0x11," # bufferLine.StrValueByIndex(splitter, 1); + if (icon <> "") { + command = command # ",0x13," # icon; + } + } + command = command # ",0x0A"; + } + command = command # ",0x03"; + + dom.GetObject("BidCos-RF." # dom.GetObject("$src$").Name().StrValueByIndex(".",1) # ".SUBMIT").State(command); + + ! ##### FERTIG ##### + diff --git a/homematic/oled_Display_lang b/homematic/oled_Display_lang new file mode 100644 index 0000000..f891e83 --- /dev/null +++ b/homematic/oled_Display_lang @@ -0,0 +1,221 @@ +! ### Homatic-Statusanzeige HM-Dis-WM55 #### +! ### Stausanzeige 2 , Vers. 1.0; +! ### Anzeige der Zysternen Füllstand, Zysternen Filter stand, Außentemperatur, Status der Türen, Fenster und Lichter + +!! Universalprogramm zum Füllen +!! (c) DrTob +!! optimized by thkl +!! changed by wortmann30 +!! Seitenzähler von Brufi + +!! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedinung des Programms + +! Farben +! 0x80 weiß +! 0x81 rot +! 0x82 orange +! 0x83 gelb +! 0x84 gruen +! 0x85 blau + +! Symbole +! 0x80 AUS +! 0x81 EIN +! 0x82 OFFEN +! 0x83 geschlossen +! 0x84 fehler +! 0x85 alles ok +! 0x86 information +! 0x87 neue nachricht +! 0x88 servicemeldung +! 0x89 Signal grün +! 0x8A Signal gelb +! 0x8B Signal rot + +! Zugriff auf vordefinierte Texte +! +! 0x80 Text 0 (Kanal 1 Text Zeile 1) +! 0x81 Text 1 (Kanal 1 Text Zeile 2) +! 0x82 Text 2 (Kanal 2 Text Zeile 3) +! 0x83 Text 3 (Kanal 2 Text Zeile 4) +! 0x84 Text 4 (Kanal 3 Text Zeile 5) +! 0x85 Text 5 (Kanal 3 Text Zeile 6) +! 0x86 Text 6 (Kanal 4 Text Zeile 7) +! 0x87 Text 7 (Kanal 4 Text Zeile 8) +! 0x88 Text 8 (Kanal 5 Text Zeile 9) +! 0x89 Text 9 (Kanal 5 Text Zeile 10) +! 0x8A Text 10 (Kanal 6 Text Zeile 11) +! 0x8B Text 11 (Kanal 6 Text Zeile 12) +! 0x8C Text 12 (Kanal 7 Text Zeile 13) +! 0x8D Text 13 (Kanal 7 Text Zeile 14) +! 0x8E Text 14 (Kanal 8 Text Zeile 15) +! 0x8F Text 15 (Kanal 8 Text Zeile 16) +! 0x90 Text 16 (Kanal 9 Text Zeile 17) +! 0x91 Text 17 (Kanal 9 Text Zeile 18) +! 0x92 Text 18 (Kanal 10 Text Zeile 19) +! 0x93 Text 19 (Kanal 10 Text Zeile 20) + +string zeile1 = ""; +string color1 = "0x80"; +string icon1 = ""; + +string zeile2 = ""; +string color2 = "0x80"; +string icon2 = ""; + +string zeile3 = ""; +string color3 = "0x80"; +string icon3 = ""; + +string zeile4 = ""; +string color4 = "0x80"; +string icon4 = ""; + +string zeile5 = ""; +string color5 = "0x80"; +string icon5 = ""; + +string zeile6 = ""; +string color6 = "0x80"; +string icon6 = ""; + +! ####### wie viele Seiten auf dem Display sollen durchlaufen werden? ########### +integer seitenzahl = 2; + +! ############################################################### + +! --------- Anfang Ermitteln der Systemzustände und Zuweisung zu den einzelnen Zeilen ------------- + +! ### Systemvariable seitenzaehler01 holen ### +var seitenZaehler = dom.GetObject("seitenzaehler01"); + +! ###################### Seite 1 ###################### +if (seitenZaehler.State()==1) { + ! ### Schlafmodus einschalten + var oSysvar = dom.GetObject("Alarmanlage"); + ! ### wenn noch kein Schlafmodus aktiv + if (oSysvar.State()==0) { + oSysvar.State(1); ! ##### Setze Schlafmodus auf Schlafen + + zeile1 = "Alarm"; + color1="0x80"; + icon1 = ""; + zeile2 = ""; + color2="0x80"; + icon2 = ""; + zeile3 = "scharf"; + color3="0x82"; + icon3 = ""; + zeile4 = ""; + color4="0x80"; + icon4 = ""; + zeile5 = ""; + color5="0x80"; + icon5 = ""; + zeile6 = ""; + color6="0x80"; + icon6 = ""; + } else { + oSysvar.State(0); ! ##### Setze Schlafmodus auf Wach + zeile1 = "Alarm"; + color1="0x80"; + icon1 = ""; + zeile2 = ""; + color2="0x80"; + icon2 = ""; + zeile3 = "ausge-"; + color3="0x84"; + icon3 = ""; + zeile4 = "schaltet"; + color4="0x84"; + icon4 = ""; + zeile5 = ""; + color5="0x84"; + icon5 = ""; + zeile6 = ""; + color6="0x80"; + icon6 = ""; + } + +} + +! ###################### Seite 2###################### +if (seitenZaehler.State()==2) { + zeile1 = ""; + color1="0x80"; + icon1 = ""; + zeile2 = "Keine"; + color2 = "0x80"; + icon2 = ""; + zeile3 = "Aktion"; + color3 = "0x80"; + icon3 = ""; + zeile4 = "hinterlegt"; + color4 = "0x80"; + icon4 = ""; + zeile5 = ""; + color5="0x80"; + icon5 = ""; + zeile6 = ""; + color6 = "0x84"; + icon6 = ""; +} + +! --------- Ende Ermitteln der Systemzustände und Zuweisung zu den einzelnen Zeilen ------------- +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +! System Routine do not change anything below ! +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +string splitter="|"; +string msgBuffer = zeile1 # splitter # color1 # splitter # icon1 # "\t"; +msgBuffer = msgBuffer # zeile2 # splitter # color2 # splitter # icon2 # "\t"; +msgBuffer = msgBuffer # zeile3 # splitter # color3 # splitter # icon3 # "\t"; +msgBuffer = msgBuffer # zeile4 # splitter # color4 # splitter # icon4 # "\t"; +msgBuffer = msgBuffer # zeile5 # splitter # color5 # splitter # icon5 # "\t"; +msgBuffer = msgBuffer # zeile6 # splitter # color6 # splitter # icon6; + +string substitutions = "A,0x41\tB,0x42\tC,0x43\tD,0x44\tE,0x45\tF,0x46\tG,0x47\tH,0x48\tI,0x49\tJ,0x4A\tK,0x4B\tL,0x4C\tM,0x4D\tN,0x4E\tO,0x4F\tP,0x50\tQ,0x51\tR,0x52\tS,0x53\tT,0x54\tU,0x55\tV,0x56\tW,0x57\tX,0x58\tY,0x59\tZ,0x5A"; +substitutions = substitutions # "\ta,0x61\tb,0x62\tc,0x63\td,0x64\te,0x65\tf,0x66\tg,0x67\th,0x68\ti,0x69\tj,0x6A\tk,0x6B\tl,0x6C\tm,0x6D\tn,0x6E\to,0x6F\tp,0x70\tq,0x71\tr,0x72\ts,0x73\tt,0x74\tu,0x75\tv,0x76\tw,0x77\tx,0x78\ty,0x79\tz,0x7A"; +substitutions = substitutions # "\t0,0x30\t1,0x31\t2,0x32\t3,0x33\t4,0x34\t5,0x35\t6,0x36\t7,0x37\t8,0x38\t9,0x39\t ,0x20\t!,0x21\t\",0x22\t%,0x25\t&,0x26\t=,0x27\t(,0x28\t),0x29\t*,0x2A\t+,0x2B\t,,0x2C\t-,0x2D\t.,0x2E\t/,0x2F"; +substitutions = substitutions # "\tÄ,0x5B\tÖ,0x23\tÜ,0x24\tä,0x7B\tö,0x7C\tü,0x7D\tß,0x5F\t:,0x3A\t;,0x3B\t@,0x40\t>,0x3E"; + +string bufferLine; +string substEntry; +integer i; +string char; +string line; +string icon; + +string command = "0x02"; +foreach(bufferLine, msgBuffer) { +line = bufferLine.StrValueByIndex(splitter, 0); +icon = bufferLine.StrValueByIndex(splitter, 2); +if ((line <> "") || (icon <> "")) { +command = command # ",0x12"; +if ((line.Substr(0,2) == "0x") && (line.Length() == 4)) { +command = command # "," # line; +i = 12; +} +else { +i = 0; +} +while ((i < line.Length()) && (i < 12)) { +char = line.Substr(i, 1); +foreach(substEntry, substitutions){ +if (char == substEntry.Substr(0,1)){command = command # substEntry.Substr(1,5);} +} +i = i + 1; +} +command = command # ",0x11," # bufferLine.StrValueByIndex(splitter, 1); +if (icon <> "") { +command = command # ",0x13," # icon; +} +} +command = command # ",0x0A"; +} +command = command # ",0x03"; + +dom.GetObject("BidCos-RF." # dom.GetObject("$src$").Name().StrValueByIndex(".",1) # ".SUBMIT").State(command); + +! ##### FERTIG ##### + diff --git a/homematic/tuer_entriegeln_alarmanlage_aus.hm b/homematic/tuer_entriegeln_alarmanlage_aus.hm new file mode 100644 index 0000000..80a2a2a --- /dev/null +++ b/homematic/tuer_entriegeln_alarmanlage_aus.hm @@ -0,0 +1,13 @@ +! +! +string sysVars="Haustuer_verschlossen,Alarmanlage,Alarm_WDG,Alarm_EGL,Alarm_EGR,Alarm_KEL,Alarm_WKG,alleAlarmzonenScharf,Alarmzone_EGL_soll,Alarmzone_EGR_soll,Alarmzone_KEL_soll,Alarmzone_WDG_soll,Alarmzone_WKG_soll,Alarm_TKG,Alarm_TEG,Alarm_TDG,Alarmzone_TKG_soll,Alarmzone_TEG_soll,Alarmzone_TDG_soll"; + +string sysVar; + +foreach(sysVar,sysVars.Split(",")) { + var theVar = dom.GetObject(sysVar); + if (theVar != null) { + theVar.State(false); + } +} + -- 2.43.0