Owntrack OT-Recoder

TODO: FIXME

TODO: FIXME

OT-Recoder starten

mosquitto.conf
port 1883
protocol mqtt

autosave_interval 1800
port 8883
protocol mqtt
certfile /etc/ssl/cert.pem
cafile /etc/ssl/chain.pem
keyfile /etc/ssl/privkey.pem





persistence true
persistence_location /var/lib/mosquitto/
persistence_file mosquitto.db
log_dest syslog
log_dest stdout
log_dest topic
log_type error
log_type warning
log_type notice
log_type information
log_type debug
connection_messages true
log_timestamp true
allow_anonymous false
password_file /etc/mosquitto/pwfile
ghetto ssl
echo | openssl s_client -servername <host> -connect <host>:8883 2>/dev/null | openssl x509 -text > /etc/ssl/ca.pem
ot-recoder.sh
OTR_CAFILE=/etc/ssl/ca.pem 
OTR_HOST=<domain>
OTR_USER=<user>
OTR_PASS=<pass>
nohup ot-recorder --precision 9 --http-host 0.0.0.0 --port 8883 --debug 'owntracks/#'

Entferne Falsche Punkte

dieser python gibt dir sed commandos zum entfernen alle punkte die vermutlich falsch sind da schneller als 500km/h

example
/home/progamler # python3 test.py /var/spool/owntracks/recorder/store/rec/progamler/hwgra/2017-05.rec
source.py
import json
from geopy.distance import vincenty
import sys
data = []
with open(sys.argv[1]) as f:
        for line in f:
                tmp = json.loads("{" + line.split('{',1)[-1])
                if "lat" in tmp:
                        data.append(tmp)

a=(0,0)
t=0
for d in data:
        if a != (0,0):
                dist = vincenty(a, (d['lat'], d['lon'])).km
                if dist > 1:
                        #print(dist)
                        delta=int(d['tst'])-int(t)
                        if float(dist) == 0:
                                continue 
                        if delta == 0:
                                continue 
                        speed=(float(dist)/delta)*3600
                        if speed > 500:
                                #print(speed)
                                print("sed -i.bak '/" + str(d['tst']) + "/d' " + sys.argv[1])
        a = (d['lat'], d['lon'])
        t = int(d['tst'])

  • Zuletzt geändert: 17.05.2017 17:04
  • von progamler