forked from uhppoted/uhppoted-mqtt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
686 lines (598 loc) · 41.5 KB
/
Makefile
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
DEBUG ?= --debug
DIST ?= development
CODEGEN ?= ../uhppoted-codegen/bin/uhppoted-codegen
SERIALNO ?= 405419896
CARD ?= 8165538
REQUESTID ?= AH173635G3
CLIENTID ?= QWERTY54
REPLYTO ?= uhppoted/reply/97531
DATETIME = $(shell date "+%Y-%m-%d %H:%M:%S")
.DEFAULT_GOAL := test
.PHONY: clean
.PHONY: update
.PHONY: update-release
.PHONY: docker
all: test \
benchmark \
coverage
clean:
go clean
rm -rf bin
update:
go get -u github.com/uhppoted/uhppote-core@master
go get -u github.com/uhppoted/uhppoted-lib@master
go mod tidy
update-release:
go get -u github.com/uhppoted/uhppote-core
go get -u github.com/uhppoted/uhppoted-lib
go mod tidy
update-all:
go get -u github.com/uhppoted/uhppote-core
go get -u github.com/uhppoted/uhppoted-lib
go get -u github.com/aws/aws-sdk-go
go get -u github.com/eclipse/paho.mqtt.golang
go get -u github.com/gorilla/websocket
go get -u golang.org/x/net
go get -u golang.org/x/sys
go mod tidy
regen:
find .codegen/.models -name "*.json" -exec sh -c 'jq . {} | sponge {}' \;
$(CODEGEN) --models .codegen/.models --templates .codegen/markdown --out documentation/commands --clean
format:
go fmt ./...
build: format
mkdir -p bin
go build -trimpath -o bin ./...
test: build
go test ./...
benchmark: build
go test -bench ./...
coverage: build
go test -cover ./...
vet:
go vet ./...
lint:
env GOOS=darwin GOARCH=amd64 staticcheck ./...
env GOOS=linux GOARCH=amd64 staticcheck ./...
env GOOS=windows GOARCH=amd64 staticcheck ./...
vuln:
govulncheck ./...
build-all: test vet lint
mkdir -p dist/$(DIST)/windows
mkdir -p dist/$(DIST)/darwin
mkdir -p dist/$(DIST)/linux
mkdir -p dist/$(DIST)/arm
mkdir -p dist/$(DIST)/arm7
env GOOS=linux GOARCH=amd64 GOWORK=off go build -trimpath -o dist/$(DIST)/linux ./...
env GOOS=linux GOARCH=arm64 GOWORK=off go build -trimpath -o dist/$(DIST)/arm ./...
env GOOS=linux GOARCH=arm64 GOWORK=off go build -trimpath -o dist/$(DIST)/arm ./...
env GOOS=linux GOARCH=arm GOARM=7 GOWORK=off go build -trimpath -o dist/$(DIST)/arm7 ./...
env GOOS=darwin GOARCH=amd64 GOWORK=off go build -trimpath -o dist/$(DIST)/darwin ./...
env GOOS=windows GOARCH=amd64 GOWORK=off go build -trimpath -o dist/$(DIST)/windows ./...
release: update-release build-all
find . -name ".DS_Store" -delete
tar --directory=dist --exclude=".DS_Store" -cvzf dist/$(DIST).tar.gz $(DIST)
cd dist; zip --recurse-paths $(DIST).zip $(DIST)
publish: release
echo "Releasing version $(VERSION)"
rm -f dist/development.tar.gz
gh release create "$(VERSION)" "./dist/uhppoted-mqtt_$(VERSION).tar.gz" "./dist/uhppoted-mqtt_$(VERSION).zip" --draft --prerelease --title "$(VERSION)-beta" --notes-file release-notes.md
debug: build
mqtt publish --topic 'uhppoted/gateway/requests/device/time-profile:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"profile": { "id": 29, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"weekdays": "Monday,Wednesday,Thursday", \
"segments": [ \
{ "start": "08:15", "end": "11:30" }, \
{ "start": "14:05", "end": "17:45" } \
] } \
}}}'
godoc:
godoc -http=:80 -index_interval=60s
docker:
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -o ./docker ./...
docker image prune -f
docker container prune -f
cd ./docker/ && docker build -f Dockerfile -t uhppoted/mqtt .
docker-run:
docker run --name mqttd --rm uhppoted/mqtt
# docker run --detach --name mqttd --rm uhppoted/mqtt
docker-shell:
docker exec -it mqttd /bin/sh
version: build
./bin/uhppoted-mqtt version
help: build
./bin/uhppoted-mqtt help
./bin/uhppoted-mqtt help commands
./bin/uhppoted-mqtt help version
./bin/uhppoted-mqtt help run
./bin/uhppoted-mqtt help daemonize
./bin/uhppoted-mqtt help undaemonize
./bin/uhppoted-mqtt help config
daemonize: build
sudo ./bin/uhppoted-mqtt daemonize
undaemonize: build
sudo ./bin/uhppoted-mqtt undaemonize
config: build
./bin/uhppoted-mqtt config
run: build
./bin/uhppoted-mqtt run --log-level debug --console
get-devices:
mqtt publish --topic 'uhppoted/gateway/requests/devices:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"nonce": 5 }}}'
get-devices-hotp:
mqtt publish --topic 'uhppoted/gateway/requests/devices:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"hotp": "586787" }}}'
get-devices-rsa:
mqtt publish --topic 'uhppoted/gateway/requests/devices:get' \
--message '{ "message": { "signature": "VXLQgzQOHnjIFW6UFftWBYtdwluM3M7nbQD6fjLdSkuk/L8ahLfHsIEPCQF9ofkqEGaBG2Dl6QJtqYF825z8dLPsxbQA1bgMrdbpiVKiS09Vn4ubONIGmShQKcuoZuAzgsVeNbCsDW2MhSq/f6W/DUlKmD9PwgxMkzeKUCjM8bQ=",\
"request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"nonce": 8 }}}'
get-device:
mqtt publish --topic 'uhppoted/gateway/requests/device:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
get-device-hotp:
mqtt publish --topic 'uhppoted/gateway/requests/device:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"hotp": "586787", \
"nonce": 8, \
"device-id": $(SERIALNO) }}}'
get-device-rsa:
mqtt publish --topic 'uhppoted/gateway/requests/device:get' \
--message '{ "message": { "signature": "Dd6qGX0lvKA4i0jltpZry1K6hePCATuC0L1Pv7YkHtTNb9cqP+CI4lTOVlq5uWnKB0kVfqdLSGa6dsCRzzw3VFqojhC1ZG8rQtpg4iFno7S73g7O6jF/UEfQ6jHqwubrxcZI8W2P9bcO5f7UR6aiZt6+/nHJlPTLycQ1jlNeM3c=",\
"request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"nonce": 8, \
"device-id": $(SERIALNO) }}}'
get-device-encrypted:
mqtt publish --topic 'uhppoted/gateway/requests/device:get' \
--message '{ "message": { "key": "LRtq7KaKvsCP8VvaRXRsoc2+R5T8fhZ1x/cjFpknQmEbrtYmxe/5t1MSbRl2BxFRnEvCuGk6n64govDWcTvi58gU2Xn1XIQLOdBlg7Rk5bluEHdwM+nWRVqSBGTBe1UbvKbzeJ8Vm7jCFbYNVeBYDHRTgkfAnb4vpM/3KjYVDXlGLHO75ou16XPSNXyEvKwZUY5mKeAuS6O7igPkwkhdOgI4wUIBeqiKq5710pyOxitCv1b3CJvpo3lUIrwkGVNFn2fEUAEN3kCQUPpAxKeMOazEsRuQHJEm/thbFWIt0HrWE/XuqHtZZU17oAXiIgKioSUUJ6+cpXursNJWmI3nSQ==", \
"signature": "G/3cEtzhZ+5iyms3sWYbh842ZbHYpJxKDrY8whkhlDmlXZis+P2l7PCfSH8l9hIeGvKUvIwL+wrkPkFwIZbNRJ0oYX9F1SXNVyEzjsKZZ6x4dJ57LnyK/YB8ygx/EBsESsSRo81QiBBD7XAHpKgVB/uqRTk9Tgq6J1YLYzyahv8=",\
"request": "EJo5lNjfYl/aSBF2LodYrOpdWISCN4RfsFykVCu3K+OEeXI1r7QouxEwjLvZgsFUH2fK7qehUVyYtcoRdxdin0XS65t1P+Oc7dcrncyfHiJfRjbekEZqXpCG3Z02uTUtl4zss/Z8IAFxdjDmDB0NxsGALgCqhU70dioJgxeFqPyd3uHZi91dlvcWF2nf+Vb+6REEaSCCAEyQQ3BZ/NJUCQ==" \
}, \
"hmac": "5a0d5ffdafc73f8f386e6673faf93b77ca64b8e9ec665a770efacb64258bba27" }'
get-device-encrypted-old:
mqtt publish --topic 'uhppoted/gateway/requests/device:get' \
--message '{ "message": { "key": "LRtq7KaKvsCP8VvaRXRsoc2+R5T8fhZ1x/cjFpknQmEbrtYmxe/5t1MSbRl2BxFRnEvCuGk6n64govDWcTvi58gU2Xn1XIQLOdBlg7Rk5bluEHdwM+nWRVqSBGTBe1UbvKbzeJ8Vm7jCFbYNVeBYDHRTgkfAnb4vpM/3KjYVDXlGLHO75ou16XPSNXyEvKwZUY5mKeAuS6O7igPkwkhdOgI4wUIBeqiKq5710pyOxitCv1b3CJvpo3lUIrwkGVNFn2fEUAEN3kCQUPpAxKeMOazEsRuQHJEm/thbFWIt0HrWE/XuqHtZZU17oAXiIgKioSUUJ6+cpXursNJWmI3nSQ==", \
"iv": "109A3994D8DF625FDA4811762E8758AC",\
"signature": "G/3cEtzhZ+5iyms3sWYbh842ZbHYpJxKDrY8whkhlDmlXZis+P2l7PCfSH8l9hIeGvKUvIwL+wrkPkFwIZbNRJ0oYX9F1SXNVyEzjsKZZ6x4dJ57LnyK/YB8ygx/EBsESsSRo81QiBBD7XAHpKgVB/uqRTk9Tgq6J1YLYzyahv8=",\
"request": "6l1YhII3hF+wXKRUK7cr44R5cjWvtCi7ETCMu9mCwVQfZ8rup6FRXJi1yhF3F2KfRdLrm3U/45zt1yudzJ8eIl9GNt6QRmpekIbdnTa5NS2XjOyz9nwgAXF2MOYMHQ3GwYAuAKqFTvR2KgmDF4Wo/J3e4dmL3V2W9xYXad/5Vv7pEQRpIIIATJBDcFn80lQJ" \
}, \
"hmac": "46410fe2d18183452982ed22cec52dedf843436263d1097074454c3c30caa75a" }'
get-time:
mqtt publish --topic 'uhppoted/gateway/requests/device/time:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
set-time:
mqtt publish --topic 'uhppoted/gateway/requests/device/time:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"date-time": "$(DATETIME)" }}}'
get-door-delay:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/delay:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"door": 3 }}}'
set-door-delay:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/delay:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"door": 3, \
"delay": 8 }}}'
get-door-control:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/control:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"door": 3 }}}'
set-door-control:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/control:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"door": 3, \
"control": "normally closed" }}}'
set-door-passcodes:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/passcodes:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"door": 3, \
"passcodes": [12345,0,99999,54321] }}}'
set-door-interlock:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/interlock:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"interlock": 4 }}}'
activate-keypads:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/keypads:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"keypads": { "1":true, "2":true, "3": false,"4":true } \
}}}'
record-special-events:
mqtt publish --topic 'uhppoted/gateway/requests/device/special-events:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"enabled": true }}}'
get-status:
mqtt publish --topic 'uhppoted/gateway/requests/device/status:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
mqtt publish --topic 'uhppoted/gateway/requests/device/status:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": 303986753 }}}'
get-cards:
mqtt publish --topic 'uhppoted/gateway/requests/device/cards:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
get-card:
mqtt publish --topic 'uhppoted/gateway/requests/device/card:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"card-number": $(CARD) }}}'
put-card:
mqtt publish --topic 'uhppoted/gateway/requests/device/card:put' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"card": { "card-number": $(CARD), \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"doors": { "1":true, "2":false, "3":55, "4":false }, \
"PIN": 7531 } \
}}}'
delete-card:
mqtt publish --topic 'uhppoted/gateway/requests/device/card:delete' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"card-number": $(CARD) }}}'
delete-cards:
mqtt publish --topic 'uhppoted/gateway/requests/device/cards:delete' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
get-time-profile:
mqtt publish --topic 'uhppoted/gateway/requests/device/time-profile:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"profile-id": 29 }}}'
set-time-profile:
mqtt publish --topic 'uhppoted/gateway/requests/device/time-profile:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"profile": { "id": 29, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"weekdays": "Monday,Wednesday,Thursday", \
"segments": [ \
{ "start": "08:15", "end": "11:30" }, \
{ "start": "14:05", "end": "17:45" } \
], \
"linked-profile": 3 } \
}}}'
clear-time-profiles:
mqtt publish --topic 'uhppoted/gateway/requests/device/time-profiles:delete' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
get-time-profiles:
mqtt publish --topic 'uhppoted/gateway/requests/device/time-profiles:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"from": 2, \
"to": 254 }}}'
set-time-profiles:
mqtt publish --topic 'uhppoted/gateway/requests/device/time-profiles:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"profiles": [ \
{ "id": 29, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"weekdays": "Monday,Wednesday,Thursday", \
"segments": [ \
{ "start": "08:15", "end": "11:30" }, \
{ "start": "14:05", "end": "17:45" } \
], \
"linked-profile": 0 }, \
{ "id": 31, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"weekdays": "Monday,Wednesday,Thursday", \
"segments": [ \
{ "start": "08:15", "end": "11:30" }, \
{ "start": "14:05", "end": "17:45" } \
], \
"linked-profile": 0 }, \
{ "id": 32, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"weekdays": "Monday,Wednesday", \
"segments": [ \
{ "start": "08:30", "end": "15:30" } \
], \
"linked-profile": 0 }, \
{ "id": 33, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"weekdays": "Saturday,Sunday", \
"segments": [ \
{ "start": "10:30", "end": "17:30" } \
]} \
]\
}}}'
set-task-list:
mqtt publish --topic 'uhppoted/gateway/requests/device/tasklist:set' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"tasks": [ \
{ \
"task": "enable card, no password", \
"door": 1, \
"start-date": "2023-07-01", \
"end-date": "2023-07-31", \
"weekdays": "Friday", \
"start": "09:50" \
}, \
{ \
"task": "enable card+password", \
"door": 1, \
"start-date": "2023-07-01", \
"end-date": "2023-07-31", \
"weekdays": "Friday", \
"start": "09:55" \
} \
]\
}}}'
get-events:
mqtt publish --topic 'uhppoted/gateway/requests/device/events:get' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO) }}}'
mqtt publish --topic 'uhppoted/gateway/requests/device/events:get' \
--message '{ "message": { "request": { "request-id":"$(REQUESTID)", \
"client-id":"$(CLIENTID)", \
"reply-to":"$(REPLYTO)", \
"device-id":$(SERIALNO), \
"count": 3 }}}'
get-event:
mqtt publish --topic 'uhppoted/gateway/requests/device/event:get' \
--message '{ "message": { "request": { "request-id":"$(REQUESTID)", \
"client-id":"$(CLIENTID)", \
"reply-to":"$(REPLYTO)", \
"device-id":$(SERIALNO), \
"event-index": 50 }}}'
mqtt publish --topic 'uhppoted/gateway/requests/device/event:get' \
--message '{ "message": { "request": { "request-id":"$(REQUESTID)", \
"client-id":"$(CLIENTID)", \
"reply-to":"$(REPLYTO)", \
"device-id":$(SERIALNO), \
"event-index": "first" }}}'
mqtt publish --topic 'uhppoted/gateway/requests/device/event:get' \
--message '{ "message": { "request": { "request-id":"$(REQUESTID)", \
"client-id":"$(CLIENTID)", \
"reply-to":"$(REPLYTO)", \
"device-id":$(SERIALNO), \
"event-index": "last" }}}'
mqtt publish --topic 'uhppoted/gateway/requests/device/event:get' \
--message '{ "message": { "request": { "request-id":"$(REQUESTID)", \
"client-id":"$(CLIENTID)", \
"reply-to":"$(REPLYTO)", \
"device-id":$(SERIALNO), \
"event-index": "current" }}}'
mqtt publish --topic 'uhppoted/gateway/requests/device/event:get' \
--message '{ "message": { "request": { "request-id":"$(REQUESTID)", \
"client-id":"$(CLIENTID)", \
"reply-to":"$(REPLYTO)", \
"device-id":$(SERIALNO), \
"event-index": "next" }}}'
open-door:
mqtt publish --topic 'uhppoted/gateway/requests/device/door/lock:open' \
--message '{ "message": { "request": { "request-id": "$(REQUESTID)", \
"client-id": "$(CLIENTID)", \
"reply-to": "$(REPLYTO)", \
"device-id": $(SERIALNO), \
"card-number": $(CARD), \
"door": 3 }}}'
acl-show:
mqtt publish --topic 'uhppoted/gateway/requests/acl/card:show' \
--message '{ "message": { "request": { \
"card-number": 8165538, \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-grant:
mqtt publish --topic 'uhppoted/gateway/requests/acl/card:grant' \
--message '{ "message": { "request": { \
"card-number": 8165538, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"doors": [ "Gryffindor", "Slytherin" ], \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
mqtt publish --topic 'uhppoted/gateway/requests/acl/card:grant' \
--message '{ "message": { "request": { \
"card-number": 8165538, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"profile": 29, \
"doors": [ "Dungeon" ], \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-revoke:
mqtt publish --topic 'uhppoted/gateway/requests/acl/card:revoke' \
--message '{ "message": { "request": { \
"card-number": 8165538, \
"start-date": "2023-01-01", \
"end-date": "2023-12-31", \
"doors": [ "Dungeon" ], \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-upload-file:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:upload' \
--message '{ "message": { "request": { \
"url": "file://../runtime/uhppoted-mqtt/uhppoted.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-upload-s3:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:upload' \
--message '{ "message": { "request": { \
"url": "s3://uhppoted-test/mqttd/uhppoted.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-upload-http:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:upload' \
--message '{ "message": { "request": { \
"url": "http://localhost:8080/upload/mqttd.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-file:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "file://../runtime/uhppoted-mqtt/hogwarts.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-tsv:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "file://../runtime/uhppoted-mqtt/hogwarts.acl", \
"mime-type": "text/tab-separated-values", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-invalid-file:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "file://../runtime/mqttd/hogwarts-invalid.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-blank-file:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "file://../runtime/mqttd/hogwarts-blank.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-empty-file:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "file://../runtime/mqttd/hogwarts-empty.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-s3:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "s3://uhppoted-test/mqttd/QWERTY54.tar.gz", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-download-http:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:download' \
--message '{ "message": { "request": { \
"url": "https://github.com/uhppoted/uhppoted/blob/master/runtime/simulation/QWERTY54.tar.gz?raw=true", \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-compare-file:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:compare' \
--message '{ "message": { "request": { \
"url": { \
"acl": "file://../runtime/uhppoted-mqtt/hogwarts.tar.gz", \
"report": "file://../runtime/uhppoted-mqtt/report.tar.gz" \
}, \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-compare-s3:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:compare' \
--message '{ "message": { "request": { \
"url": { \
"acl": "s3://uhppoted-test/mqttd/QWERTY54.tar.gz", \
"report": "s3://uhppoted-test/mqttd/report.tar.gz" \
}, \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
acl-compare-http:
mqtt publish --topic 'uhppoted/gateway/requests/acl/acl:compare' \
--message '{ "message": { "request": { \
"url": { \
"acl": "https://github.com/uhppoted/uhppoted/blob/master/runtime/simulation/QWERTY54.tar.gz?raw=true", \
"report": "http://localhost:8080/upload/report.tar.gz" \
}, \
"client-id": "QWERTY54", \
"reply-to": "uhppoted\/reply\/97531", \
"request-id": "AH173635G3" }}}'
delete-retained-messages:
mqtt publish --topic 'uhppoted/gateway/events' --message ''
mqtt publish --topic 'uhppoted/gateway/system' --message ''