Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

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

Moderator: Co-Administratoren

saschen79
Beiträge: 94
Registriert: 07.07.2012, 12:29

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Scr

Beitrag von saschen79 » 01.05.2018, 18:38

Hallo,

ich habe das Skript schon länger laufen und möchte jetzt eine SV vom Typ Zahl auslesen. Ich bekomme aber einen anderen Wert als in der SV steht.

Hier der Auszug:

Code: Alles auswählen

var v_Duty_Cycle = dom.GetObject("Duty Cycle MEQXXXXXXX").State; 

	
string zeile3 = v_Duty_Cycle.ValueName();
string color3 = "0x80";
string icon3  = "";
Wie kann ich die Zahl auslesen? .....Value;?
Hab ich bestimmt überlesen, oder?

Danke und Gruß, Sascha.
Zuletzt geändert von alchy am 01.05.2018, 19:34, insgesamt 1-mal geändert.
Grund: Code in Codetags posten

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

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Scr

Beitrag von alchy » 01.05.2018, 18:58

saschen79 hat geschrieben:Ich bekomme aber einen anderen Wert als in der SV steht.
Du bekommst damit gar nichts außer Fehler in >> Fehlerprotokoll <<

Code: Alles auswählen

object sysvar = dom.GetObject(ID_SYSTEM_VARIABLES).Get("Name Systemvariable Typ Zahl");
var sysvarWert ="NaN";
if (sysvar){sysvarWert = sysvar.Value().ToString(0);}
string zeile3 = "DutyCycle: " #sysvarWert;
Alchy
In meiner Signatur findest du einen Link zur ScriptDoku.

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.

saschen79
Beiträge: 94
Registriert: 07.07.2012, 12:29

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Scr

Beitrag von saschen79 » 01.05.2018, 19:22

Danke, perfekt Alchy, läuft! :D

ibein
Beiträge: 73
Registriert: 21.01.2015, 14:06

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von ibein » 09.12.2018, 20:36

Darf ich mich hier bitte anschließen?

Bei mir sieht das Skript folgendermaßen aus und ich bekomme ebenfalls die Meldung, dass keine Daten empfangen wurden...

Code: Alles auswählen

!! Universalprogramm zum Füllen 
!! (c) DrTob 

!! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedingung 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 = "0x80";
string color1 = "0x80";
string icon1  = "";

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

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

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

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

string zeile6 = "0x8A";
string color6 = "0x80";
string icon6  = "";

var istAnwesend = dom.GetObject("An_und_Abwesenheit").Value();
var istFenster = dom.GetObject("Status_Fenster").Value();
var istVerschluss = dom.GetObject("Status_Verschluss").Value();
var istAlarman = dom.GetObject("Alarmausloesung").Value();
var istAlarma = dom.GetObject("Aktivierung_Alarm").Value();


if (istAnwesend == 0)  {string zeile2 = "anwesend";}
if (istAnwesend == 1)  {string zeile2 = "Trigger";}
if (istAnwesend == 2)  {string zeile2 = "kurz wech";}
if (istAnwesend == 3)  {string zeile2 = "lange wech";}

if (istAnwesend == 0)  {string color2 = "0x84";}
if (istAnwesend == 1)  {string color2 = "0x82";}
if (istAnwesend == 2)  {string color2 = "0x82";}
if (istAnwesend == 3)  {string color2 = "0x81";}

if (istAnwesend == 0)  {string icon2 = "0x85";}
if (istAnwesend == 1)  {string icon2 = "";}
if (istAnwesend == 2)  {string icon2 = "";}
if (istAnwesend == 3)  {string icon2 = "0x84";}

if (istFenster == 0)  {string zeile3 = "Fenster offen";}
if (istFenster == 1)  {string zeile3 = "Verschluss";}

if (istFenster == 0)  {string color3 = "0x81";}
if (istFenster == 1)  {string color3 = "0x80";}

if (istFenster == 0)  {string icon3 = "0x84";}
if (istFenster == 1)  {string icon3 = "";}

if (istVerschluss == 0)  {string zeile4 = "offen";}
if (istVerschluss == 1)  {string zeile4 = "geschlossen";}

if (istVerschluss == 0)  {string color4 = "0x81";}
if (istVerschluss == 1)  {string color4 = "0x84";}

if (istVerschluss == 0)  {string icon4 = "0x82";}
if (istVerschluss == 1)  {string icon4 = "0x83";}

if (istAlarman)  {string zeile5 = "Alarm ausgelöst";}
if (!istAlarman)  {string zeile5 = "Alarm";}

if (istAlarman)  {string color5 = "0x81";}
if (!istAlarman)  {string color5 = "0x80";}

if (istAlarman)  {string icon5 = "0x84";}
if (!istAlarman)  {string icon5 = "";}

if (istAlarma == 0)  {string zeile6 = "Alarm intern";}
if (istAlarma == 1)  {string zeile6 = "Alarm extern";}
if (istAlarma == 2)  {string zeile6 = "unscharf";}

if (istAlarma == 0)  {string color6 = "0x81";}
if (istAlarma == 1)  {string color6 = "0x81";}
if (istAlarma == 2)  {string color6 = "0x84";}

if (istAlarma == 0)  {string icon6 = "0x8B";}
if (istAlarma == 1)  {string icon6 = "0x89";}
if (istAlarma == 2)  {string icon6 = "0x89";}


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 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);

HJG
Beiträge: 1
Registriert: 07.12.2018, 10:40

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von HJG » 15.12.2018, 14:00

Also bei mir klappt es leider auch nicht, "Keine Daten empfangen" :-(

An anderer Stelle wird geschrieben, dass man für das HM-Dis-WM55 die neuste Firmware, Version 1.2 drauf haben sollte.

Diese wird mir zum Download leider nicht angeboten und selbst auf der Seite https://www.eq-3.de/service/downloads.html wird zu diesem Teil leider keinerlei FW Update Datei angeboten :-(

HJG

capitaen_z
Beiträge: 130
Registriert: 05.07.2015, 19:34
Wohnort: Hamburg
Danksagung erhalten: 3 Mal

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von capitaen_z » 15.12.2018, 15:27

Hallo zusammen,

ich hatte auch Probleme mit dem Display, die an mir* lagen.
Hier der link: viewtopic.php?f=19&t=46480&p=471294#p471294

Version 1.2 ist für HM-Dis-EP-WM55 !

VG
Leif

*
capitaen_z hat geschrieben: ↑
15.12.2018, 15:27
hatte auch Probleme mit dem Display, die an "mir" lagen.
da lag nicht an "dir" sondern an dir.

Alchy
Zuletzt geändert von capitaen_z am 17.12.2018, 17:23, insgesamt 3-mal geändert.

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

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von alchy » 17.12.2018, 07:52

ibein hat geschrieben:
09.12.2018, 20:36
Darf ich mich hier bitte anschließen?
Gesetzt den Fall deine Objekte (wie du sie um Script verwendest) sind vorhanden, sollte das Script funktionieren.
Generell ist das Script aber "optimierungsbedürftig" aber das tut nichts zur Sache.
Zur Hilfe sehe ich erstmal 2 Ansatzmöglichkeiten:
  • als erstes Prüfen, ob dein Programm, welches das Script aufruft auch ausgeführt wird. Am Besten, im dem du im DAnn ZWeig eine weitere prüfbare Aktion hinterlegst.
  • Fehlerprotokoll zum Zeitpunkt der Ausführung des Scriptes / Programms.
    Das ist Pflicht, wenn man Hilfe bei einem Script erwartet. Die Zeit wird kommen, wo auch ich darauf auch nicht mehr hinweise, sondern Fragen einfach ignoriere.



capitaen_z hat geschrieben:
15.12.2018, 15:27
hatte auch Probleme mit dem Display, die an "mir" lagen.
da lag nicht an "dir" sondern an dir.

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.

ibein
Beiträge: 73
Registriert: 21.01.2015, 14:06

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von ibein » 05.04.2019, 21:11

alchy hat geschrieben:
17.12.2018, 07:52
ibein hat geschrieben:
09.12.2018, 20:36
Darf ich mich hier bitte anschließen?
Gesetzt den Fall deine Objekte (wie du sie um Script verwendest) sind vorhanden, sollte das Script funktionieren.
Generell ist das Script aber "optimierungsbedürftig" aber das tut nichts zur Sache.
Zur Hilfe sehe ich erstmal 2 Ansatzmöglichkeiten:
  • als erstes Prüfen, ob dein Programm, welches das Script aufruft auch ausgeführt wird. Am Besten, im dem du im DAnn ZWeig eine weitere prüfbare Aktion hinterlegst.
  • Fehlerprotokoll zum Zeitpunkt der Ausführung des Scriptes / Programms.
    Das ist Pflicht, wenn man Hilfe bei einem Script erwartet. Die Zeit wird kommen, wo auch ich darauf auch nicht mehr hinweise, sondern Fragen einfach ignoriere.
Hallo Alchy,

ich habe immer noch Probleme mit dem Skript; das Log sieht so aus:

Code: Alles auswählen

Apr  5 21:06:50 ccu-raspi local0.err ReGaHss: ERROR: ScriptRuntimeError: !! Universalprogramm zum Füllen  !! (c) DrTob   !! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedingung 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) ! 0x
Das Programm wird ausgeführt (habe bei Ausführung eine Leuchte schalten lassen) und die Objekte sind auch vorhanden...habe die SysVar noch einmal kontrolliert!

Hier noch einmal das Skript:

Code: Alles auswählen

!! Universalprogramm zum Füllen 
!! (c) DrTob 

!! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedingung 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 = "0x80";
string color1 = "0x80";
string icon1  = "";

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

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

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

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

string zeile6 = "0x8A";
string color6 = "0x80";
string icon6  = "";

var istAnwesend = dom.GetObject("An_und_Abwesenheit").Value();
var istFenster = dom.GetObject("Status_Fenster").Value();
var istVerschluss = dom.GetObject("Status_Verschluss").Value();
var istAlarman = dom.GetObject("Alarmausloesung").Value();
var istAlarma = dom.GetObject("Aktivierung_Alarm").Value();


if (istAnwesend == 0)  {string zeile2 = "anwesend";}
if (istAnwesend == 1)  {string zeile2 = "Trigger";}
if (istAnwesend == 2)  {string zeile2 = "kurz wech";}
if (istAnwesend == 3)  {string zeile2 = "lange wech";}

if (istAnwesend == 0)  {string color2 = "0x84";}
if (istAnwesend == 1)  {string color2 = "0x82";}
if (istAnwesend == 2)  {string color2 = "0x82";}
if (istAnwesend == 3)  {string color2 = "0x81";}

if (istAnwesend == 0)  {string icon2 = "0x85";}
if (istAnwesend == 1)  {string icon2 = "";}
if (istAnwesend == 2)  {string icon2 = "";}
if (istAnwesend == 3)  {string icon2 = "0x84";}

if (istFenster == 0)  {string zeile3 = "Fenster offen";}
if (istFenster == 1)  {string zeile3 = "Verschluss";}

if (istFenster == 0)  {string color3 = "0x81";}
if (istFenster == 1)  {string color3 = "0x80";}

if (istFenster == 0)  {string icon3 = "0x84";}
if (istFenster == 1)  {string icon3 = "";}

if (istVerschluss == 0)  {string zeile4 = "offen";}
if (istVerschluss == 1)  {string zeile4 = "geschlossen";}

if (istVerschluss == 0)  {string color4 = "0x81";}
if (istVerschluss == 1)  {string color4 = "0x84";}

if (istVerschluss == 0)  {string icon4 = "0x82";}
if (istVerschluss == 1)  {string icon4 = "0x83";}

if (istAlarman == 0)  {string zeile5 = "Alarm ausgelöst";}
if (istAlarman == 1)  {string zeile5 = "Alarm";}

if (istAlarman == 0)  {string color5 = "0x81";}
if (istAlarman == 1)  {string color5 = "0x80";}

if (istAlarman == 0)  {string icon5 = "0x84";}
if (istAlarman == 1)  {string icon5 = "";}

if (istAlarma == 0)  {string zeile6 = "Alarm intern";}
if (istAlarma == 1)  {string zeile6 = "Alarm extern";}
if (istAlarma == 2)  {string zeile6 = "unscharf";}

if (istAlarma == 0)  {string color6 = "0x81";}
if (istAlarma == 1)  {string color6 = "0x81";}
if (istAlarma == 2)  {string color6 = "0x84";}

if (istAlarma == 0)  {string icon6 = "0x8B";}
if (istAlarma == 1)  {string icon6 = "0x89";}
if (istAlarma == 2)  {string icon6 = "0x89";}


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 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);
Dateianhänge
Bildschirmfoto 2019-04-05 um 21.14.38.png

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

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von alchy » 05.04.2019, 22:32

Das Scrip sollte durchlaufen, wenn alle aufgeführten Objekte vorhanden sind.

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.

DaGromA
Beiträge: 35
Registriert: 21.11.2018, 13:36

Re: Freie Texte in Statusanzeige HM-Dis-WM55 über ein HM Script

Beitrag von DaGromA » 02.08.2019, 08:24

Guten morgen Forum,

ich habe das von euch, netterweise, bereit gestellte Script gefunden. Darauf hin habe ich mir sofort die Statusanzeige gekauft, zusammen gebraten und Angelernt.

Ich möchte primär meine Alarmanlage und den "Heizmodus" anzeigen und darüber aktivieren.
Folgende Systemvariablen hab ich dafür bereit gestellt.

Anwesenheit
Status_Fenster
Heizperiode
Alarmanlage

mit Virtuellen Knöpfen funktioniert alles.
Jetzt hab ich mir euren Code geschnappt und ein wenig darin gebastelt.
Der Code startet wie geschrieben mit dem folgenden Programm.

Jetzt Zur Frage:
Der Schalter funktioniert nicht. Ich drücke hinten aufs Knöpfchen und bestätige das die Einstellungen übernommen werden sollen.
Aber ich bekomme immer die Auskunft: Keine Daten empfangen <- in einen schönen ROT.

Liegt es an dem Script? Hab ich etwas wichtiges vergessen?

Code: Alles auswählen

 !! Universalprogramm zum Füllen 
!! (c) DrTob 

!! Das Script holt sich jetzt die Seriennummer des Displays selbst aus der Auslösebedingung 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 = "0x80";
string color1 = "0x80";
string icon1  = "";

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

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

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

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

string zeile6 = "0x8A";
string color6 = "0x80";
string icon6  = "";

var istAnwesend = dom.GetObject("Anwesenheit").Value();
var istFenster = dom.GetObject("Status_Fenster").Value();
var istHeizperiode = dom.GetObject("Heizperiode").Value();
var istAlarmanlage = dom.GetObject("Alarmanlage").Value();


if (istAnwesend == 0)  {string zeile2 = "anwesend";}
if (istAnwesend == 1)  {string zeile2 = "lange wech";}

if (istAnwesend == 0)  {string color2 = "0x84";}
if (istAnwesend == 1)  {string color2 = "0x81";}

if (istAnwesend == 0)  {string icon2 = "0x85";}
if (istAnwesend == 1)  {string icon2 = "0x84";}

if (istFenster == 0)  {string zeile3 = "Fenster offen";}
if (istFenster == 1)  {string zeile3 = "Fenster zu";}

if (istFenster == 0)  {string color3 = "0x81";}
if (istFenster == 1)  {string color3 = "0x80";}

if (istFenster == 0)  {string icon3 = "0x84";}
if (istFenster == 1)  {string icon3 = "";}

if (istHeizperiode == 0)  {string zeile5 = "Sommerbetrieb";}
if (istHeizperiode == 1)  {string zeile5 = "Winterbetrieb";}

if (istHeizperiode == 0)  {string color5 = "0x81";}
if (istHeizperiode == 1)  {string color5 = "0x85";}

if (istHeizperiode == 0)  {string icon5 = "0x80";}
if (istHeizperiode == 1)  {string icon5 = "0x81";}

if (istAlarmanlage == 0)  {string zeile6 = "Alarm aktiviert";}
if (istAlarmanlage == 1)  {string zeile6 = "Alarm deaktiviert";}

if (istAlarmanlage == 0)  {string color6 = "0x81";}
if (istAlarmanlage == 1)  {string color6 = "0x84";}

if (istAlarmanlage == 0)  {string icon6 = "0x8B";}
if (istAlarmanlage == 1)  {string icon6 = "0x89";}


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! 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);  
Dateianhänge
Statusanziege Programm.JPG

Antworten

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