Added pickle_to_class.py for converting pickled tags to class instances

This commit is contained in:
Patrick McDonagh
2016-07-14 17:45:11 -05:00
parent 37605fe41d
commit 5b2b8571a7

View File

@@ -0,0 +1,10 @@
import pickle
with open("ipp_channels.p", 'rb') as picklefile:
channels = pickle.load(picklefile)
for chname in sorted(channels):
ch = channels[chname]
if ch['data_type'] == "BOOL":
print("'{0}': Channel('{0}', '{1}', {2}, self.sendtodbJSON, writeable=True, e300_param=False),".format(chname, ch['tag'], ch['max_time_between_uploads']))
else:
print("'{0}': Channel('{0}', '{1}', {2}, self.sendtodbJSON, writeable=True, change_threshold=1.0, e300_param=False),".format(chname, ch['tag'], ch['max_time_between_uploads']))