forked from TheThingsNetwork/lorawan-devices
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windsensor-codec.yaml
66 lines (64 loc) · 1.61 KB
/
windsensor-codec.yaml
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
# Uplink decoder decodes binary data uplink into a JSON object (optional)
# For documentation on writing encoders and decoders, see: https://www.thethingsindustries.com/docs/integrations/payload-formatters/javascript/
uplinkDecoder:
fileName: windsensor.js
# Examples (optional)
examples:
- description: 32 knots from the North
input:
fPort: 1
bytes: [0, 32]
output:
data:
direction: 'N'
speed: 32
# Normalized output, uses the normalizeUplink function (optional)
normalizedOutput:
data:
- wind:
speed: 16.4608
direction: 0
- description: 42 knots from the East
input:
fPort: 1
bytes: [1, 42]
output:
data:
direction: 'E'
speed: 42
- description: Unknown FPort
input:
fPort: 42
bytes: [1, 42]
output:
errors:
- unknown FPort
# Downlink encoder encodes JSON object into a binary data downlink (optional)
downlinkEncoder:
fileName: windsensor.js
examples:
- description: Turn green
input:
data:
led: green
output:
bytes: [1]
fPort: 2
- description: Invalid color
input:
data:
led: blue
output:
errors:
- invalid LED color
# Downlink decoder decodes the encoded downlink message (optional, must be symmetric with downlinkEncoder)
downlinkDecoder:
fileName: windsensor.js
examples:
- description: Turn green
input:
fPort: 2
bytes: [1]
output:
data:
led: green