From 16224d9dcc041792cb7fd0ff1954ae3eeadf4295 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 30 Aug 2013 14:03:21 +0200 Subject: Fixup TPM and TPO values they're returned swapped from in the JSON. /js/config.min.js has it right. --- pellematic-temp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'pellematic-temp') diff --git a/pellematic-temp b/pellematic-temp index 8fe25c5..205fa2b 100755 --- a/pellematic-temp +++ b/pellematic-temp @@ -34,10 +34,10 @@ items = [# Outside temperature sensor (X2) #"CAPPL:FA[0].L_feuerraumtemperatur", #"CAPPL:FA[0].L_feuerraumtemperatur_soll", # 1. Buffer - # TPO (X7) + # TPM (X8) "CAPPL:LOCAL.L_pu[0].ausschaltfuehler_ist", "CAPPL:LOCAL.L_pu[0].ausschaltfuehler_soll", - # TPM (X8) + # TPO (X7) "CAPPL:LOCAL.L_pu[0].einschaltfuehler_ist", "CAPPL:LOCAL.L_pu[0].einschaltfuehler_soll", # 1. Heating circuit @@ -45,6 +45,17 @@ items = [# Outside temperature sensor (X2) "CAPPL:LOCAL.L_hk[0].vorlauftemp_ist", ] +def fixup(name): + # TPM and TPO are swapped in the returned JSON + # (compare to /js/config.min.js) so we need + # to fix it up: + if name.startswith('TPM'): + return 'TPO' + name[3:] + elif name.startswith('TPO'): + return 'TPM' + name[3:] + else: + return name + def canon(name): return re.sub(r"[^a-zA-Z0-9_]", "_", name) @@ -57,10 +68,10 @@ graph_info This graph shows different temperture values as displayed by a Pellet out = fetch_raw(url) for item in out: if item['name'] in items: - name = item['shortText'] + name = fixup(item['shortText']) print "%s.label %s" % (canon(name), name) print "%s.type GAUGE" % canon(name) - thickness = 1 if item['name'].endswith('soll') else 2 + thickness = 1 if name.endswith('soll') else 2 print "%s.draw LINE%d" % (canon(name), thickness) def degree_celsius(val): @@ -112,7 +123,8 @@ def fetch_values(url): out = fetch_raw(url) for item in out: if item['name'] in items: - print "%s.value %.2f" % (canon(item['shortText']), + name = canon(fixup(item['shortText'])) + print "%s.value %.2f" % (name, degree_celsius(item)) -- cgit v1.2.3