frugal-iot-server 0.3.5 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALLATION.md +305 -122
- package/README.md +6 -6
- package/config.d/logger.yaml +16 -0
- package/config.d/schema/modules.yaml +80 -1
- package/config.d/schema/topics.yaml +184 -2
- package/config.d/server.yaml +37 -4
- package/extras/mosquitto.conf +9 -1
- package/frugal-iot-server.js +74 -8
- package/lib/api-routes.js +3 -0
- package/lib/data-loader.js +11 -4
- package/lib/housekeeping.js +251 -0
- package/lib/logger-client.js +16 -0
- package/package.json +7 -3
- package/public/service-worker.js +1 -1
- package/scripts/addorganization.zsh +4 -4
- package/scripts/check-schema.js +127 -0
- package/scripts/copy-schema-to-examples.zsh +55 -0
- package/scripts/diagnostic.zsh +109 -16
- package/scripts/init.zsh +4 -4
- package/scripts/prerelease.zsh +125 -0
- package/scripts/setpassword.zsh +3 -3
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ data and database; npm keeps the software itself under it in `node_modules`.
|
|
|
17
17
|
mkdir ~/frugal-iot
|
|
18
18
|
cd ~/frugal-iot
|
|
19
19
|
npm install frugal-iot-server
|
|
20
|
-
npx frugal-iot-init
|
|
20
|
+
npx --no frugal-iot-init
|
|
21
21
|
```
|
|
22
22
|
`frugal-iot-init` copies in the configuration files, creates the `data`, `ota` and
|
|
23
23
|
`config.d/organizations` directories, and creates the database. It never overwrites anything
|
|
@@ -27,24 +27,24 @@ Edit `config.yaml` and `config.d/mqtt.yaml` (which broker to talk to) if the def
|
|
|
27
27
|
|
|
28
28
|
The database is created with a `superuser` account that has no password, so give it one:
|
|
29
29
|
```
|
|
30
|
-
npx frugal-iot-setpassword superuser "<a-good-password>"
|
|
30
|
+
npx --no frugal-iot-setpassword superuser "<a-good-password>"
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Then add an organization - this writes its yaml file into `config.d/organizations`, creates a
|
|
34
34
|
login account of the same name with its permissions, and sets its password on the MQTT broker:
|
|
35
35
|
```
|
|
36
|
-
npx frugal-iot-addorganization <org-id> <org-name> <email> <phone> <broker-password>
|
|
36
|
+
npx --no frugal-iot-addorganization <org-id> <org-name> <email> <phone> <broker-password>
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
That password is the one used by the nodes and the broker. It will also work for login, so it is
|
|
40
40
|
recommended to give the login its own:
|
|
41
41
|
```
|
|
42
|
-
npx frugal-iot-setpassword <org-id> <login-password>
|
|
42
|
+
npx --no frugal-iot-setpassword <org-id> <login-password>
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
Now start it:
|
|
46
46
|
```
|
|
47
|
-
npx frugal-iot-server
|
|
47
|
+
npx --no frugal-iot-server
|
|
48
48
|
```
|
|
49
49
|
If its working correctly you should see something like
|
|
50
50
|
```
|
|
@@ -70,7 +70,7 @@ and receives data from nodes attached to it.
|
|
|
70
70
|
|
|
71
71
|
Open a browser pointing at for example `localhost:8080` and you should see the UI.
|
|
72
72
|
|
|
73
|
-
To upgrade later: `npm update frugal-iot-server` then `npx frugal-iot-init`.
|
|
73
|
+
To upgrade later: `npm update frugal-iot-server` then `npx --no frugal-iot-init`.
|
|
74
74
|
|
|
75
75
|
#### Developing the server, client or logger
|
|
76
76
|
|
package/config.d/logger.yaml
CHANGED
|
@@ -4,6 +4,22 @@
|
|
|
4
4
|
# BUT this doesnt work yet - since there are permissions issues if login ot local server then get from production
|
|
5
5
|
# url: https://frugaliot.naturalinnovation.org/data
|
|
6
6
|
url: /data
|
|
7
|
+
|
|
8
|
+
# Report every message received on the console, and so into the systemd journal - one line per
|
|
9
|
+
# message, which is one disk write per message. Off here because the usual installation runs from
|
|
10
|
+
# an SD card, where writes wear the card out; turn it on while working out why a node's readings
|
|
11
|
+
# are not appearing, and turn it back off afterwards. A server that does not have this setting at
|
|
12
|
+
# all reports messages, so upgrading never quietens a machine that was talking before.
|
|
13
|
+
verbose: false
|
|
14
|
+
|
|
15
|
+
# How often the readings collected in memory are written out to the CSV files under data/, in
|
|
16
|
+
# seconds. Writing each reading as it arrives is what wears an SD card out, so they are gathered
|
|
17
|
+
# up and written in one go. The cost is that pulling the power loses up to this much data, since
|
|
18
|
+
# what has not been written yet is only in memory; a clean shutdown or restart writes it out
|
|
19
|
+
# first, and so does anything reading the data back over /data. 0, or leaving this out altogether,
|
|
20
|
+
# writes each reading as it arrives, which is what versions before this one did.
|
|
21
|
+
flushseconds: 300
|
|
22
|
+
|
|
7
23
|
#TODO add info that server should use when launching logger
|
|
8
24
|
#TODO add info that logger uses for its own configuraton
|
|
9
25
|
#TODO see https://github.com/mitra42/frugal-iot-server/issues/7 and
|
|
@@ -7,11 +7,45 @@
|
|
|
7
7
|
# topics: list of topics, each with leaf, optionally leaf_from if it should be copied, and optionally any fields of topics to be overridden
|
|
8
8
|
# slot: if it is supposed to fit in a specific slot of frugaliot
|
|
9
9
|
# insidefrugaliot: true if it should be hidden inside the Frugal_IoT drop-down on the name of a sensor, false or not set if it should be shown as a separate module
|
|
10
|
+
aht20:
|
|
11
|
+
name: "AHT20"
|
|
12
|
+
topics:
|
|
13
|
+
- leaf: temperature
|
|
14
|
+
- leaf: humidity
|
|
15
|
+
aht21:
|
|
16
|
+
name: "AHT21"
|
|
17
|
+
topics:
|
|
18
|
+
- leaf: temperature
|
|
19
|
+
- leaf: humidity
|
|
10
20
|
battery:
|
|
11
21
|
name: "Battery"
|
|
12
22
|
insidefrugaliot: true
|
|
13
23
|
topics:
|
|
14
24
|
- leaf: battery
|
|
25
|
+
bme280:
|
|
26
|
+
name: "BME280"
|
|
27
|
+
topics:
|
|
28
|
+
- leaf: temperature
|
|
29
|
+
- leaf: humidity
|
|
30
|
+
- leaf: pressure
|
|
31
|
+
max: 1100
|
|
32
|
+
min: 300
|
|
33
|
+
bme680:
|
|
34
|
+
name: "BME680"
|
|
35
|
+
topics:
|
|
36
|
+
- leaf: temperature
|
|
37
|
+
- leaf: humidity
|
|
38
|
+
- leaf: pressure
|
|
39
|
+
max: 1100
|
|
40
|
+
min: 300
|
|
41
|
+
- leaf: gas
|
|
42
|
+
bmp280:
|
|
43
|
+
name: "BMP280"
|
|
44
|
+
topics:
|
|
45
|
+
- leaf: temperature
|
|
46
|
+
- leaf: pressure
|
|
47
|
+
max: 1100
|
|
48
|
+
min: 300
|
|
15
49
|
button:
|
|
16
50
|
name: Button
|
|
17
51
|
topics:
|
|
@@ -112,6 +146,33 @@ ds18b20:
|
|
|
112
146
|
topics:
|
|
113
147
|
- leaf: ds18b20
|
|
114
148
|
leaf_from: temperature
|
|
149
|
+
do:
|
|
150
|
+
name: "Dissolved Oxygen"
|
|
151
|
+
topics:
|
|
152
|
+
- leaf: do
|
|
153
|
+
ens160:
|
|
154
|
+
name: "ENS160"
|
|
155
|
+
topics:
|
|
156
|
+
# Compensation inputs, not readings. The ENS160 has no thermometer of its own: it takes
|
|
157
|
+
# ambient temperature and humidity from whatever is wired to it - an AHT21 sitting on the
|
|
158
|
+
# same breakout, or any other sensor on the node. So these come from controlfloat (wireable,
|
|
159
|
+
# rw: w, not logged) rather than from the temperature/humidity topics, which are read-only
|
|
160
|
+
# readings - whichever sensor actually measures them is the one that logs them.
|
|
161
|
+
- leaf: temperature
|
|
162
|
+
leaf_from: controlfloat
|
|
163
|
+
name: Temperature
|
|
164
|
+
max: 50
|
|
165
|
+
color: red
|
|
166
|
+
- leaf: humidity
|
|
167
|
+
leaf_from: controlfloat
|
|
168
|
+
name: Humidity
|
|
169
|
+
color: blue
|
|
170
|
+
- leaf: aqi
|
|
171
|
+
- leaf: tvoc
|
|
172
|
+
- leaf: eco2
|
|
173
|
+
- leaf: aqi500
|
|
174
|
+
# Legacy - firmware before the ENS160/AHT21 split published everything under one module id.
|
|
175
|
+
# Kept so already-deployed nodes still display; new nodes use `ens160` and `aht21` above.
|
|
115
176
|
ensaht:
|
|
116
177
|
name: "ENS AHT"
|
|
117
178
|
topics:
|
|
@@ -120,7 +181,7 @@ ensaht:
|
|
|
120
181
|
- leaf: aqi
|
|
121
182
|
- leaf: tvoc
|
|
122
183
|
- leaf: eco2
|
|
123
|
-
- leaf:
|
|
184
|
+
- leaf: aqi500
|
|
124
185
|
frugal_iot:
|
|
125
186
|
name: XXX
|
|
126
187
|
topics:
|
|
@@ -138,6 +199,8 @@ gps:
|
|
|
138
199
|
- leaf: speed
|
|
139
200
|
- leaf: satellites
|
|
140
201
|
- leaf: hdop
|
|
202
|
+
- leaf: position
|
|
203
|
+
- leaf: utc_time
|
|
141
204
|
health:
|
|
142
205
|
name: System
|
|
143
206
|
insidefrugaliot: true
|
|
@@ -149,6 +212,18 @@ ht:
|
|
|
149
212
|
topics:
|
|
150
213
|
- leaf: temperature
|
|
151
214
|
- leaf: humidity
|
|
215
|
+
ina219:
|
|
216
|
+
name: "Power Monitor"
|
|
217
|
+
topics:
|
|
218
|
+
- leaf: shunt
|
|
219
|
+
- leaf: bus
|
|
220
|
+
- leaf: current
|
|
221
|
+
- leaf: power
|
|
222
|
+
- leaf: load
|
|
223
|
+
lcd:
|
|
224
|
+
name: LCD
|
|
225
|
+
topics:
|
|
226
|
+
- leaf: message
|
|
152
227
|
ledbuiltin:
|
|
153
228
|
name: LED
|
|
154
229
|
slot: ledbuiltin
|
|
@@ -193,3 +268,7 @@ soil:
|
|
|
193
268
|
name: Soil
|
|
194
269
|
topics:
|
|
195
270
|
- leaf: soil
|
|
271
|
+
ultrasonic:
|
|
272
|
+
name: "Ultrasonic Distance"
|
|
273
|
+
topics:
|
|
274
|
+
- leaf: ultrasonic
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
# graphable true if can be displayed on a graph
|
|
18
18
|
# wireable true,false, generally only controls are wireable
|
|
19
19
|
# wired not valid in this context, it will come from MQTT broker
|
|
20
|
+
# log whether readings of this topic are recorded to disk. Say so either way on every topic: with
|
|
21
|
+
# no setting at all, any float, int or bool with "rw: r" is recorded, which is easy to be
|
|
22
|
+
# surprised by. scripts/check-schema.js warns about a topic that does not say.
|
|
23
|
+
# duplicates when to bother recording a reading: significantvalue is how much it has to have moved
|
|
24
|
+
# since the last one recorded, significantdate how long (in milliseconds) since that one, and a
|
|
25
|
+
# reading that meets neither is dropped. Every topic with "log: true" wants a rule here - without
|
|
26
|
+
# one, every reading is written to the SD card as it arrives, which wears the card out.
|
|
20
27
|
# Note battery gets special cased
|
|
21
28
|
# See https://www.iana.org/assignments/senml/senml.xhtml for units
|
|
22
29
|
altitude:
|
|
@@ -40,6 +47,11 @@ analog:
|
|
|
40
47
|
rw: r
|
|
41
48
|
graphable: true
|
|
42
49
|
log: true
|
|
50
|
+
# A raw ADC reading with no declared range, so this threshold is a guess - lower it if real
|
|
51
|
+
# changes are being missed, raise it if the graph is mostly noise
|
|
52
|
+
duplicates:
|
|
53
|
+
significantdate: 900000
|
|
54
|
+
significantvalue: 10
|
|
43
55
|
aqi:
|
|
44
56
|
leaf: aqi
|
|
45
57
|
name: AQI
|
|
@@ -87,21 +99,43 @@ brightness:
|
|
|
87
99
|
leaf: brightness
|
|
88
100
|
name: Brightness
|
|
89
101
|
type: int
|
|
102
|
+
log: false
|
|
90
103
|
max: 255
|
|
91
104
|
min: 0
|
|
92
105
|
display: slider
|
|
93
106
|
rw: w
|
|
107
|
+
bus:
|
|
108
|
+
leaf: bus
|
|
109
|
+
name: Bus Voltage
|
|
110
|
+
type: float
|
|
111
|
+
display: text
|
|
112
|
+
min: 0
|
|
113
|
+
max: 32
|
|
114
|
+
color: green
|
|
115
|
+
rw: r
|
|
116
|
+
log: true
|
|
117
|
+
units: V
|
|
118
|
+
duplicates:
|
|
119
|
+
significantdate: 900000
|
|
120
|
+
significantvalue: 0.1
|
|
121
|
+
graphable: true
|
|
94
122
|
button:
|
|
95
123
|
leaf: button
|
|
96
124
|
name: Button
|
|
97
125
|
type: bool
|
|
126
|
+
log: true
|
|
98
127
|
display: toggle
|
|
99
128
|
color: black
|
|
100
129
|
rw: r
|
|
130
|
+
# A press changes the value, so it is still recorded - this only drops the repeats in between
|
|
131
|
+
duplicates:
|
|
132
|
+
significantdate: 900000
|
|
133
|
+
significantvalue: 1
|
|
101
134
|
color:
|
|
102
135
|
leaf: color
|
|
103
136
|
name: Color
|
|
104
137
|
type: color
|
|
138
|
+
log: false
|
|
105
139
|
display: color
|
|
106
140
|
rw: w
|
|
107
141
|
controlfloat:
|
|
@@ -109,6 +143,7 @@ controlfloat:
|
|
|
109
143
|
min: 0
|
|
110
144
|
max: 100
|
|
111
145
|
type: float
|
|
146
|
+
log: false
|
|
112
147
|
display: text
|
|
113
148
|
color: black
|
|
114
149
|
wireable: true
|
|
@@ -119,6 +154,7 @@ controlint:
|
|
|
119
154
|
min: 0
|
|
120
155
|
max: 65535
|
|
121
156
|
type: int
|
|
157
|
+
log: false
|
|
122
158
|
display: text
|
|
123
159
|
color: black
|
|
124
160
|
wireable: true
|
|
@@ -129,6 +165,7 @@ controltext:
|
|
|
129
165
|
min: 0
|
|
130
166
|
max: 100
|
|
131
167
|
type: text
|
|
168
|
+
log: false
|
|
132
169
|
display: text
|
|
133
170
|
color: black
|
|
134
171
|
wireable: true
|
|
@@ -137,6 +174,7 @@ controltext:
|
|
|
137
174
|
controlintoggle:
|
|
138
175
|
#[leaf, name] should be overridden
|
|
139
176
|
type: bool
|
|
177
|
+
log: false
|
|
140
178
|
display: toggle
|
|
141
179
|
color: black
|
|
142
180
|
rw: w
|
|
@@ -144,10 +182,15 @@ controlintoggle:
|
|
|
144
182
|
controlouttoggle:
|
|
145
183
|
#[leaf, name] should be overridden
|
|
146
184
|
type: bool
|
|
185
|
+
log: true
|
|
147
186
|
display: toggle
|
|
148
187
|
color: black
|
|
149
188
|
rw: r
|
|
150
189
|
wireable: true
|
|
190
|
+
# Read-only bool, so logged by default - match the "out" and "on" topics it stands in for
|
|
191
|
+
duplicates:
|
|
192
|
+
significantdate: 900000
|
|
193
|
+
significantvalue: 1
|
|
151
194
|
course:
|
|
152
195
|
leaf: course
|
|
153
196
|
name: Course
|
|
@@ -163,14 +206,45 @@ course:
|
|
|
163
206
|
rw: r
|
|
164
207
|
graphable: true
|
|
165
208
|
units: deg
|
|
209
|
+
current:
|
|
210
|
+
leaf: current
|
|
211
|
+
name: Current
|
|
212
|
+
type: float
|
|
213
|
+
display: text
|
|
214
|
+
min: -3200
|
|
215
|
+
max: 3200
|
|
216
|
+
color: red
|
|
217
|
+
rw: r
|
|
218
|
+
log: true
|
|
219
|
+
units: mA
|
|
220
|
+
duplicates:
|
|
221
|
+
significantdate: 900000
|
|
222
|
+
significantvalue: 1
|
|
223
|
+
graphable: true
|
|
166
224
|
description:
|
|
167
225
|
leaf: description
|
|
168
226
|
slot: description
|
|
169
227
|
name: Description
|
|
170
228
|
type: text
|
|
229
|
+
log: false
|
|
171
230
|
display: text
|
|
172
231
|
rw: w
|
|
173
232
|
retain: true
|
|
233
|
+
do:
|
|
234
|
+
leaf: do
|
|
235
|
+
name: Dissolved Oxygen
|
|
236
|
+
type: float
|
|
237
|
+
display: bar
|
|
238
|
+
min: 0
|
|
239
|
+
max: 20
|
|
240
|
+
color: blue
|
|
241
|
+
rw: r
|
|
242
|
+
log: true
|
|
243
|
+
units: mg/L
|
|
244
|
+
duplicates:
|
|
245
|
+
significantdate: 900000
|
|
246
|
+
significantvalue: 0.1
|
|
247
|
+
graphable: true
|
|
174
248
|
eco2:
|
|
175
249
|
leaf: eco2
|
|
176
250
|
name: eCO2
|
|
@@ -186,6 +260,21 @@ eco2:
|
|
|
186
260
|
significantvalue: 5
|
|
187
261
|
rw: r
|
|
188
262
|
graphable: true
|
|
263
|
+
gas:
|
|
264
|
+
leaf: gas
|
|
265
|
+
name: Gas Resistance
|
|
266
|
+
type: float
|
|
267
|
+
display: text
|
|
268
|
+
min: 0
|
|
269
|
+
max: 500
|
|
270
|
+
color: green
|
|
271
|
+
rw: r
|
|
272
|
+
log: true
|
|
273
|
+
units: kOhm
|
|
274
|
+
duplicates:
|
|
275
|
+
significantdate: 900000
|
|
276
|
+
significantvalue: 1
|
|
277
|
+
graphable: true
|
|
189
278
|
hdop:
|
|
190
279
|
leaf: hdop
|
|
191
280
|
name: HDOP
|
|
@@ -220,18 +309,21 @@ id:
|
|
|
220
309
|
slot: id
|
|
221
310
|
name: Node ID
|
|
222
311
|
type: text
|
|
312
|
+
log: false
|
|
223
313
|
display: text
|
|
224
314
|
rw: r
|
|
225
315
|
key:
|
|
226
316
|
leaf: key
|
|
227
317
|
name: Key
|
|
228
318
|
type: text
|
|
319
|
+
log: false
|
|
229
320
|
display: text
|
|
230
321
|
rw: r
|
|
231
|
-
|
|
232
|
-
leaf:
|
|
322
|
+
language_code:
|
|
323
|
+
leaf: language_code
|
|
233
324
|
name: Language
|
|
234
325
|
type: text
|
|
326
|
+
log: false
|
|
235
327
|
display: text
|
|
236
328
|
color: black
|
|
237
329
|
rw: r
|
|
@@ -240,6 +332,7 @@ lastseen:
|
|
|
240
332
|
slot: lastseen
|
|
241
333
|
name: Last Seen
|
|
242
334
|
type: text
|
|
335
|
+
log: false
|
|
243
336
|
display: text
|
|
244
337
|
rw: r
|
|
245
338
|
latitude:
|
|
@@ -257,6 +350,21 @@ latitude:
|
|
|
257
350
|
rw: r
|
|
258
351
|
graphable: true
|
|
259
352
|
units: lat
|
|
353
|
+
load:
|
|
354
|
+
leaf: load
|
|
355
|
+
name: Load Voltage
|
|
356
|
+
type: float
|
|
357
|
+
display: text
|
|
358
|
+
min: 0
|
|
359
|
+
max: 32
|
|
360
|
+
color: green
|
|
361
|
+
rw: r
|
|
362
|
+
log: true
|
|
363
|
+
units: V
|
|
364
|
+
duplicates:
|
|
365
|
+
significantdate: 900000
|
|
366
|
+
significantvalue: 0.1
|
|
367
|
+
graphable: true
|
|
260
368
|
loadcell:
|
|
261
369
|
leaf: loadcell
|
|
262
370
|
name: Load Cell
|
|
@@ -321,6 +429,7 @@ message:
|
|
|
321
429
|
min: 0
|
|
322
430
|
max: 100
|
|
323
431
|
type: text
|
|
432
|
+
log: false
|
|
324
433
|
display: text
|
|
325
434
|
color: black
|
|
326
435
|
wireable: true
|
|
@@ -346,6 +455,7 @@ name:
|
|
|
346
455
|
slot: name
|
|
347
456
|
name: Node Name
|
|
348
457
|
type: text
|
|
458
|
+
log: false
|
|
349
459
|
display: text
|
|
350
460
|
rw: w
|
|
351
461
|
retain: true
|
|
@@ -374,6 +484,29 @@ out:
|
|
|
374
484
|
duplicates:
|
|
375
485
|
significantdate: 900000
|
|
376
486
|
significantvalue: 1
|
|
487
|
+
position:
|
|
488
|
+
leaf: position
|
|
489
|
+
name: Position
|
|
490
|
+
type: text
|
|
491
|
+
log: false
|
|
492
|
+
display: text
|
|
493
|
+
color: black
|
|
494
|
+
rw: r
|
|
495
|
+
power:
|
|
496
|
+
leaf: power
|
|
497
|
+
name: Power
|
|
498
|
+
type: float
|
|
499
|
+
display: text
|
|
500
|
+
min: 0
|
|
501
|
+
max: 100000
|
|
502
|
+
color: orange
|
|
503
|
+
rw: r
|
|
504
|
+
log: true
|
|
505
|
+
units: mW
|
|
506
|
+
duplicates:
|
|
507
|
+
significantdate: 900000
|
|
508
|
+
significantvalue: 10
|
|
509
|
+
graphable: true
|
|
377
510
|
pressure:
|
|
378
511
|
leaf: pressure
|
|
379
512
|
name: Pressure
|
|
@@ -422,12 +555,28 @@ select:
|
|
|
422
555
|
leaf: select
|
|
423
556
|
name: Select
|
|
424
557
|
type: int
|
|
558
|
+
log: false
|
|
425
559
|
min: 0
|
|
426
560
|
display: text
|
|
427
561
|
color: black
|
|
428
562
|
wireable: false
|
|
429
563
|
rw: w
|
|
430
564
|
retain: true
|
|
565
|
+
shunt:
|
|
566
|
+
leaf: shunt
|
|
567
|
+
name: Shunt Voltage
|
|
568
|
+
type: float
|
|
569
|
+
display: text
|
|
570
|
+
min: -320
|
|
571
|
+
max: 320
|
|
572
|
+
color: blue
|
|
573
|
+
rw: r
|
|
574
|
+
log: true
|
|
575
|
+
units: mV
|
|
576
|
+
duplicates:
|
|
577
|
+
significantdate: 900000
|
|
578
|
+
significantvalue: 1
|
|
579
|
+
graphable: true
|
|
431
580
|
speed:
|
|
432
581
|
leaf: speed
|
|
433
582
|
name: Speed
|
|
@@ -481,6 +630,7 @@ timeoff:
|
|
|
481
630
|
min: 0
|
|
482
631
|
max: 3600
|
|
483
632
|
type: float
|
|
633
|
+
log: false
|
|
484
634
|
display: text
|
|
485
635
|
color: black
|
|
486
636
|
rw: w
|
|
@@ -492,6 +642,7 @@ timeon:
|
|
|
492
642
|
min: 0
|
|
493
643
|
max: 3600
|
|
494
644
|
type: float
|
|
645
|
+
log: false
|
|
495
646
|
display: text
|
|
496
647
|
color: black
|
|
497
648
|
rw: w
|
|
@@ -512,19 +663,50 @@ tvoc:
|
|
|
512
663
|
significantdate: 900000
|
|
513
664
|
significantvalue: 1
|
|
514
665
|
graphable: true
|
|
666
|
+
ultrasonic:
|
|
667
|
+
leaf: ultrasonic
|
|
668
|
+
name: Distance
|
|
669
|
+
type: float
|
|
670
|
+
display: bar
|
|
671
|
+
min: 0
|
|
672
|
+
max: 7500
|
|
673
|
+
color: blue
|
|
674
|
+
rw: r
|
|
675
|
+
log: true
|
|
676
|
+
units: mm
|
|
677
|
+
duplicates:
|
|
678
|
+
significantdate: 900000
|
|
679
|
+
significantvalue: 5
|
|
680
|
+
graphable: true
|
|
681
|
+
calibrate: true
|
|
682
|
+
utc_time:
|
|
683
|
+
leaf: utc_time
|
|
684
|
+
name: UTC Time
|
|
685
|
+
type: text
|
|
686
|
+
log: false
|
|
687
|
+
display: text
|
|
688
|
+
color: black
|
|
689
|
+
rw: r
|
|
515
690
|
wifibars:
|
|
516
691
|
leaf: wifibars
|
|
517
692
|
name: WiFi
|
|
518
693
|
type: int
|
|
694
|
+
log: true
|
|
519
695
|
display: text
|
|
520
696
|
min: 0
|
|
521
697
|
max: 4
|
|
522
698
|
color: blue
|
|
523
699
|
rw: r
|
|
700
|
+
# Logged, because an int that is read-only is logged unless told otherwise. Only 5 values, so
|
|
701
|
+
# any change is worth recording and nothing else is
|
|
702
|
+
duplicates:
|
|
703
|
+
significantdate: 900000
|
|
704
|
+
significantvalue: 1
|
|
524
705
|
wifissid:
|
|
525
706
|
leaf: wifissid
|
|
526
707
|
name: SSID
|
|
527
708
|
type: text
|
|
709
|
+
log: false
|
|
528
710
|
display: text
|
|
529
711
|
color: blue
|
|
530
712
|
rw: r
|
package/config.d/server.yaml
CHANGED
|
@@ -1,12 +1,45 @@
|
|
|
1
1
|
port: 8080
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
# Log every HTTP request. Off here because the usual installation runs from an SD card, where each
|
|
4
|
+
# line logged is a write and writes wear the card out. Set it to true (or to a morgan format
|
|
5
|
+
# string) while debugging. A server whose server.yaml does not mention morgan at all logs requests,
|
|
6
|
+
# so this setting arriving in a new release never quietens a machine that was logging before.
|
|
7
|
+
morgan: false
|
|
8
|
+
|
|
9
|
+
# Where the web client is. Installed with npm it is a dependency, so it is here:
|
|
4
10
|
htmldir: ./node_modules/frugal-iot-client
|
|
5
|
-
#
|
|
11
|
+
# To work on the client, either point this at your checkout of it
|
|
6
12
|
#htmldir: ../frugal-iot-client
|
|
7
|
-
#
|
|
13
|
+
# or, better, leave this line alone and link the checkout in, which needs no edit here and so
|
|
14
|
+
# nothing to remember to change back:
|
|
15
|
+
# cd ../frugal-iot-client && npm link
|
|
16
|
+
# cd ../frugal-iot-server && npm link frugal-iot-client
|
|
17
|
+
#
|
|
18
|
+
# nodemodulesdir is where the libraries the client loads (chart.js, luxon ...) are served from.
|
|
19
|
+
# It does not normally need setting: the server looks inside htmldir first and then here, which
|
|
20
|
+
# covers both an npm install (libraries hoisted to this directory) and a checkout (libraries in
|
|
21
|
+
# the checkout's own node_modules). Set it only if yours are somewhere else again.
|
|
22
|
+
#nodemodulesdir: ./node_modules
|
|
23
|
+
|
|
8
24
|
# The path to the private directory is relative to the server's working directory.
|
|
9
25
|
privatedir: ./private
|
|
10
26
|
publicdir: ./public
|
|
11
27
|
datadir: ./data
|
|
12
28
|
otadir: ./ota
|
|
29
|
+
|
|
30
|
+
# Looking after the readings in datadir, once a day. Readings are one file per topic per day and
|
|
31
|
+
# nothing used to remove them, so a server left running would eventually fill its disk and stop.
|
|
32
|
+
housekeeping:
|
|
33
|
+
# Compress days older than this. A day's file never changes once the day is over, and they
|
|
34
|
+
# compress to about a third. Nothing else needs to know - the server answers a request for a
|
|
35
|
+
# ".csv" with the ".csv.gz" when that is what it has. Never less than 2 days, whatever is set
|
|
36
|
+
# here, because the logger is still writing to today's file and possibly yesterday's.
|
|
37
|
+
compressafterdays: 2
|
|
38
|
+
# Delete readings older than this many days. 0 keeps them for ever, which is the default -
|
|
39
|
+
# deleting is not something to start doing to somebody's data without being asked.
|
|
40
|
+
deleteafterdays: 0
|
|
41
|
+
# Whatever the setting above, if the disk falls below this percentage free, the oldest days are
|
|
42
|
+
# deleted until it is back above. This is the safety net that stops a full card taking the
|
|
43
|
+
# machine down; set it to 0 to turn even that off and let the disk fill.
|
|
44
|
+
freespacepercent: 10
|
|
45
|
+
# enabled: false # turns all of the above off
|
package/extras/mosquitto.conf
CHANGED
|
@@ -7,4 +7,12 @@ protocol websockets
|
|
|
7
7
|
# which belongs to root. Both the broker and mosquitto_passwd warn unless the file belongs to
|
|
8
8
|
# whoever opened it, and mosquitto_passwd also writes a temporary backup beside it, so the
|
|
9
9
|
# directory has to be writable by that same user. See INSTALLATION.md step A5.
|
|
10
|
-
password_file /var/lib/mosquitto/passwords
|
|
10
|
+
password_file /var/lib/mosquitto/passwords
|
|
11
|
+
|
|
12
|
+
# A node on a weak WiFi signal reconnects often, and each connection and disconnection would be a
|
|
13
|
+
# line in /var/log/mosquitto/mosquitto.log. On an SD card those writes wear the card out, and
|
|
14
|
+
# nothing is lost by dropping them, since the readings themselves are recorded by the server.
|
|
15
|
+
# Comment this out while working out why a particular node keeps dropping off the network.
|
|
16
|
+
# Everything else the broker reports, including why it refused to start, is unaffected - that log is
|
|
17
|
+
# the only place some of those failures appear, so it stays.
|
|
18
|
+
connection_messages false
|