#!/bin/python3 from lxml import etree import sys ARDUINO_URL = '192.168.1.25' if "config" in sys.argv: print("graph_title Compteur EDF") print("graph_period hour") print("graph_args --base 1000") print("graph_vlabel Consommation (Wh)") print("graph_category Domotique") print("graph_info Consommation electrique relevee par le compteur") print("hp.label Heures pleines") print("hc.label Heures creuses") print("hp.info Heures pleines") print("hc.info Heures creuses : 0h-8h") print("hp.type COUNTER") print("hc.type COUNTER") else: root = etree.parse('http://{}'.format(ARDUINO_URL)) infos = root.xpath('/teleinformation') HP = infos[0].find('HCHP').text HC = infos[0].find('HCHC').text print("hc.value ", HC) print("hp.value ", HP)