diff --git a/cbpi/controller/log_file_controller.py b/cbpi/controller/log_file_controller.py index 4a50604..59da525 100644 --- a/cbpi/controller/log_file_controller.py +++ b/cbpi/controller/log_file_controller.py @@ -57,12 +57,9 @@ class LogController: id = name try: - chars = {'ö':'oe','ä':'ae','ü':'ue','Ö':'Oe','Ä':'Ae','Ü':'Ue'} sensor=self.cbpi.sensor.find_by_id(name) if sensor is not None: itemname=sensor.name.replace(" ", "_") - for char in chars: - itemname = itemname.replace(char,chars[char]) out=str(self.influxdbmeasurement)+",source=" + itemname + ",itemID=" + str(id) + " value="+str(value) except Exception as e: logging.error("InfluxDB ID Error: {}".format(e)) @@ -72,7 +69,7 @@ class LogController: try: header = {'User-Agent': name, 'Authorization': "Token {}".format(self.influxdbpwd)} http = urllib3.PoolManager() - req = http.request('POST',self.influxdburl, body=out, headers = header) + req = http.request('POST',self.influxdburl, body=out.encode(), headers = header) except Exception as e: logging.error("InfluxDB cloud write Error: {}".format(e)) @@ -82,7 +79,7 @@ class LogController: try: header = {'User-Agent': name, 'Content-Type': 'application/x-www-form-urlencoded','Authorization': 'Basic %s' % self.base64string.decode('utf-8')} http = urllib3.PoolManager() - req = http.request('POST',self.influxdburl, body=out, headers = header) + req = http.request('POST',self.influxdburl, body=out.encode(), headers = header) except Exception as e: logging.error("InfluxDB write Error: {}".format(e)) diff --git a/cbpi/extension/ConfigUpdate/__init__.py b/cbpi/extension/ConfigUpdate/__init__.py index 8135457..0aab218 100644 --- a/cbpi/extension/ConfigUpdate/__init__.py +++ b/cbpi/extension/ConfigUpdate/__init__.py @@ -225,18 +225,10 @@ class ConfigUpdate(CBPiExtension): if influxdbaddr is None: logger.info("INIT Influxdbaddr") try: - await self.cbpi.config.add("INFLUXDBADDR", "localhost", ConfigType.STRING, "IP Address of your influxdb server (If INFLUXDBCLOUD set to Yes use URL Address of your influxdb cloud server)") + await self.cbpi.config.add("INFLUXDBADDR", "http://localhost:8086", ConfigType.STRING, "URL Address of your influxdb server (If INFLUXDBCLOUD set to Yes use URL Address of your influxdb cloud server)") except: logger.warning('Unable to update config') - ## Check if influxdbport is in config - #if influxdbport is None: - # logger.info("INIT Influxdbport") - # try: - # await self.cbpi.config.add("INFLUXDBPORT", "8086", ConfigType.STRING, "Port of your influxdb server") - # except: - # logger.warning('Unable to update config') - ## Check if influxdbname is in config if influxdbname is None: logger.info("INIT Influxdbname")