aboutsummaryrefslogtreecommitdiff
path: root/pellematic-temp
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2013-08-30 14:03:21 +0200
committerGuido Günther <agx@sigxcpu.org>2013-08-30 14:04:33 +0200
commit16224d9dcc041792cb7fd0ff1954ae3eeadf4295 (patch)
treee5812c9b64eb43dc9a2a5b4ec021b56e061e3b05 /pellematic-temp
parent1834dd5a15852a653efdacc8c18431976b294c09 (diff)
Fixup TPM and TPO values
they're returned swapped from in the JSON. /js/config.min.js has it right.
Diffstat (limited to 'pellematic-temp')
-rwxr-xr-xpellematic-temp22
1 files changed, 17 insertions, 5 deletions
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))