22 lines
654 B
Python
22 lines
654 B
Python
from streams import Stream, EventGenerator
|
|
from nicoscache import NicosStream
|
|
from secop import ScanStream, ScanReply
|
|
from influx import testdb
|
|
|
|
|
|
def main():
|
|
e = EventGenerator(ScanReply(), ScanStream(), n=NicosStream('localhost:14002'))
|
|
e.return_on_wait = False
|
|
db = testdb()
|
|
errors = {}
|
|
while 1:
|
|
for (obj, param), value, error, ts, tags in e:
|
|
meas = f'{obj}.{param}'
|
|
db.write_float(meas, 'float', value, ts, **tags)
|
|
if error and error != errors.get(meas):
|
|
errors[meas] = error
|
|
db.write_string(meas, 'error', error, ts, **tags)
|
|
print('---')
|
|
|
|
main()
|