diff --git a/seaweb.py b/seaweb.py index dffd8c0..94a03ea 100755 --- a/seaweb.py +++ b/seaweb.py @@ -26,6 +26,8 @@ import os import signal +class InfluxGraph: + """to be imported""" try: import simplejson as json except ImportError: import json @@ -186,7 +188,7 @@ def sea_request_reply(socket, command, tmo=5): t += 0.1 if t > 5: logging.warning('unusual wait time %.4g (before command %s)', t, command) - #print command + #print(command) socket.busy = True socket.send_line("fulltransact "+command) data = [] @@ -480,6 +482,14 @@ class SeaInstrument(Instrument): self.lastcmd = command +class SeaInfluxInstrument(SeaInstrument): + + def newClient(self): + if not self.seaspy.connected: + self.init() + return self.register(SeaInfluxClient()) + + class SeaGraph: HISTORICAL = 0 ACTUAL = 1 @@ -551,7 +561,7 @@ class SeaGraph: return result def w_updategraph(self): - """update live values"" + """update live values - seems not to work""" logging.info("UPD GRAPH %d", self.livemode) if self.livemode == self.HISTORICAL: return dict(type='accept-graph', live=False) @@ -579,7 +589,7 @@ class SeaGraph: return dict(type='graph-update', reduced=False, time=self.time[1], graph=result) return None -class SeaClient(SeaGraph): +class SeaParams: def __init__(self): self.group_version = {} @@ -652,6 +662,14 @@ class SeaClient(SeaGraph): return dict(type='accept-command') +class SeaClient(SeaParams, SeaGraph): + pass + + +class SeaInfluxClient(SeaParams, InfluxGraph): + pass + + class DummyClient(SeaGraph): asynch = set(('id','update','redraw','command','reply','graph-update','graph-redraw')) @@ -974,6 +992,8 @@ if __name__ == '__main__': type = instrument_config.get('type', 'sea') if type == 'sea': instrument = SeaInstrument(inst_name, instrument_config) + elif type == 'influxsea': + instrument = SeaInfluxInstrument(inst_name, instrument_config) elif type == 'dummy': instrument = DummyInstrument(inst_name, instrument_config) elif type == 'secop':