wer bereits erfolgreich das E-Mail Addon installiert hat, kann sich nun auch das Systemprotokoll der HomeMatic zusenden lassen.
Vorbereitung:
1. E-Mail Addon ist installiert und funktionstüchtig > http://www.homematic-inside.de/software ... gory_id=17
2. In der E-Mail Konfiguration zB. Mail Nummer 08 auswählen.
Erforderliche Angaben ausfüllen, und in das leere Feld folgenden Text einfügen:
Code: Alles auswählen
Systemprotokoll:
$sysprot
3. Im Bereich TCL zusätzlich diesen Text einfügen:
Code: Alles auswählen
set sysprot [encoding convertfrom utf-8 [lindex $argv 1]]
4. Nun erstellt man ein neues Programm zB. Systemprotokoll senden
Bedingung: Wenn...
Zeitmodul, oder ein anderes Ereigniss.
Aktivität: Dann...
Script auswählen > Script erstellen > das unten angegebene Script ins leere Feld einfügen.
Im oberen Teil des Scriptes gibt man die gewünschte id der Mail ein ( 01 - 10 )
string mail_id = "08";
Viel Spass mit dieser neuen Funktion !
gruß MaxWrestler
PS:Ich bin kein Prediger, aber das Script enthält den Befehl system.Exec geht also sparsam mit der Benutzung um.
Code: Alles auswählen
! Systemprotokoll auslesen und als E-Mail versenden
!-----------------------------------------------------------------
! Info: History Daten löschen mit
! var clearHistory = dom.ClearHistoryData();
!-----------------------------------------------------------------
! Im TCL Bereich des E-Mail Addons folgende Zeile eintragen
! set sysprot [encoding convertfrom utf-8 [lindex $argv 1]]
! Ausgabe mit $sysprot
!-----------------------------------------------------------------
! id der E-Mail hier eintragen !!!
string mail_id = "08";
!-----------------------------------------------------------------
string drop = "";
integer iLastGroupIndex = 1;
string sCollectedNames = "";
string sCollectedValues = "";
string sCollectedDateTimes = "";
string s;
integer iStart = 0;
integer iCount = dom.GetHistoryDataCount();
integer rCount;
foreach( s, dom.GetHistoryData( iStart, iCount, &rCount ) )
{
integer iGroupIndex = s.StrValueByIndex(";",0).ToInteger();
string sDatapointId = s.StrValueByIndex(";",1);
string sRecordedValue = s.StrValueByIndex(";",2);
string sDateTime = s.StrValueByIndex(";",3);
string sDatapointName = "";
object oHistDP = dom.GetObject( sDatapointId );
if( oHistDP )
{
object oDP = dom.GetObject( oHistDP.ArchiveDP() );
if( oDP )
{
sDatapointName = oDP.Name();
boolean bSysVar = (oDP.IsTypeOf(OT_VARDP) || oDP.IsTypeOf(OT_ALARMDP));
if( !bSysVar )
{
object oCH = dom.GetObject( oDP.Channel() );
if( oCH )
{
sDatapointName = oCH.Name();
}
}
if( iLastGroupIndex != iGroupIndex )
{
drop = drop # sCollectedDateTimes # " " # sCollectedNames # " " # sCollectedValues # "\n";
sCollectedNames = "";
sCollectedValues = "";
iLastGroupIndex = iGroupIndex;
}
string id = oDP.ID();
string sRet = "";
string sValue = sRecordedValue;
Call("/esp/functions.fn::WriteDPText()");
sRecordedValue = system.GetVar("sRet");
sCollectedNames = sDatapointName;
sCollectedDateTimes = sDateTime;
if( !sCollectedValues.Length() )
{
sCollectedValues = sRecordedValue;
}
else
{
sCollectedValues = sCollectedValues#", "#sRecordedValue;
}
}
}
}
if( sCollectedValues.Length() )
{
drop = drop # sCollectedDateTimes # " " # sCollectedNames # " " # sCollectedValues;
}
if (drop == "") {
drop = "Keine Einträge im Protokoll !!!";
}
! E-Mail absenden
!----------------------
string stdout;
string stderr;
system.Exec("/etc/config/addons/email/email '" # mail_id # "' '" # drop # "'",&stdout,&stderr);
! Textausgabe Konsole
!----------------------------
!WriteLine(drop);
WriteLine("OK!");
! Systemprotokoll löschen
!--------------------------------
var clearHistory = dom.ClearHistoryData();