Systemprotokoll auf Syslog Server

Allgemeines zur HomeMatic Haussteuerung

Moderator: Co-Administratoren

Slice
Beiträge: 1200
Registriert: 03.02.2016, 14:44
System: Alternative CCU (auf Basis OCCU)
Wohnort: irgendwo aus Süd BaWü
Hat sich bedankt: 139 Mal
Danksagung erhalten: 85 Mal

Re: Systemprotokoll auf Syslog Server

Beitrag von Slice » 30.09.2022, 13:44

Okay, dann warten wir mal ab bis eines der Geräte was auf protokolliert steht wieder eine Meldung ins Systemlog absetzt.
Vielleicht kommen wir dann weiter.
----------------------------------------------------------------------------------------
Raspi3B+ Bullseye mit HB-RF-ETH und RPI-RF-MOD auf piVCCU-FW 3.75.7 / Addons: CuxD v2.11 - E-Mail v1.7.6 - Patcher v1.0.0 - Philips Hue v3.2.5 - Programme drucken v2.6 - Scriptparser v1.11 - XML-API v2.3
Geräte: 141 / Kanäle: 791 / Datenpunkte: 6080 / SysVars: 275 / Programme: 161 / Regadom IDs: 14010 / 48 CUxD-Kanäle in 3 CUxD-Geräten
Intel NUC i3-5010U @ 2,1 GHz mit 16 GB RAM & 512 GB SSD für Proxmox mit ioBroker VM und CCU-Historian/InfluxDB/Grafana VM
----------------------------------------------------------------------------------------
Projekte im Forum: HomeHub v4.1 / Fritzbox-Anruferliste für HomeHub
----------------------------------------------------------------------------------------

Slice
Beiträge: 1200
Registriert: 03.02.2016, 14:44
System: Alternative CCU (auf Basis OCCU)
Wohnort: irgendwo aus Süd BaWü
Hat sich bedankt: 139 Mal
Danksagung erhalten: 85 Mal

Re: Systemprotokoll auf Syslog Server

Beitrag von Slice » 30.09.2022, 13:53

Also, jetzt hat sich der HM-Sec-SC-2 wieder gemeldet:
Beim Script testen kommt:

Code: Alles auswählen

2022-09-30 13:43:08,Heizungsrohrklappe 1, SHUTTER_CONTACT|STATE=FALSE, SHUTTER_CONTACT|LOWBAT=FALSE
DONE
Im Systemlog sind 2 Meldungen drin:
Systemlog2.jpg
Und unter var/log/messages steht:

Code: Alles auswählen

Sep 30 13:43:09 Homematic-CCU3 user.debug LOGGER: [Programm Heizungsmodus Brenner Auswertung ein]
Sep 30 13:46:52 Homematic-CCU3 user.debug LOGGER: [Programm Heizungsmodus Brenner Auswertung aus]
Sep 30 13:47:57 Homematic-CCU3 user.info RegaSysLog: 2022-09-30 13:43:08,Heizungsrohrklappe 1, SHUTTER_CONTACT|STATE=FALSE, SHUTTER_CONTACT|LOWBAT=FALSE
Die erste Meldung mit dem geschlossenen Zustand wird nicht ins Syslog geschrieben.. warum auch immer..
----------------------------------------------------------------------------------------
Raspi3B+ Bullseye mit HB-RF-ETH und RPI-RF-MOD auf piVCCU-FW 3.75.7 / Addons: CuxD v2.11 - E-Mail v1.7.6 - Patcher v1.0.0 - Philips Hue v3.2.5 - Programme drucken v2.6 - Scriptparser v1.11 - XML-API v2.3
Geräte: 141 / Kanäle: 791 / Datenpunkte: 6080 / SysVars: 275 / Programme: 161 / Regadom IDs: 14010 / 48 CUxD-Kanäle in 3 CUxD-Geräten
Intel NUC i3-5010U @ 2,1 GHz mit 16 GB RAM & 512 GB SSD für Proxmox mit ioBroker VM und CCU-Historian/InfluxDB/Grafana VM
----------------------------------------------------------------------------------------
Projekte im Forum: HomeHub v4.1 / Fritzbox-Anruferliste für HomeHub
----------------------------------------------------------------------------------------

jp112sdl
Beiträge: 12108
Registriert: 20.11.2016, 20:01
Hat sich bedankt: 848 Mal
Danksagung erhalten: 2148 Mal
Kontaktdaten:

Re: Systemprotokoll auf Syslog Server

Beitrag von jp112sdl » 30.09.2022, 14:13

Probier es mal so

Code: Alles auswählen

integer cnt = dom.GetHistoryDataCount();
integer iLastGroupIndex = 1;
string sCollectedNames = "";
string sCollectedValues = "";
string sCollectedDateTimes = "";
string s;
integer rCount;
foreach( s, dom.GetHistoryData(0,cnt, &rCount ) ){
  integer iGroupIndex = s.StrValueByIndex(";",0).ToInteger();
  string sDatapointId = s.StrValueByIndex(";",1);
  string sRecordedValue = s.StrValueByIndex(";",2);
  string sDateTime = s.StrValueByIndex(";",3);
  string stmpDate = sDateTime.StrValueByIndex(" ",0);
  string stmpTime = sDateTime.StrValueByIndex(" ",1);
    
  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 ) { 
      sCollectedNames = "";
      sCollectedValues = "";
      iLastGroupIndex = iGroupIndex;
    }
    
    string sRet = "";

    object to = dom.GetObject( oDP.ID());
    if( to ) {
      if( to.IsTypeOf( OT_VARDP ) || to.IsTypeOf( OT_ALARMDP ) ) {
        integer itoVT = to.ValueType();
        integer itoST = to.ValueSubType();
        boolean btoLogic  = ( (itoVT==ivtBinary)  && (itoST==istBool)    );
        boolean btoList   = ( (itoVT==ivtInteger) && (itoST==istEnum)    );
        boolean btoNumber = ( (itoVT==ivtFloat)   && (itoST==istGeneric) );
        boolean btoAlarm  = ( (itoVT==ivtBinary)  && (itoST==istAlarm)   );
        boolean btoString  = ( (itoVT==ivtString)  && (itoST==istChar8859));
        if( (btoLogic || btoAlarm) && ((sRecordedValue == "0") || (sRecordedValue == "")) ) {
          sRet=sRet#to.ValueName0(); } else { sRet=sRet#to.ValueName1(); 
        }
        if( (btoList) && (sRecordedValue == "") ) { 
          sRet=sRet#web.webGetValueFromList(to.ValueList(),0); } else { sRet=sRet#web.webGetValueFromList(to.ValueList(),sRecordedValue.ToInteger()); 
        }
        if( btoNumber ) { 
          if (sRecordedValue == "") {
            real n = 0.0;
            sRet = sRet # n.ToString() # " (" # n.ToString(2);
          } else {
            sRet = sRet # sRecordedValue.ToString() # " (" # sRecordedValue.ToString(2);
          }
          if( to.ValueUnit() == "" ) { sRet = sRet # ")"; }
        }
        if (btoString) {
          sRet = sRet # sRecordedValue;
          sRet = sRet.Replace("\r\n", "<br/>");
          sRet = sRet.Replace("\r", "<br/>");
          sRet = sRet.Replace("\n", "<br/>");
        }
        if( to.ValueUnit() != "" ) {
          sRet=sRet#" "#to.ValueUnit();
          if( btoNumber ) { sRet = sRet # ")"; }
        }
      } else {
        string tsShortKey = to.HSSID();
        string tsLongKey = to.HSSID();
        object toCH = dom.GetObject( to.Channel() );
        if( toCH ) { tsLongKey = toCH.ChnLabel()#"|"#tsLongKey; }
        
        boolean tbOptionList = ( (to.ValueType() == ivtInteger) && (to.ValueSubType() == istEnum) );
        boolean tbAction = ( to.ValueSubType() == istAction );
        boolean tbBinary = ( to.ValueType() == ivtBinary );
        boolean tbRead = (to.Operations() & OPERATION_READ);
        boolean tbEvent = (to.Operations() & OPERATION_EVENT);
        boolean tbWrite = (to.Operations() & OPERATION_WRITE);
        
        boolean bBinary = ( to.ValueTypeStr() == "Binary" );
        boolean bFloat = ( to.ValueTypeStr() == "Float" );
        boolean bSpecial = false;
            
        string sVUTmp = to.ValueUnit().ToString();
        string sSpace = " ";
        
        real fVal1 = 0.0;
        real fVal2 = 0.0;
        string sSpecial = "";
        string stmpSV;
        foreach(stmpSV,oDP.EnumSpecialIDs()) {
           fVal1 = oDP.GetSpecialValue(stmpSV);
           fVal2 = sRecordedValue.ToFloat();
           if( fVal1 == fVal2 ) {
             bSpecial = true;
             sSpecial = stmpSV;
             sRecordedValue = "";
             sVUTmp = "";
             sSpace = "";
           }
        }
        
        if( tbBinary && (tbRead || tbAction) ) {
          if( sRecordedValue == "0" ) {
            tsShortKey = tsShortKey#"=FALSE";
            tsLongKey = tsLongKey#"=FALSE";
          } else {
            tsShortKey = tsShortKey#"=TRUE";
            tsLongKey = tsLongKey#"=TRUE";
          }
        }
        
        if( tbOptionList ) {
          tsShortKey = tsShortKey#"="#web.webGetValueFromList( to.ValueList(), sRecordedValue );
          tsLongKey = tsLongKey#"="#web.webGetValueFromList( to.ValueList(), sRecordedValue );
        }
        
        if( bSpecial ) {
          tsShortKey = tsShortKey#"="#sSpecial;
          tsLongKey = tsLongKey#"="#sSpecial;
        }        
        
        string sVTmp = tsLongKey ;
        if( !sVTmp.Length() ) { sVTmp = tsShortKey; }
        
        if( !bSpecial ) {
          if( sVUTmp == "100%" ) {
            sRecordedValue = sRecordedValue.ToFloat() * 100;
            sRecordedValue = sRecordedValue.ToString();
            sVUTmp = "%";
          }

          if( sVUTmp == "degree" ) { sVUTmp = "°"; }
          
          if( bBinary ) { sRecordedValue = ""; sSpace = ""; }
          
          if( bFloat ) { sRecordedValue = sRecordedValue.ToFloat().ToString(2); }
          
          if( (!bBinary) && (!bFloat) ) {
            if (((toCH.Label() != "HmIPW-DRAP") && (toCH.Label() != "HmIP-HAP")) || (sVUTmp == "°C") || (sVUTmp == "V")) {
              sRecordedValue = sRecordedValue.ToInteger();
              sRecordedValue = sRecordedValue.ToString(0);
            }
          }
          
          if( tbOptionList ) { sRecordedValue = ""; sVUTmp = ""; sSpace = ""; }
        }
        
        sVTmp = sVTmp#sSpace#sRecordedValue#sVUTmp;
        sRet = sVTmp;
      }
    }
    
    sRecordedValue = sRet;
    
    sCollectedNames = sDatapointName;
    sCollectedDateTimes = sDateTime;

    if( !sCollectedValues.Length() ) {
      sCollectedValues = sRecordedValue;
    } else {
      sCollectedValues = sCollectedValues#", "#sRecordedValue;
    }
  }
  string logLine=sCollectedDateTimes#","#sCollectedNames#", "#sCollectedValues;
  WriteLine(logLine);
  system.Exec("logger -p info -t 'RegaSysProtocol' '"#logLine#"'");
}

!dom.ClearHistoryData();
WriteLine("DONE");

VG,
Jérôme ☕️

---
Support for my Homebrew-Devices: Download JP-HB-Devices Addon

Slice
Beiträge: 1200
Registriert: 03.02.2016, 14:44
System: Alternative CCU (auf Basis OCCU)
Wohnort: irgendwo aus Süd BaWü
Hat sich bedankt: 139 Mal
Danksagung erhalten: 85 Mal

Re: Systemprotokoll auf Syslog Server

Beitrag von Slice » 30.09.2022, 14:16

Danke, Mach ich und melde mich wieder!
----------------------------------------------------------------------------------------
Raspi3B+ Bullseye mit HB-RF-ETH und RPI-RF-MOD auf piVCCU-FW 3.75.7 / Addons: CuxD v2.11 - E-Mail v1.7.6 - Patcher v1.0.0 - Philips Hue v3.2.5 - Programme drucken v2.6 - Scriptparser v1.11 - XML-API v2.3
Geräte: 141 / Kanäle: 791 / Datenpunkte: 6080 / SysVars: 275 / Programme: 161 / Regadom IDs: 14010 / 48 CUxD-Kanäle in 3 CUxD-Geräten
Intel NUC i3-5010U @ 2,1 GHz mit 16 GB RAM & 512 GB SSD für Proxmox mit ioBroker VM und CCU-Historian/InfluxDB/Grafana VM
----------------------------------------------------------------------------------------
Projekte im Forum: HomeHub v4.1 / Fritzbox-Anruferliste für HomeHub
----------------------------------------------------------------------------------------

Slice
Beiträge: 1200
Registriert: 03.02.2016, 14:44
System: Alternative CCU (auf Basis OCCU)
Wohnort: irgendwo aus Süd BaWü
Hat sich bedankt: 139 Mal
Danksagung erhalten: 85 Mal

Re: Systemprotokoll auf Syslog Server

Beitrag von Slice » 01.10.2022, 13:27

Entschuldige die verspätete Rückmeldung, nun sieht es besser aus:
Syslog3.jpg
man kann sehen das das Programm getriggert wird und nun kommen auch die Meldungen von dem HM-Sec-SC-2 an.
Sollte passen soweit! Danke nochmal!! :wink:

Grüße,
Slice
----------------------------------------------------------------------------------------
Raspi3B+ Bullseye mit HB-RF-ETH und RPI-RF-MOD auf piVCCU-FW 3.75.7 / Addons: CuxD v2.11 - E-Mail v1.7.6 - Patcher v1.0.0 - Philips Hue v3.2.5 - Programme drucken v2.6 - Scriptparser v1.11 - XML-API v2.3
Geräte: 141 / Kanäle: 791 / Datenpunkte: 6080 / SysVars: 275 / Programme: 161 / Regadom IDs: 14010 / 48 CUxD-Kanäle in 3 CUxD-Geräten
Intel NUC i3-5010U @ 2,1 GHz mit 16 GB RAM & 512 GB SSD für Proxmox mit ioBroker VM und CCU-Historian/InfluxDB/Grafana VM
----------------------------------------------------------------------------------------
Projekte im Forum: HomeHub v4.1 / Fritzbox-Anruferliste für HomeHub
----------------------------------------------------------------------------------------

Antworten

Zurück zu „HomeMatic allgemein“