alle Sensoren mit Datenpunkte anzeigen

Dieses Script zeigt alle Sensoren mit ihren Datenpunkten an.

 

var objIDs = dom.GetObject(ID_DEVICES).EnumUsedIDs();
string did;
string cid;
string kid;

foreach(did, objIDs){
  var object = dom.GetObject(did);
  WriteLine("object name: " # object.Name() # " (" #  object.ID() # ")");
  var device = dom.GetObject(object.Interface());
  WriteLine("device type: " #  device.Name() # " (" # device.ID() # ")");
  string GeraetName = object.Name();
  var Geraet = dom.GetObject(GeraetName);
  foreach(cid, Geraet.Channels()) {
    var ch = dom.GetObject(cid);
    WriteLine("- channel name: " # ch.Name() # " (" # ch.ID() # ")" );
    
    string KanalName = ch.Name();
    var AktorKanal = dom.GetObject(KanalName);
    if (! AktorKanal ) {
      WriteLine(" -- no datapoints");
    } else {
      foreach(kid, AktorKanal.DPs()) {
        var dp = dom.GetObject(kid);
        WriteLine(" -- " # dp.Name() # ": " # dp.Value());
      }
    }
  }
  WriteLine("");
}

WriteLine("done");