-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathotrc.j2
63 lines (63 loc) · 1.85 KB
/
otrc.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{% set u = item.username|string %}
{% set d = item.devicename|string %}
{% set data = {
"_type": "configuration",
"allowRemoteLocation": True,
"auth": True,
"cleanSession": False,
"clientId" : "%s-%s" % (u, d),
"cmd": True,
"deviceId": d,
"extendedData": True,
"keepalive": 55,
"mode" : (item.httpmode is defined and item.httpmode) | ternary(3, 0),
"mqttProtocolLevel" : 3,
"host": dns_domain,
"password": item.password|string,
"port": 8883,
"positions": 200,
"pubQos": 2,
"pubRetain": True,
"pubTopicBase": "owntracks/%s/%s" % (u, d),
"subTopic" : "owntracks/+/+ owntracks/+/+/event owntracks/+/+/info owntracks/%s/%s/cmd" % (u, d),
"ranging": True,
"sub": True,
"subQos": 2,
"tid": item.tid,
"tls": True,
"url" : "https://%s/owntracks/pub" % (dns_domain),
"usePassword": True,
"username": u,
"willQos": 1,
"willRetain": False,
"willTopic": "",
"ws": False,
"mapLayerStyle" : "OpenStreetMapNormal",
"waypoints": [
{
"_type": "waypoint",
"desc": "+follow",
"lat": 37.3323,
"lon": -122.031,
"rad": 50,
"rid": "QUICKSETUP-BA2BFB63-7C60",
"tst": 1610104383
}
],
} %}
{% if item.secret is defined %}
{% set x = data.update({ "encryptionKey": item.secret|string }) %}
{% endif %}
{# -- #}
{# Android only but iOS ignores these #}
{% set f = [ "bearingArrowFollowsDeviceOrientation",
"showExperimentalPreferenceUI",
"allowSmallKeepalive",
"useOSMMap" ] %}
{% set x = data.update({ "experimentalFeatures": f }) %}
{% if opencage_apikey is defined %}
{% set x = data.update({ "opencageApiKey": opencage_apikey|string }) %}
{% set x = data.update({ "reverseGeocodeProvider": "OpenCage" }) %}
{% endif %}
{% set x = data.update({ "waypoints" : data.waypoints | wp(u)}) %}
{{ data | to_nice_json }}