"Frequency": fac,
                    "Temperatuur": temp,
                    "kwhtoday": kwhtoday,
                    "kwhtotal": kwhtotal
                }
            }]

            if __debug__:
                print "Json Buffer %s" % DataJson
                file = open("rawlog", 'a')
                file.write(
                    timestamp.strftime('%d %b %Y - %H:%M:%S') + ' ' + hexdata +
                    '\n')
                file.close()

#### Publish data
            if influx_db:
                client = InfluxDBClient(influx_server, influx_port,
                                        influx_user, influx_passwd, influx_db)
                client.create_database(influx_db)
                client.write_points(DataJson, protocol='json')

            if mqtt_server:
                client = mqtt.Client(client_id)
                client.connect(mqtt_server)
                client.publish(mqtt_topic, payload=json.dumps(DataJson))

    finally:
        if __debug__:
            print "Finally"