Exemplo n.º 1
0
    def run(self):
        if self.readonly:
            logging.info("%s" % self.data)
            return

        r = Record(**self._interpret())
        if self.commit:
            #r.light = int(r.light, 16)/10000.0
            r.save()
        else:
            r.created = datetime.datetime.now()
            logging.info("Record(created: %s, current: %s, volt: %s, temp: %s, light: %s)" %
                                (r.created, r.current, r.volt, r.temp, r.light))
Exemplo n.º 2
0
    def __init__(self, data, commit=False, readonly=False):
        threading.Thread.__init__(self)

        self.data = data
        self._data_fields_abbr = Record.data_fields_abbr()
        self.commit = commit
        self.readonly = readonly