HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Problemlösungen und Hinweise von allgemeinem Interesse zur Haussteuerung mit HomeMatic

Moderator: Co-Administratoren

alchy
Beiträge: 10754
Registriert: 24.02.2011, 01:34
System: CCU
Hat sich bedankt: 65 Mal
Danksagung erhalten: 673 Mal

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von alchy » 14.02.2017, 10:04

Meine Glaskugel kann nicht erraten, wieviel Eigeninitiative jemand entwickelt oder was er vielleicht selber hinbekommt.
Ob er die Doku kennt, oder bisher einfach nur keinen Link dazu gefunden hat usw.

Mir ist schon klar, das nicht jeder alles beherrscht und es ist auch kein Problem, wenn Fragen gestellt werden.
Ich wüsste nicht, das ich dir das Gefühl gegeben hätte, das dem nicht so wäre.

Mein Hinweis auf ein generelles Script ist durchaus dem geschuldet und ernst gemeint.
Ein Script, wo der User nur den Namen der Systemvariable einträgt z.B.
Wenn ich mal Zeit finde, setz ich mich vielleicht mal ran.
Im Moment laufen aber zu viele PN Projekte.

Zum Thema Systemvariablen sollte das aber schnell mal erledigt sein.

Alchy
PS: ich bin auch keine 20 mehr, selbst vom doppeltem bin ich schon weit entfernt. :mrgreen:

Blacklist................... almost full
Ignoranz ist die Summe aller Maßnahmen die man ergreift, um bestehende Tatsachen nicht sehen zu müssen.

© Sandra Pulsfort (*1974)

Lies bitte die Logik von WebUI Programmen und die Tipps und Tricks für Anfänger.

Wichtig auch CUxD ersetzt System.exec. Die HM Script Doku (Downloadart Skripte) hilft auch weiter.
Zum Testen von Scripten den >> HomeMatic Script Executor << von Anli benutzen.

AxelS-67
Beiträge: 26
Registriert: 28.01.2015, 09:41

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von AxelS-67 » 25.02.2017, 20:06

Hier muss ich mich jetzt auch mal ran hängen..

Ich habe eine Display Fernbedienung HM-RC-Dis-H-x-EU
Meine Überlegung war, ähnliche Funktion auch mit diese Fernbedienung zu realisieren.
Kann es sein, dass die Display Fernbedienung kein SUBMIT hat?

Gruß
Axel
Gruß
Axel

alchy
Beiträge: 10754
Registriert: 24.02.2011, 01:34
System: CCU
Hat sich bedankt: 65 Mal
Danksagung erhalten: 673 Mal

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von alchy » 25.02.2017, 20:30

AxelS-67 hat geschrieben:Kann es sein, dass die Display Fernbedienung kein SUBMIT hat
die HM-RC-Dis-H-x-EU hat keinen SUBMIT Datenpunkt.
HM Scriptdoku aus meiner Signatur - Teil 4 Datenpunkte - ca. Seite 217

Alchy

Blacklist................... almost full
Ignoranz ist die Summe aller Maßnahmen die man ergreift, um bestehende Tatsachen nicht sehen zu müssen.

© Sandra Pulsfort (*1974)

Lies bitte die Logik von WebUI Programmen und die Tipps und Tricks für Anfänger.

Wichtig auch CUxD ersetzt System.exec. Die HM Script Doku (Downloadart Skripte) hilft auch weiter.
Zum Testen von Scripten den >> HomeMatic Script Executor << von Anli benutzen.

AxelS-67
Beiträge: 26
Registriert: 28.01.2015, 09:41

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von AxelS-67 » 26.02.2017, 14:18

alchy hat geschrieben: die HM-RC-Dis-H-x-EU hat keinen SUBMIT Datenpunkt.
HM Scriptdoku aus meiner Signatur - Teil 4 Datenpunkte - ca. Seite 217

Alchy
D.h. Beschriftungen der einzelnen Kanäle können nicht aus einem Script/Programm heraus verändert werden? Es ist nur eine feste Zuordnung über die Eigenschaften des Gerät möglich?

Axel
Gruß
Axel

Dirk_D
Beiträge: 4
Registriert: 08.12.2016, 14:29

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von Dirk_D » 15.11.2017, 13:28

Hallo,
ich benutze das Script zum seitenweisen Blättern von

!! Universalprogramm zum Füllen
!! (c) DrTob
!! optimized by thkl
!! changed by wortmann30
!! Seitenzähler von Brufi

Code: Alles auswählen

! ####### wie viele Seiten auf dem Display sollen durchlaufen werden? ###########

    integer seitenzahl = 5;

    ! ###############################################################
     
    ! ############## Zähler entsprechend der Anzahl Tastendrücke verändern ##############
     

    integer obj = dom.GetObject("seitenzaehler01");        ! ######## rausholen

    integer xyz = obj.State();


    if (xyz == seitenzahl) {
      obj.Variable(1);
    }
    else {

      xyz = xyz + 1; ! ######## incrementieren
      obj.Variable(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){

! ### Aussentemperatur anzeigen ####
     
  var ATemp = dom.GetObject("BidCos-RF.NEQ0533996:1.TEMPERATURE").Value();
      ATemp = ATemp.ToString(1);

zeile1 = "Seite 1";
      color1 = "0x80";
      icon1 = "";
   zeile3 = "Außentemp.";
      color3 = "0x80";
      icon3 = "";
   zeile4 = ""#ATemp#" C";
      color4 = "0x83";
      icon4 = "";
}


    ! ###################### Seite 2 ######################


    if (seitenZaehler.State()==2){
     
     
! ### Fenster/Türen im EG ####

    var oSysvar = dom.GetObject("Fenster/Türen EG");
    if (oSysvar.State()==1){

    zeile1 = "Seite 2";
    color1 = "0x80";
    icon1 = "";
    zeile2 = "";
    color2 = "0x80";
    icon2 = "";
    zeile3 = "Fenster EG";
    color3="0x80";
    icon3 = "";
    zeile4 = "min 1 AUF";
    color4="0x81";
    icon4 = "";
    zeile5 = "";
    color5 = "0x81";
    icon5 = "";
    zeile6 = "";
    color6 = "0x80";
    icon6 = "";
    }
    else
    {

    zeile1 = "Seite 2";
    color1 = "0x80";
    icon1 = "";
    zeile2 = "";
    color2 = "0x80";
    icon2 = "";
    zeile3 = "Fenster EG";
    color3="0x80";
    icon3 = "";
    zeile4 = "alle ZU";
    color4 = "0x84";
    icon4 = "";
    zeile5 = "";
    color5 = "0x84";
    icon5 = "";
    zeile6 = "";
    color6 = "0x80";
    icon6 = "";
}
}


    ! ###################### Seite 3 ######################


    if (seitenZaehler.State()==3){


! ### Fenster im OG ####
     
    var oSysvar = dom.GetObject("Fenster OG");
    if (oSysvar.State()==1){

    zeile1 = "Seite 3";
    color1 = "0x80";
    icon1 = "";
    zeile2 = "";
    color2 = "0x80";
    icon2 = "";
    zeile3 = "Fenster OG";
    color3="0x80";
    icon3 = "";
    zeile4 = "min 1 AUF";
    color4="0x81";
    icon4 = "";
    zeile5 = "";
    color5 = "0x81";
    icon5 = "";
    zeile6 = "";
    color6 = "0x80";
    icon6 = "";
    }
    else
    {

    zeile1 = "Seite 3";
    color1 = "0x80";
    icon1 = "";
    zeile2 = "";
    color2 = "0x80";
    icon2 = "";
    zeile3 = "Fenster OG";
    color3="0x80";
    icon3 = "";
    zeile4 = "alle ZU";
    color4 = "0x84";
    icon4 = "";
    zeile5 = "";
    color5 = "0x84";
    icon5 = "";
    zeile6 = "";
    color6 = "0x80";
    icon6 = "";
}
    

    ! ###################### Seite 4 ######################


    if (seitenZaehler.State()==4){
     
     
! ### Testseite ####

 zeile1 = "Seite 4";
 color1 = "0x80";
 icon1 = "";

 zeile2 = "";
 color2 = "0x80";
 icon2  = "";

 zeile3 = "";
 color3 = "0x80";
 icon3  = "";

 zeile4 = "";
 color4 = "0x80";
 icon4  = "";

 zeile5 = "";
 color5 = "0x80";
 icon5  = "";

 zeile6 = "";
 color6 = "0x80";
 icon6  = "";
}
}


    ! ### Platz für weitere Seiten...
Das Blättern funktioniert - Seiteninhalte werden allerdings nur bis einschließlich Seite 3 angezeigt.
Dabei tritt folgendes Problem auf:
Seite 4 ist in der Anzeige leer (schwarzes Display). Auch wenn ich z. B. den Inhalt der Seite 1 nach Seite 4 kopiere ändert sich daran nichts -Seite 4 zeigt nichts an.

Kann mir hierbei jemand einen Tip geben, wie ich das Problem lösen kann?

Danke
Dirk_D

flo_da_ho
Beiträge: 9
Registriert: 21.03.2016, 16:57

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von flo_da_ho » 15.09.2018, 13:23

Hallo zusammen,

musste meine CCU neu aufsetzten und zu dem Anlass habe ich mir das Programm nochmals angeschaut. Habe es jetzt so umgeschrieben, dass alles in einem Skript läuft. Redundante Pflege kann ich einfach nicht ;-)

Das Skript erkennt also nun selbst ob lange oder kurze Taste und ob oben oder unten. Im Code gibt es dann ein if() welches die aktuelle Seite auswertet und darin wird entschieden welcher Knopf gedrückt wurde und was somit zu tun ist und was angezeigt werden soll.
Da es ein wenig länger ist, empfehle ich das Skript in z.B. ATOM zu editieren, der kann HM Skript Syntax richtig anzeigen. Dann per C&P in die CCU Web(pf)UI.
Bildschirmfoto 2018-09-15 um 13.32.07.png
Skript in ATOM
Man braucht also eine Variable die die Seite zählt:
Bildschirmfoto 2018-09-15 um 13.19.16.png

Dann braucht man ein Programm welches bei allen Tastendrücken anspringt:
Bildschirmfoto 2018-09-15 um 13.09.21.png

Zuletzt dann das Skript:

Code: Alles auswählen

! DISPLAY

!! Universalprogramm zum Füllen
!! (c) DrTob
!! optimized by thkl
!! changed by wortmann30
!! Seitenzähler von Brufi
!! Tasterauswertung flo_da_ho

! Das Programm holt sich den Auslöser (oben oder unten, lang oder kurz)
! selbst und zeigt dann, abhängig von der aktuellen Seite, den entsprechenden
! Text an und/oder führt die entsprechende Aktion aus.

! #### Defaultwerte von Icon, Farbe und Text für jede Zeile ####################

! Vordefinierte Texte (Dipslay -> Einstellen in der CCU)
! können statt des Strings gesetzt werden (viel! schneller)
! 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 zeile2 = "";
string zeile3 = "";
string zeile4 = "";
string zeile5 = "";
string zeile6 = "";

! 0x80 weiß
! 0x81 rot
! 0x82 orange
! 0x83 gelb
! 0x84 gruen
! 0x85 blau
string color1 = "0x80";
string color2 = "0x80";
string color3 = "0x80";
string color4 = "0x80";
string color5 = "0x80";
string color6 = "0x80";

! 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
string icon1 = "";
string icon2 = "";
string icon3 = "";
string icon4 = "";
string icon5 = "";
string icon6 = "";

! #### wie viele Seiten auf dem Display sollen durchlaufen werden? #############

integer maxSeiten = 2;

! #### Auslöser holen ##########################################################

string sender = dom.GetObject("$src$").Name();

! taster = 2 --> obere Taste
! taster = 1 --> untere Taste
integer taster = sender.StrValueByIndex(":",1).StrValueByIndex(".",0).ToInteger();

! druck = PRESS_SHORT --> kurzer Tastendruck
! druck = PRESS_LONG --> langer Tastendruck
string druck = sender.StrValueByIndex(":",1).StrValueByIndex(".",1);

! #### Displayseite bestimmen und anpassen #####################################

! aktuell angezeige Seite aus der CCU holen
integer obj = dom.GetObject("seitenzaehler01");
integer aktuelleSeite = obj.Variable();

if (druck == "PRESS_SHORT"){ ! seitenzaehler01 anpassen wenn kurzer Tastendruck

  ! abhängig von aktuelleSeite und Auslöser die Displayseite anpassen
  if (aktuelleSeite == 0){ ! Display war aus beim Druck eines Buttons
    aktuelleSeite = 1;
  }

  else{ ! Display war an und hat somit schon eine Seite gezeigt
    if (taster == 2){ ! oberer Button (hier: nächste Seite)
      aktuelleSeite = 1 + aktuelleSeite;
    }
    else { ! unterer Button (hier: vorherige Seite)
      aktuelleSeite = -1 + aktuelleSeite;
    }
    if (aktuelleSeite > maxSeiten){
      aktuelleSeite = 1;
    }

    if (aktuelleSeite < 1){
      aktuelleSeite = maxSeiten;
    }
  }

  ! in CCU sichern
  obj.Variable(aktuelleSeite);
}

! #### Anzeige und Aktionen ####################################################

! aktuell angezeige Seite aus der CCU holen
var seitenZaehler = dom.GetObject("seitenzaehler01");

! ---- Seite 1 ------------------------------
! Dies und Das
! -------------------------------------------

if (seitenZaehler.State()==1){
  if (druck == "PRESS_SHORT"){
    zeile1 = "Seite 1";

    ! zeileX = "";
    ! colorX = "";
    ! iconX = "";
  }
  if (druck == "PRESS_LONG"){
    if (taster == 1){
      ! ggf. Aktion für langen unteren Druck auf Seite 1
      zeile1 = "Seite 1";
      zeile3 = "Lang unten";

      ! zeileX = "";
      ! colorX = "";
      ! iconX = "";
    }
    else{
      zeile1 = "Seite 1";
      zeile3 = "Lang oben";

      ! zeileX = "";
      ! colorX = "";
      ! iconX = "";
    }
  }
}

! ---- Seite 2 ------------------------------
! Anderes und Sonstiges
! -------------------------------------------

if (seitenZaehler.State()==2){
  if (druck == "PRESS_SHORT"){
    zeile1 = "Seite 2";

    ! zeileX = "";
    ! colorX = "";
    ! iconX = "";
  }
  if (druck == "PRESS_LONG"){
    if (taster == 1){
      ! ggf. Aktion für langen unteren Druck auf Seite 2
      zeile1 = "Seite 2";
      zeile3 = "Lang unten";

      ! zeileX = "";
      ! colorX = "";
      ! iconX = "";
    }
    else{
      zeile1 = "Seite 2";
      zeile3 = "Lang oben";

      ! zeileX = "";
      ! colorX = "";
      ! iconX = "";
    }
  }
}

! ##############################################################################

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 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";
! " <- Diese Zeile behebt einen Anzeigebug in ATOM Editor, keine Funktion!

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 #####
Hoffe es hilft dem ein oder anderen Neueinsteiger.

Gruß,
Florian

Janniman
Beiträge: 212
Registriert: 08.04.2015, 14:29
Wohnort: Seevetal
Hat sich bedankt: 2 Mal

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von Janniman » 29.11.2018, 11:43

Hallo und ein herzliches Danke für die schöne Überarbeitung!

Das ist schon echt gut, aber ich als Programmierlegasteniker habe ein Problem mit dem Schreiben / Ändern von Variablen (Sysvar) vom Typ boolean.
Da ich ich die beiden Variablen ("var_Besuch-Schlafzimmer" und "var_Besuch_Kind") als boolean angelegt hatte (Anzeige bei den Systemvariablen: wahr=on unwahr=off) und diese in diversen anderen Skripten und Anzeigen (Mediola) verwende, möchte ich diese Beschreibung ungerne ändern.
Wenn ich nun versuche eine der beiden Variablen vom Display aus zu ändern, dann gelingt dies mir nicht.
Weder mit den Werten 0/1 ; true/false ; on/off , daher vermute ich das ich durch meine Initialisierung einfach den "Schreibbefehl" anpassen muss. Nur wie muss der Befehl dann aussehen?

Es geht um die Zeilen 390 bis 403, denn alles andere funktioniert tadellos, inkl. der Sprünge im Display auf Seite 2.

Code: Alles auswählen

if (zeilenZaehler == 2 ) {
	if ( oSysvar == true)
	{ oSysvar = false;
	dom.GetObject("var_Besuch_Kind").State(oSysvar);}
else { if ( oSysvar == false)
	{ oSysvar = true;
	dom.GetObject("var_Besuch_Kind").State(oSysvar);}
	}}
if (zeilenZaehler == 4 ) {
	if ( sSysvar == true)
	{sSysvar = false;
	dom.GetObject("var_Besuch-Schlafzimmer").State(sSysvar);}
else {	if ( sSysvar == false)
	{sSysvar = true;
	dom.GetObject("var_Besuch-Schlafzimmer").State(sSysvar);}
	}}
Klar könnte ich die beiden "if" innerhalb des "else" weglassen, aber es gab wegen der Kommunikationsdauer immer wieder Fehler, daher ist das so gewachsen.
Liebe Programmierer, über meine Anlage bitte nicht zu sehr schimpfen, ich bin Laie. So ist es für mich verständlich, wenn ich etwas überarbeiten muss. Optimierungen sind natürlich willkommen.

Kann mir bitte jemand bezüglich der Sysvar-Problematik auf die Sprünge helfen?

Jan

Hier mal das komplette Skript.

Code: Alles auswählen

! DISPLAY

!! Universalprogramm zum Füllen
!! (c) DrTob
!! optimized by thkl
!! changed by wortmann30
!! Seitenzähler von Brufi
!! Tasterauswertung flo_da_ho
!  geklaute Fetzen aus dem HM-Forum

! Das Programm holt sich den Auslöser (oben oder unten, lang oder kurz)
! selbst und zeigt dann, abhängig von der aktuellen Seite, den entsprechenden
! Text an und/oder führt die entsprechende Aktion aus.

! #### Defaultwerte von Icon, Farbe und Text für jede Zeile ####################

! Vordefinierte Texte (Dipslay -> Einstellen in der CCU)
! können statt des Strings gesetzt werden (viel! schneller)
! 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 zeile2 = "";
string zeile3 = "";
string zeile4 = "";
string zeile5 = "";
string zeile6 = "";

! 0x80 weiß
! 0x81 rot
! 0x82 orange
! 0x83 gelb
! 0x84 gruen
! 0x85 blau
string color1 = "0x80";
string color2 = "0x80";
string color3 = "0x80";
string color4 = "0x80";
string color5 = "0x80";
string color6 = "0x80";

! 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
string icon1 = "";
string icon2 = "";
string icon3 = "";
string icon4 = "";
string icon5 = "";
string icon6 = "";

! ### die beiden boolean-Sysvar für den Besuch, jeweils true=on false=off
boolean oSysvar = (dom.GetObject(ID_SYSTEM_VARIABLES).Get("var_Besuch_Kind")).Value();
boolean sSysvar = (dom.GetObject(ID_SYSTEM_VARIABLES).Get("var_Besuch-Schlafzimmer")).Value();

! #### wie viele Seiten und auf dem Display sollen durchlaufen werden? #############

integer maxSeiten = 2;

! #### Auslöser holen ##########################################################

string sender = dom.GetObject("$src$").Name();


! taster = 2 --> obere Taste
! taster = 1 --> untere Taste
integer taster = sender.StrValueByIndex(":",1).StrValueByIndex(".",0).ToInteger();

! druck = PRESS_SHORT --> kurzer Tastendruck
! druck = PRESS_LONG --> langer Tastendruck
string druck = sender.StrValueByIndex(":",1).StrValueByIndex(".",1);

! #### Displayseite bestimmen und anpassen #####################################

! aktuell angezeige Seite aus der CCU holen
integer obj = dom.GetObject("OLED_Seitenzaehler");
integer aktuelleSeite = obj.Variable();

if (druck == "PRESS_SHORT"){ ! OLED_Seitenzaehler anpassen wenn kurzer Tastendruck

  ! abhängig von aktuelleSeite und Auslöser die Displayseite anpassen
  if (aktuelleSeite == 0){ ! Display war aus beim Druck eines Buttons
  aktuelleSeite = 1;
  }

  else { ! Display war an und hat somit schon eine Seite gezeigt
    if (taster == 2){ ! oberer Button (hier: nächste Seite)
      aktuelleSeite = 1 + aktuelleSeite;
    }
    else { ! unterer Button (hier: vorherige Seite)
      aktuelleSeite = -1 + aktuelleSeite;
    }
    if (aktuelleSeite > maxSeiten){
      aktuelleSeite = 1;
    }
    if (aktuelleSeite < 1){
      aktuelleSeite = maxSeiten;
    }
  }
  ! in CCU sichern
  
  obj.Variable(aktuelleSeite);
}

! #### Anzeige und Aktionen ####################################################

! aktuell angezeige Seite aus der CCU holen
var seitenZaehler = dom.GetObject("OLED_Seitenzaehler");

! ---- Seite 1 ------------------------------
! Dies und Das
! -------------------------------------------

if (seitenZaehler.State()==1){
  if (druck == "PRESS_SHORT"){
 
! ### Übersicht ####
  
zeile1 = "Übersicht:";
color1 = "0x80";
icon1 = "";  

! #### Zeile 3 und 4 - Alle Fenster zu? Wie viele sind offen? #######
! # Gewerk mit dem Namen Verschl_Fenster-Tueren wird gezählt

var obj = dom.GetObject("Verschl_Fenster-Tueren");
 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) {

var cntoffen;
var cntkipp;
object cntoffentmp = dom.GetObject(ID_SYSTEM_VARIABLES).Get("varVerschEG_offen"); 
object cntkipptmp = dom.GetObject(ID_SYSTEM_VARIABLES).Get("varVerschEG_kipp"); 
! Werte auslesen und zur Berechnung zur Verfügung stellen
cntoffen = cntoffentmp.Value(); 
cntkipp = cntkipptmp.Value();

 if(cntoffen > 0)
 { cntoffen = cntoffen.ToString(0);
   zeile3 = cntoffen # " offen";
   color3 = "0x81";
   icon3= "";
 }
 else {
   zeile3 = "0 offen";
   color3 = "0x84";
   icon3 = "";
 }

 if(cntkipp > 0)
 { cntkipp = cntkipp.ToString(0);
   zeile4 = cntkipp # " gekippt";
   color4 = "0x81";
   icon4= "";
 }
 else {
   zeile4 = "0 gekippt";
   color4 = "0x84";
   icon4 = "";
 }
 }
else {
  zeile3 = "Fenster zu";
  color3 = "0x84";
  icon3 = "";
}
! #### Zeile 4 Temperatur im Außentemperatur

var channel=dom.GetObject(ID_SYSTEM_VARIABLES).Get("Aussentemperatur");
var atemp = channel.Value();
if(atemp > 23.0)
{ atemp = atemp.ToString(1);
  zeile5 = "A-Warm "#atemp#"";
  color5 = "0x81";
  icon5 = "";
}
else {
if((atemp > 15.0) && (atemp < 23.0))
{ atemp = atemp.ToString(1);
  zeile5 = "A-Norm "#atemp#"";
  color5 = "0x82";
  icon5 = "";
}
else {
if((atemp > 4.0) && (atemp < 15.0))
{ atemp = atemp.ToString(1);
  zeile5 = "A-Kühl "#atemp#"";
  color5 = "0x80";
  icon5 = "";
}
else {
if((atemp > -1.0) && (atemp < 4.0))
{ atemp = atemp.ToString(1);
  zeile5 = "A-Kalt "#atemp#"";
  color5 = "0x83";
  icon5 = "";
}
else {
if(atemp < -1.0)
{ atemp = atemp.ToString(1);
  zeile5 = "A-Frost "#atemp#"";
  color5 = "0x85";
  icon5 = "";
}}}}}

! #### Zeile 6 Temperatur Geräteraum

var gtemp = dom.GetObject("BidCos-RF.MEQ0603390:1.TEMPERATURE").Value();
if(gtemp > 23.0)
{ gtemp = gtemp.ToString(1);
  zeile6 = "G-Raum "#gtemp#"";
  color6 = "0x81";
  icon6 = "";
}
else {
if((gtemp > 15.0) && (gtemp < 23.0))
{ gtemp = gtemp.ToString(1);
  zeile6 = "G-Raum "#gtemp#"";
  color6 = "0x82";
  icon6 = "";
}
else {
if((gtemp > 6.0) && (gtemp < 15.0))
{ gtemp = gtemp.ToString(1);
  zeile6 = "G-Raum "#gtemp#"";
  color6 = "0x80";
  icon6 = "";
}
else {
if(gtemp < 6.0))
{ gtemp = gtemp.ToString(1);
  zeile6 = "G-Raum "#gtemp#"";
  color6 = "0x85";
  icon6 = "";
}}}}
  }
	
if (druck == "PRESS_LONG"){
    if (taster == 1){
      ! ggf. Aktion für langen unteren Druck auf Seite 1
      zeile1 = "Seite 1";
      zeile3 = "Lang unten";

      ! zeileX = "";
      ! colorX = "";
      ! iconX = "";
    }
    else{
      zeile1 = "Seite 1";
      zeile3 = "Lang oben";

      ! zeileX = "";
      ! colorX = "";
      ! iconX = "";
    }
  }
}
! ---- Seite 2 ------------------------------
! Anderes und Sonstiges
! -------------------------------------------

if (seitenZaehler.State()==2){
  if (druck == "PRESS_SHORT"){

zeile1 = "Roll.Besuch?";
color1 = "0x80";
icon1 = ""; 
	zeile2 = "Kinderz.";   
	color2 = "0x80";
	icon2 = "";
! ### Schlafmodus an oder aus? ####
if (oSysvar == 0){
    zeile3 = "Automatik";
    color3= "0x84";
	}
	else
	{
	zeile3 = "manuell";
	color3 = "0x81";
	}
	icon3 = "";
	zeile4 = "Schlafzimmer";
	color4 = "0x80";
	icon4 = "";
! ### Schlafmodus an oder aus? ####
if (sSysvar == 0){
	zeile5 = "Automatik";
	color5= "0x84";
	}
	else
	{
	zeile5 = "manuell";
	color5 = "0x81";
	}
	icon5 = "";
	zeile6 = "Wahl LANG";
	color6 = "0x80";
	icon6 = "";
}

if (druck == "PRESS_LONG"){
    if (taster == 1){

	! ggf. Aktion für langen unteren Druck auf Seite 2
	! ### Systemvariable OLED_Zeilenzaehler holen ###

 var zeilenZaehler = dom.GetObject("OLED_Zeilenzaehler").Variable().ToInteger();			! ### holen (Start bei Zeile 0!!)
 zeilenZaehler = (zeilenZaehler+2);         		                                   		! ### incrementieren
 if (zeilenZaehler == 6) {zeilenZaehler = (zeilenZaehler-4);}
 dom.GetObject("OLED_Zeilenzaehler").State(zeilenZaehler); 								! ### schreiben in Sysvar

zeile1 = "ändern LANG";
color1 = "0x80";
icon1 = ""; 
	zeile2 = "Kinderz.";   
	if (zeilenZaehler == 2 ) {color2 = "0x83";}
	else {color2 = "0x80";}
	icon2 = "";
! ### Schlafmodus an oder aus? ####

if (oSysvar == 0){
    zeile3 = "Automatik";
    color3= "0x84";
	}
if (oSysvar == 1){
	zeile3 = "manuell";
	color3 = "0x81";
	}
	icon3 = "";
	zeile4 = "Schlafzimmer";
	if (zeilenZaehler == 4 ) {color4 = "0x83";} else {color4 = "0x80";}
	icon4 = "";
! ### Schlafmodus an oder aus? ####
if (sSysvar == 0){
	zeile5 = "Automatik";
	color5= "0x84";
	}
if (sSysvar == 1){
	zeile5 = "manuell";
	color5= "0x81";
	}
	icon5 = "";
	zeile6 = "Wahl LANG";
	color6 = "0x80";
	icon6 = "";
 }
	
! ######### hier Aktion für LANGER Druck OBEN #############	
	if (taster == 2){

if (zeilenZaehler == 2 ) {
	if ( oSysvar == true)
	{ oSysvar = false;
	dom.GetObject("var_Besuch_Kind").State(oSysvar);}
else { if ( oSysvar == false)
	{ oSysvar = true;
	dom.GetObject("var_Besuch_Kind").State(oSysvar);}
	}}
if (zeilenZaehler == 4 ) {
	if ( sSysvar == true)
	{sSysvar = false;
	dom.GetObject("var_Besuch-Schlafzimmer").State(sSysvar);}
else {	if ( sSysvar == false)
	{sSysvar = true;
	dom.GetObject("var_Besuch-Schlafzimmer").State(sSysvar);}
	}}

zeile1 = "ändern LANG";
color1 = "0x80";
icon1 = ""; 
	zeile2 = "Kinderz.";   
	if (zeilenZaehler == 2 ) {color2 = "0x83";}
	else {color2 = "0x80";}
	icon2 = "";
	
! ### Schlafmodus an oder aus? ####boolean oSysvar = ((domGetObject(ID_SYSTEM_VARIABLES)).Get("var_Besuch_Kind")).Value();

if ( oSysvar == 0){
    zeile3 = "Automatik";
    color3= "0x84";
	}
	else {
	if ( oSysvar == 1){
	zeile3 = "manuell";
	color3 = "0x81";
	}}
	icon3 = "";
	zeile4 = "Schlafzimmer";
	if (zeilenZaehler == 4 ) {color4 = "0x83";}
	else {color4 = "0x80";}
	icon4 = "";
! ### Schlafmodus an oder aus? ####

if ( sSysvar == 0){
	zeile5 = "Automatik";
	color5= "0x84";
	}
	else {
	if ( sSysvar == 1){
	zeile5 = "manuell";
	color5= "0x81";
	}}
	icon5 = "";
	zeile6 = "Wahl LANG";
	color6 = "0x80";
	icon6 = "";
    }
  }
}

! ##############################################################################

! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 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";
! " <- Diese Zeile behebt einen Anzeigebug in ATOM Editor, keine Funktion!

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 #####

logobg
Beiträge: 3
Registriert: 30.01.2019, 01:20

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von logobg » 30.01.2019, 01:36

Ich habe nur die Einfürung in programierung in HauptUni Wien.. Damit ihr weißt.. Unde ich habe hier und dort wiiiiiiel gesucht und verändert.. aber es leuft jetzt. Wenn jemant mir was besseres sagen kann, ich werde sehr glücklich sein! Ich hoffe ich werde jemanen helfen:
1.Macht Ihr 2 System Variablen - "pagecounter" (var type number, min=0/max=6) und "linecounter" (var type number, min=0/max=6)
1.(ich habe sys var "Alarm" mit Value list - on;off;night)
2.Program: If Display Button 1 pressed short or Button 2 pressed short or Button 1 pressed long or Button 2 pressed long, than execute script (kommt nächst), sys state - pagecount/delay by/10/seconds/0.00
2.SCRIPT:

Code: Alles auswählen

! DISPLAY

!! Universalprogramm zum Füllen
!! (c) DrTob
!! optimized by thkl
!! changed by wortmann30
!! Seitenzähler von Brufi
!! Tasterauswertung flo_da_ho

! Das Programm holt sich den Auslöser (oben oder unten, lang oder kurz)
! selbst und zeigt dann, abhängig von der aktuellen Seite, den entsprechenden
! Text an und/oder führt die entsprechende Aktion aus.

! ##############################################################################

! 0x80 Text 0 (Channel 1 Text Line 1)
! 0x81 Text 1 (Channel 1 Text Line 2)
! 0x82 Text 2 (Channel 2 Text Line 3)
! 0x83 Text 3 (Channel 2 Text Line 4)
! 0x84 Text 4 (Channel 3 Text Line 5)
! 0x85 Text 5 (Channel 3 Text Line 6)
! 0x86 Text 6 (Channel 4 Text Line 7)
! 0x87 Text 7 (Channel 4 Text Line 8)
! 0x88 Text 8 (Channel 5 Text Line 9)
! 0x89 Text 9 (Channel 5 Text Line 10)
! 0x8A Text 10 (Channel 6 Text Line 11)
! 0x8B Text 11 (Channel 6 Text Line 12)
! 0x8C Text 12 (Channel 7 Text Line 13)
! 0x8D Text 13 (Channel 7 Text Line 14)
! 0x8E Text 14 (Channel 8 Text Line 15)
! 0x8F Text 15 (Channel 8 Text Line 16)
! 0x90 Text 16 (Channel 9 Text Line 17)
! 0x91 Text 17 (Channel 9 Text Line 18)
! 0x92 Text 18 (Channel 10 Text Line 19)
! 0x93 Text 19 (Channel 10 Text Line 20)
string line1 = "";
string line2 = "";
string line3 = "";
string line4 = "";
string line5 = "";
string line6 = "";

! 0x80 white
! 0x81 red
! 0x82 orange
! 0x83 yellow
! 0x84 green
! 0x85 blue
string color1 = "0x80";
string color2 = "0x80";
string color3 = "0x80";
string color4 = "0x80";
string color5 = "0x80";
string color6 = "0x80";

! 0x80 OFF
! 0x81 ON
! 0x82 OPEN
! 0x83 closed
! 0x84 error
! 0x85 all ok
! 0x86 information
! 0x87 new message
! 0x88 servicenotification
! 0x89 Signal green
! 0x8A Signal yellow
! 0x8B Signal red
string icon1 = "";
string icon2 = "";
string icon3 = "";
string icon4 = "";
string icon5 = "";
string icon6 = "";

! ##############################################################################

integer maxPage = 6;
integer maxLines = 6;

! ##############################################################################

string sender = dom.GetObject("$src$").Name();

! button = 2 --> top Key
! button = 1 --> bottom Key
integer button = sender.StrValueByIndex(":",1).StrValueByIndex(".",0).ToInteger();

! push = PRESS_SHORT --> short Key press
! push = PRESS_LONG --> long Key press
string push = sender.StrValueByIndex(":",1).StrValueByIndex(".",1);

! ##############################################################################

integer obj = dom.GetObject("pagecounter");
integer currentPage = obj.Variable();
integer objl = dom.GetObject("linecounter");
integer currentLine = objl.Variable();

if (push == "PRESS_SHORT"){ 

  if (currentPage == 0.00){
    currentPage = 1;
  }

  else{
    if (button == 1){
      currentPage = 1 + currentPage;
    }
    else {
      currentPage = -1 + currentPage;
    }
    if (currentPage > maxPage){
      currentPage = 1;
    }
    if (currentPage < 1){
      currentPage = maxPage;
    }
  }

  obj.Variable(currentPage);
  currentLine = 0;
  objl.Variable(currentLine);
}


if (push == "PRESS_LONG"){

  if (currentLine == 0){
    currentLine = 1;
  }

  else{
    if (button == 1){
      currentLine = 1 + currentLine;
    }
    if (currentLine > maxLines){
      currentLine = 1;
    }
    if (currentLine < 1){
      currentLine = maxLines;
    }
  }

  objl.Variable(currentLine);
}

! ##############################################################################


var pageCounter = dom.GetObject("pagecounter");
var lineCounter = dom.GetObject("linecounter");

var ala = dom.GetObject("Alarm").Value();

var tempLRt = dom.GetObject("BidCos-RF.OEQ0697134:1.TEMPERATURE").State();
var tempLRrl = dom.GetObject("BidCos-RF.OEQ2085155:4.ACTUAL_TEMPERATURE").State();
var tempLRrr = dom.GetObject("BidCos-RF.OEQ2634399:4.ACTUAL_TEMPERATURE").State();
var modeLRt = dom.GetObject("BidCos-RF.OEQ0697134:2.CONTROL_MODE");
var modeLRrl = dom.GetObject("BidCos-RF.OEQ2085155:4.CONTROL_MODE");
var modeLRrr = dom.GetObject("BidCos-RF.OEQ2634399:4.CONTROL_MODE");
var boostmLRt = dom.GetObject("BidCos-RF.OEQ0697134:2.BOOST_MODE");
var boostmLRrl = dom.GetObject("BidCos-RF.OEQ2085155:4.BOOST_MODE");
var boostmLRrr = dom.GetObject("BidCos-RF.OEQ2634399:4.BOOST_MODE");
var tempBRt = dom.GetObject("BidCos-RF.LEQ0994208:1.TEMPERATURE").State();
var tempBRr = dom.GetObject("BidCos-RF.LEQ0422052:4.ACTUAL_TEMPERATURE").State();
var modeBRt = dom.GetObject("BidCos-RF.LEQ0994208:2.CONTROL_MODE");
var modeBRr = dom.GetObject("BidCos-RF.LEQ0422052:4.CONTROL_MODE");
var boostmBRt = dom.GetObject("BidCos-RF.LEQ0994208:2.BOOST_MODE");
var boostmBRr = dom.GetObject("BidCos-RF.LEQ0422052:4.BOOST_MODE");
var tempKRt = dom.GetObject("BidCos-RF.LEQ0993860:1.TEMPERATURE").State();
var tempKRr = dom.GetObject("BidCos-RF.LEQ0582506:4.ACTUAL_TEMPERATURE").State();
var modeKRt = dom.GetObject("BidCos-RF.LEQ0993860:2.CONTROL_MODE");
var modeKRr = dom.GetObject("BidCos-RF.LEQ0582506:4.CONTROL_MODE");
var boostmKRt = dom.GetObject("BidCos-RF.LEQ0993860:2.BOOST_MODE");
var boostmKRr = dom.GetObject("BidCos-RF.LEQ0582506:4.BOOST_MODE");
var tempCorr = dom.GetObject("BidCos-RF.OEQ2633318:4.ACTUAL_TEMPERATURE").State();
var modeCorr = dom.GetObject("BidCos-RF.OEQ2633318:4.CONTROL_MODE");
var boostmCorr = dom.GetObject("BidCos-RF.OEQ2633318:4.BOOST_MODE");
var tempOUT = dom.GetObject("BidCos-RF.LEQ1068890:1.TEMPERATURE").State();

if (modeLRt.Value() == 0) { var modestateLRt = "Auto"; };
if (modeLRt.Value() == 1) { var modestateLRt = "Manu"; };
if (modeLRt.Value() == 3) { var modestateLRt = "Boost";};
if (modeBRt.Value() == 0) { var modestateBRt = "Auto"; };
if (modeBRt.Value() == 1) { var modestateBRt = "Manu"; };
if (modeBRt.Value() == 3) { var modestateBRt = "Boost";};
if (modeKRt.Value() == 0) { var modestateKRt = "Auto"; };
if (modeKRt.Value() == 1) { var modestateKRt = "Manu"; };
if (modeKRt.Value() == 3) { var modestateKRt = "Boost";};
if (modeCorr.Value() == 0) { var modestateCorr = "Auto"; };
if (modeCorr.Value() == 1) { var modestateCorr = "Manu"; };
if (modeCorr.Value() == 3) { var modestateCorr = "Boost";};

var fdo = dom.GetObject("BidCos-RF.OEQ1558387:1.STATE").Value();
if (fdo == 1) {var fdo = "O";} else {var fdo = "C";};
var lrdo = dom.GetObject("BidCos-RF.MEQ0173384:1.STATE").Value();
if (lrdo == 1) {var lrdo = "O";} else {var lrdo = "C";};
var krdo = dom.GetObject("BidCos-RF.MEQ0183730:1.STATE").Value();
if (krdo == 1) {var krdo = "O";} else {var krdo = "C";};
var brdo = dom.GetObject("BidCos-RF.MEQ0366695:1.STATE").Value();
if (brdo == 1) {var brdo = "O";} else {var brdo = "C";};
var cldo = dom.GetObject("BidCos-RF.OEQ1197615:1.STATE").Value();
if (cldo == 1) {var cldo = "O";} else {var cldo = "C";};
var batdo = dom.GetObject("BidCos-RF.MEQ0366665:1.STATE").Value();
if (batdo == 1) {var batdo = "O";} else {var batdo = "C";};
var wcdo = dom.GetObject("BidCos-RF.MEQ0035061:1.STATE").Value();
if (wcdo == 1) {var wcdo = "O";} else {var wcdo = "C";};
var lrwi = dom.GetObject("BidCos-RF.LEQ0141882:1.STATE").Value();
if (lrwi > 0) {if (lrwi == 1) {var lrwi = "T";} else {var lrwi = "O";}} else {var lrwi = "C";};
var krwi = dom.GetObject("BidCos-RF.LEQ0141733:1.STATE").Value();
if (krwi > 0) {if (krwi == 1) {var krwi = "T";} else {var krwi = "O";}} else {var krwi = "C";};
var brwi = dom.GetObject("BidCos-RF.LEQ0141662:1.STATE").Value();
if (brwi > 0) {if (brwi == 1) {var brwi = "T";} else {var brwi = "O";}} else {var brwi = "C";};

var lrmde = dom.GetObject("BidCos-RF.LEQ0797734:1.MOTION").Value();
if (lrmde == 1) {var lrmde = "MOTION";} else {var lrmde = "no motion";};
var krmde = dom.GetObject("BidCos-RF.LEQ0797710:1.MOTION").Value();
if (krmde == 1) {var krmde = "MOTION";} else {var krmde = "no motion";};
var brmde = dom.GetObject("BidCos-RF.LEQ0798271:1.MOTION").Value();
if (brmde == 1) {var brmde = "MOTION";} else {var brmde = "no motion";};
var cmde = dom.GetObject("BidCos-RF.LEQ1292608:1.MOTION").Value();
if (cmde == 1) {var cmde = "MOTION";} else {var cmde = "no motion";};


! -------------------------------------------
! Page 1
! -------------------------------------------

if (pageCounter.State()==1){
line1 = ("::: Sun :::|::: Mon :::|::: Tue :::|::: Wed :::|::: Thu :::|::: Fri :::|::: Sat :::").StrValueByIndex("|",system.Date("%w").ToInteger());
line2 = "------------------";
line3 = system.Date("%H:%M");
line4 = "------------------";
line5 = system.Date("%d.%m.%Y");
line6 = " ";


  if (ala > 0) {
    if (ala == 1) {
    color2 = "0x84";
    color4 = "0x84";
    } 
    else {
    color2 = "0x85";
    color4 = "0x85";
    }
  }
  else {
    color2 = "0x81";
    color4 = "0x81";
  }
  
  
!  if (push == "PRESS_SHORT"){
!  }
  
  if (push == "PRESS_LONG"){
  if (ala > 0) {
    if (ala == 1) {
	line1 = "";
    line3 = "Alarm OFF";
    color3 = "0x84";
	line5 = "";
    } 
    else {
	line1 = "";
    line3 = "Night Mode";
    color3 = "0x85";
	line5 = "";
    }
  }
  else {
    line1 = "";
    line3 = "Alarm ON";
    color3 = "0x81";
	line5 = "";
  }
    if (lineCounter.State()==1){
      if (button == 1){
	  color1 = "0x83";
      }
      else{
	  color1 = "0x81";
      }
    }
	if (lineCounter.State()==2){
	  if (button == 1){
	  color2 = "0x83";
      }
      else{
      color2 = "0x81";
      }
	}
	if (lineCounter.State()==3){
	  if (button == 1){
	  color3 = "0x83";
      }
      else{
      color3 = "0x81";
      }
	}
	if (lineCounter.State()==4){
	  if (button == 1){
	  color4 = "0x83";
      }
      else{
      color4 = "0x81";
      }
	}
	if (lineCounter.State()==5){
	  if (button == 1){
	  color5 = "0x83";
      }
      else{
      color5 = "0x81";
      }
	}
	if (lineCounter.State()==6){
	  if (button == 1){
	  color6 = "0x83";
      }
      else{
      color6 = "0x81";
      }
	}
  }
}

! -------------------------------------------
! Page 2
! -------------------------------------------

if (pageCounter.State()==2){
  line1 = "Temperature";
         
  if ((modeLRrl.Value() == 3) && (modeLRrr.Value() == 3) && (modeLRt.Value() == 3)) {
    line2 = "LR: "#tempLRt.ToString(1)#" C "#modestateLRt#"";
    color2 = "0x81";
  }
  else {
    line2 = "LR: "#tempLRt.ToString(1)#" C";
    if (tempLRt >= 0.0) {color2 = "0x80";}
    if (tempLRt >= 10.0) {color2 = "0x82";}
    if (tempLRt >= 24.0) {color2 = "0x81";}
    if (tempLRt < 0.0) {color2 = "0x80";}
    if (tempLRt < -6.0) {color2 = "0x85";}
  }
	     
  if ((modeBRr.Value() == 3) && (modeBRt.Value() == 3)) {
    line3 = "BR: "#tempBRt.ToString(1)#" C "#modestateBRt#"";
    color3 = "0x81";
  }
  else {
    line3 = "BR: "#tempBRt.ToString(1)#" C";
    if (tempBRt >= 0.0) {color3 = "0x80";}
    if (tempBRt >= 10.0) {color3 = "0x82";}
    if (tempBRt >= 24.0) {color3 = "0x81";}
    if (tempBRt < 0.0) {color3 = "0x80";}
    if (tempBRt < -6.0) {color3 = "0x85";}
  }
	     
  if ((modeKRr.Value() == 3) && (modeKRt.Value() == 3)) {
    line4 = "KR: "#tempKRt.ToString(1)#" C "#modestateKRt#"";
    color4 = "0x81";
  }
  else {
    line4 = "KR: "#tempKRt.ToString(1)#" C";
    if (tempKRt >= 0.0) {color4 = "0x80";}
    if (tempKRt >= 10.0) {color4 = "0x82";}
    if (tempKRt >= 24.0) {color4 = "0x81";}
    if (tempKRt < 0.0) {color4 = "0x80";}
    if (tempKRt < -6.0) {color4 = "0x85";}
  }
                 
  if (modeCorr.Value() == 3) {
    line5 = "Co: "#tempCorr.ToString(1)#" C "#modestateCorr#"";
    color5 = "0x81";
  }
  else {
    line5 = "Cor: "#tempCorr.ToString(1)#" C";
    if (tempCorr >= 0.0) {color5 = "0x80";}
    if (tempCorr >= 10.0) {color5 = "0x82";}
    if (tempCorr >= 24.0) {color5 = "0x81";}
    if (tempCorr < 0.0) {color5 = "0x80";}
    if (tempCorr < -6.0) {color5 = "0x85";}
  }
           
  line6 = "OUT: "#tempOUT.ToString(1)#" C";
  if (tempOUT >= 0.0) {color6 = "0x80";}
  if (tempOUT >= 10.0) {color6 = "0x82";}
  if (tempOUT >= 24.0) {color6 = "0x81";}
  if (tempOUT < 0.0) {color6 = "0x80";}
  if (tempOUT < -6.0) {color6 = "0x85";}


!  if (push == "PRESS_SHORT"){
!  }
  
  if (push == "PRESS_LONG"){
    if (lineCounter.State()==1){
      if (button == 1){
	    color1 = "0x83";
      }
      else{
        color1 = "0x80";
      }
    }
	if (lineCounter.State()==2){
	  if (button == 1){
	    color2 = "0x83";
      }
      else{
	    boostmLRrl.State(1);
	    boostmLRrr.State(1);
	    boostmLRt.State(1);
        line2 = "LR: "#modestateLRt#"";
        color2 = "0x81";
      }
	}
	if (lineCounter.State()==3){
	  if (button == 1){
	    color3 = "0x83";
      }
      else{
	    boostmBRt.State(1);
	    boostmBRr.State(1);
        line3 = "BR: "#modestateBRt#"";
        color3 = "0x81";
      }
	}
	if (lineCounter.State()==4){
	  if (button == 1){
	    color4 = "0x83";
      }
      else{
	    boostmKRt.State(1);
	    boostmKRr.State(1);
        line4 = "KR: "#modestateKRt#"";
        color4 = "0x81";
      }
	}
	if (lineCounter.State()==5){
	  if (button == 1){
	    color5 = "0x83";
      }
      else{
	    boostmCorr.State(1);
        line5 = "Cor: "#modestateCorr#"";
        color5 = "0x81";
      }
	}
	if (lineCounter.State()==6){
	  if (button == 1){
	    color6 = "0x83";
      }
      else{
        color6 = "0x80";
      }
	}
  }
}

! -------------------------------------------
! Page 3
! -------------------------------------------

if (pageCounter.State()==3){
  line1 = "Living Room";
  
  line2 = ""#tempLRt.ToString(1)#" C";
  if (tempLRt >= 0.0) {color2 = "0x80";}
  if (tempLRt >= 10.0) {color2 = "0x82";}
  if (tempLRt >= 24.0) {color2 = "0x81";}
  if (tempLRt < 0.0) {color2 = "0x80";}
  if (tempLRt < -6.0) {color2 = "0x85";}
  
  line3 = ""#tempLRrl.ToString(1)#" / "#tempLRrr.ToString(1)#"";
  if ((tempLRrl >= 0.0) || (tempLRrr >= 0.0)) {color3 = "0x80";}
  if ((tempLRrl >= 10.0) || (tempLRrr >= 10.0)) {color3 = "0x82";}
  if ((tempLRrl >= 24.0) || (tempLRrr >= 24.0)) {color3 = "0x81";}
  if ((tempLRrl < 0.0) || (tempLRrr < 0.0)) {color3 = "0x80";}
  if ((tempLRrl < -6.0) || (tempLRrr < -6.0)) {color3 = "0x85";}
  
  line4 = ""#modestateLRt#" Mode";
  if (modeLRt.Value() == 3) {
  color4 = "0x81";
  }
  
  line5 = "W: "#lrwi#" / D: "#lrdo#"";
  if ((lrwi == "O") || (lrwi == "T") || (lrdo == "O")) {
  color5 = "0x81";
  }
  
  line6 = lrmde;
  if (lrmde == "MOTION"){
  color6 = "0x81";
  }
}

! -------------------------------------------
! Page 4
! -------------------------------------------

if (pageCounter.State()==4){
  line1 = "Bedroom";
  
  line2 = ""#tempBRt.ToString(1)#" C";
  if (tempBRt >= 0.0) {color2 = "0x80";}
  if (tempBRt >= 10.0) {color2 = "0x82";}
  if (tempBRt >= 24.0) {color2 = "0x81";}
  if (tempBRt < 0.0) {color2 = "0x80";}
  if (tempBRt < -6.0) {color2 = "0x85";}
  
  line3 = "R: "#tempBRr.ToString(1)#" C";
  if (tempBRr >= 0.0) {color3 = "0x80";}
  if (tempBRr >= 10.0) {color3 = "0x82";}
  if (tempBRr >= 24.0) {color3 = "0x81";}
  if (tempBRr < 0.0) {color3 = "0x80";}
  if (tempBRr < -6.0) {color3 = "0x85";}
  
  line4 = ""#modestateBRt#" Mode";
  if (modeBRt.Value() == 3) {
  color4 = "0x81";
  }
  
  line5 = "W: "#brwi#" / D: "#brdo#"";
  if ((brwi == "O") || (brwi == "T") || (brdo == "O")) {
  color5 = "0x81";
  }
  
  line6 = brmde;
  if (brmde == "MOTION"){
  color6 = "0x81";
  }
}

! -------------------------------------------
! Page 5
! -------------------------------------------

if (pageCounter.State()==5){
  line1 = "Kid Room";
  
  line2 = ""#tempKRt.ToString(1)#" C";
  if (tempKRt >= 0.0) {color2 = "0x80";}
  if (tempKRt >= 10.0) {color2 = "0x82";}
  if (tempKRt >= 24.0) {color2 = "0x81";}
  if (tempKRt < 0.0) {color2 = "0x80";}
  if (tempKRt < -6.0) {color2 = "0x85";}
  
  line3 = "R: "#tempKRr.ToString(1)#" C";
  if (tempKRr >= 0.0) {color3 = "0x80";}
  if (tempKRr >= 10.0) {color3 = "0x82";}
  if (tempKRr >= 24.0) {color3 = "0x81";}
  if (tempKRr < 0.0) {color3 = "0x80";}
  if (tempKRr < -6.0) {color3 = "0x85";}
  
  line4 = ""#modestateKRt#" Mode";
  if (modeKRt.Value() == 3) {
  color4 = "0x81";
  }
  
  line5 = "W: "#krwi#" / D: "#krdo#"";
  if ((krwi == "O") || (krwi == "T") || (krdo == "O")) {
  color5 = "0x81";
  }
  
  line6 = krmde;
  if (krmde == "MOTION"){
  color6 = "0x81";
  }
}

! -------------------------------------------
! Page 6
! -------------------------------------------

if (pageCounter.State()==6){
  line1 = "Corridor";
  
  line2 = ""#tempCorr.ToString(1)#" C";
  if (tempKRt >= 0.0) {color2 = "0x80";}
  if (tempKRt >= 10.0) {color2 = "0x82";}
  if (tempKRt >= 24.0) {color2 = "0x81";}
  if (tempKRt < 0.0) {color2 = "0x80";}
  if (tempKRt < -6.0) {color2 = "0x85";}
  
  line3 = ""#modestateCorr#" Mode";
  if (modeCorr.Value() == 3) {
  color3 = "0x81";
  }
  
  line4 = "FR:"#fdo#" CL:"#cldo#"";
  if ((fdo == "O") || (cldo == "O")) {
  color4 = "0x81";
  }
  
  line5 = "WC:"#wcdo#" BT:"#batdo#"";
  if ((wcdo == "C") || (batdo == "O")) {
  color5 = "0x81";
  }
  
  line6 = cmde;
  if (cmde == "MOTION"){
  color6 = "0x81";
  }
}


! ##############################################################################

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! System Routine do not change anything below !
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

string splitter="|";
string msgBuffer = line1 # splitter # color1 # splitter # icon1 # "\t";
msgBuffer = msgBuffer # line2 # splitter # color2 # splitter # icon2 # "\t";
msgBuffer = msgBuffer # line3 # splitter # color3 # splitter # icon3 # "\t";
msgBuffer = msgBuffer # line4 # splitter # color4 # splitter # icon4 # "\t";
msgBuffer = msgBuffer # line5 # splitter # color5 # splitter # icon5 # "\t";
msgBuffer = msgBuffer # line6 # 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);

! ##### END #####
So habe ich meine seiten, und ich kann wie bei den alten MP3 players mit 2 Knopfe nach unten gehen und bestätigen:
wenn ich von anfang an nach unten kurz drücke kommt 1 seite, dan nächste......, wenn ich in seite Nummer 1 oder-oder... LANG nach unten drücke gehe ich eine Zeile nach unten und wenn ich die obere Taste LANG drücke bestätige ich (oder irgendwas ausfürhren). Wenn ich die obere taste kurz drücke gehe ich eine seite zurück.. :) happy new Year!

drose28357
Beiträge: 181
Registriert: 14.10.2011, 09:05
System: CCU
Wohnort: Bremen
Hat sich bedankt: 56 Mal
Danksagung erhalten: 7 Mal

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von drose28357 » 16.07.2019, 09:24

mike@mike-holtgrefe.de hat geschrieben:
01.09.2015, 20:11
ich möchte auf einer Seite alle Jalousien mit dem Tastendruck lang Taste 1 runterfahren und mit dem Tastendruck lang Taste 2 auffahren.
Wie müsste ich dieses in dem Script schalten, wichtig wäre das dann auch die Verzögerungen mit reinkommen.

Jalousie 1 verzögert um 10 Sekunden auf 0 %

wie gibt man so etwas im Script ein ?
Ich habe dazu Direktverknüpfungen zwischen einem virtuellen Kanal der Zentrale und den anzusteuernden Jalousieaktoren angelegt. Bei jeder Verknüpfung kann man auch Verzögerungen setzen und mit der Option Position anfahren sogar bestimmte Abschattungen einstellen.
Im Ergebnis muß ich nur per Programm die Virtuelle Taste "kurz" drücken und alle dort zugeordneten Jalousien fahren ihre dazu definierte Position an.
Das kann mann ganz leicht in das "langen Tastendrück"-Programm einfügen.
RaspberryMatic auf Raspberry Pi 4 2Gbyte

chross
Beiträge: 10
Registriert: 25.06.2020, 13:21
System: in Planung
Danksagung erhalten: 1 Mal

Re: HM-DIS-WM55 Seitenweise blättern und Aktionen ausführen

Beitrag von chross » 25.06.2020, 13:24

Hi! Ich bin neu hier und finde dieses Projekt spannend. Wäre es auch mit dem HM-Dis-EP-WM55 E-Ink Display umsetzbar? Vorteil wäre für mich, dass die Anzeige permanent an ist.

VG

Antworten

Zurück zu „HomeMatic Tipps & Tricks - keine Fragen!“