aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-11-22 14:26:26 +0100
committerGuido Günther <agx@sigxcpu.org>2014-11-22 16:18:17 +0100
commit7cde77e2e212e4d786cd190b760d3dd5332bec1f (patch)
treeb40e7d2a0507948f3a9f3c8b2d7504f18f2b555f
parent6e61ae28f39e52e741833c843d1b6e49e1699e09 (diff)
Recent firmware omits the shortText
so hardcode the old values
-rwxr-xr-xpellematic-temp70
1 files changed, 38 insertions, 32 deletions
diff --git a/pellematic-temp b/pellematic-temp
index f27cf39..c3b84b5 100755
--- a/pellematic-temp
+++ b/pellematic-temp
@@ -36,33 +36,48 @@ import json
username = os.getenv('username', 'oekofen')
password = os.getenv('password', username)
debug = os.getenv('debug')
+url = os.getenv('url')
# The items we want to plot:
-items = [# Outside temperature sensor (X2)
- "CAPPL:LOCAL.L_aussentemperatur_ist",
+items = {# Outside temperature sensor (X2)
+ "CAPPL:LOCAL.L_aussentemperatur_ist":
+ "Outside Temp Act",
# 1. Pelletronic
- "CAPPL:FA[0].L_kesseltemperatur",
- "CAPPL:FA[0].L_kesseltemperatur_soll_anzeige",
+ "CAPPL:FA[0].L_kesseltemperatur":
+ "Boiler Temp",
+ "CAPPL:FA[0].L_kesseltemperatur_soll_anzeige":
+ "Boiler Temp Set",
#"CAPPL:FA[0].L_feuerraumtemperatur",
#"CAPPL:FA[0].L_feuerraumtemperatur_soll",
# 1. Buffer
# TPM (X8)
- "CAPPL:LOCAL.L_pu[0].ausschaltfuehler_ist",
- "CAPPL:LOCAL.L_pu[0].ausschaltfuehler_soll",
+ "CAPPL:LOCAL.L_pu[0].ausschaltfuehler_ist":
+ "TPM Act",
+ "CAPPL:LOCAL.L_pu[0].ausschaltfuehler_soll":
+ "TPM Set",
# TPO (X7)
- "CAPPL:LOCAL.L_pu[0].einschaltfuehler_ist",
- "CAPPL:LOCAL.L_pu[0].einschaltfuehler_soll",
+ "CAPPL:LOCAL.L_pu[0].einschaltfuehler_ist":
+ "TPO Act",
+ "CAPPL:LOCAL.L_pu[0].einschaltfuehler_soll":
+ "TPO Set",
# 1. Heating circuit
# VL1 (X4)
- "CAPPL:LOCAL.L_hk[0].vorlauftemp_ist",
- "CAPPL:LOCAL.L_hk[0].vorlauftemp_soll",
- "CAPPL:LOCAL.hk[0].raumtemp_heizen",
- "CAPPL:LOCAL.hk[0].raumtemp_absenken",
- "CAPPL:LOCAL.hk[0].heizgrenze_heizen",
- "CAPPL:LOCAL.hk[0].heizgrenze_absenken",
+ "CAPPL:LOCAL.L_hk[0].vorlauftemp_ist":
+ "Flow Temp Act",
+ "CAPPL:LOCAL.L_hk[0].vorlauftemp_soll":
+ "Flow Temp Set",
+ "CAPPL:LOCAL.hk[0].raumtemp_heizen":
+ "Room Temp Heating",
+ "CAPPL:LOCAL.hk[0].raumtemp_absenken":
+ "Room Temp Set Back Set",
+ "CAPPL:LOCAL.hk[0].heizgrenze_heizen":
+ "H Limit Heating",
+ "CAPPL:LOCAL.hk[0].heizgrenze_absenken":
+ "H Limit Set Back",
# drinking water
- "CAPPL:LOCAL.L_ww[0].einschaltfuehler_ist",
- ]
+ "CAPPL:LOCAL.L_ww[0].einschaltfuehler_ist":
+ "Switch On Sensor Act",
+ }
def fixup(name):
# TPM and TPO are swapped in the returned JSON
@@ -72,13 +87,6 @@ def fixup(name):
return 'TPO' + name[3:]
elif name.startswith('TPO'):
return 'TPM' + name[3:]
- # The room temp set back value is inconsistenly named
- elif name == "Set Back Temp Set":
- return "Room Temp Set Back Set"
- # The room temp heating value is a set value (not a
- # measured one) so it must end in _Set
- elif name == "Room Temp_Heating":
- return "Room Temp_Heating_Set"
else:
return name
@@ -87,7 +95,7 @@ def canon(name):
def is_preset(name):
"""
- Preset values are inconsistently named so return
+ Preset values are inconsistently named so
so we have to decide manually.
"""
if name.endswith(' Set'):
@@ -107,8 +115,8 @@ 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 = fixup(item['shortText'])
+ if item['name'] in items.keys():
+ name = items[item['name']]
print "%s.label %s" % (canon(name), name)
print "%s.type GAUGE" % canon(name)
thickness = 1 if is_preset(name) else 2
@@ -142,7 +150,7 @@ def fetch_raw(url):
}
# The items to fetch are passed as simple json string
- payload = json.dumps(items)
+ payload = json.dumps(items.keys())
r = requests.post(url,
data=payload,
params=params,
@@ -163,17 +171,15 @@ def fetch_values(url):
out = fetch_raw(url)
for item in out:
if item['name'] in items:
- name = canon(fixup(item['shortText']))
+ name = canon(items[item['name']])
print "%s.value %.2f" % (name,
degree_celsius(item))
def main(args):
- target = os.getenv('address')
- if not target:
- print >>sys.stderr, "No ip address configured"
+ if not url:
+ print >>sys.stderr, "No url configured"
return 1
- url = 'http://%s' % target
if len(args) > 1:
if args[1] in [ 'autoconf', 'detect' ]:
try: