]> git.zndr.dk Git - dotfiles.git/commitdiff
CIM/CIU log support in gf.py
authorJannik ZANDER <jzander@grundfos.com>
Tue, 14 Jun 2016 11:00:07 +0000 (13:00 +0200)
committerJannik ZANDER <jzander@grundfos.com>
Tue, 14 Jun 2016 11:00:07 +0000 (13:00 +0200)
.local/bin/gf.py
.local/bin/gf_config.py

index 8cca2f923e4695df51b77396718ed024bff9ba46..2fd711c7d3d41f93a5971abb3af860b734883f81 100755 (executable)
@@ -61,11 +61,24 @@ def readtimestamp(line):
       h=int(info[0].split(' ')[1])
       m=int(info[1])
       s=info[2].split('.')
-      u=s[1].split(' ')
-      ts=datetime.combine(date.today(),time(h,m,int(s[0]),int(u[0])*1000))
-      line=s[1][4:]
+      ts=datetime.combine(date.today(),time(h,m,int(s[0]),int(s[1])*1000))
+      line=info[3][1:]
     except:
       pass
+
+# if timestamp>1e9: # 2001-09-09
+#   pass
+# else:
+#   try:
+#     h=int(info[0].split(' ')[1])
+#     m=int(info[1])
+#     s=info[2].split('.')
+#     u=s[1].split(' ')
+#     ts=datetime.combine(date.today(),time(h,m,int(s[0]),int(u[0])*1000))
+#     line=s[1][4:]
+#   except:
+#     pass
+#
   print(ts)
   return ts,line
 
@@ -134,9 +147,15 @@ def process_data(line,le,size1,size2):
       tmp,line=readbyte(line)
       val[i]=(val[i]<<8)+tmp
     if size1>0 and size2>0:
-      print(gf.params[cl][ids[i]],"=",val[i])
+      if gf.params[cl][ids[i]] != "":
+        print(gf.params[cl][ids[i]],"=",val[i])
+      else:
+        print("Id:",ids[i],"=",val[i])
     elif size1>0:
-      print(gf.params[cl][ids[i]])
+      if gf.params[cl][ids[i]] != "":
+        print(gf.params[cl][ids[i]])
+      else:
+        print("Id:",ids[i])
     elif size2>0:
       print("=",val[i])
   return ids,val,line
index 4729a5a63d9b7c6ac543643fcbf5deb5ea5f8708..225aedb59684e060a2ec409bb4e011ba3ed6aa6a 100644 (file)
@@ -610,7 +610,8 @@ class10[55]="event_back_log"
 class10[56]="mge_event_log_obj"
 class10[57]="event_connect_obj"
 class10[71]="geniair_appl_bind_tab"
-class10[72]="geniair_nwk_status_obj" class10[73]="twin_pump_data_exch_obj"
+class10[72]="geniair_nwk_status_obj"
+class10[73]="twin_pump_data_exch_obj"
 class10[74]="max_power_log_records_obj"
 class10[76]="pump_setup_options_obj"
 class10[77]="multi_pump_sync_obj"