-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
schema.go
357 lines (296 loc) · 11.3 KB
/
schema.go
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
package data
// define common node and point types that have special meaning in
// the system.
const (
// general point types
PointTypeChannel = "channel"
PointTypeDevice = "device"
PointTypeDescription = "description"
PointTypeFilePath = "filePath"
PointTypeNodeType = "nodeType"
PointTypeTombstone = "tombstone"
PointTypeScale = "scale"
PointTypeOffset = "offset"
PointTypeUnits = "units"
PointTypeValue = "value"
PointTypeValueSet = "valueSet"
PointTypeIndex = "index"
PointTypeTagPointType = "tagPointType"
PointTypeTag = "tag"
// PointTypeID typically refers to Node ID
PointTypeID = "id"
PointTypeAddress = "address"
PointTypeDebug = "debug"
PointTypeInitialized = "initialized"
PointTypePollPeriod = "pollPeriod"
PointTypeError = "error"
PointTypeErrorCount = "errorCount"
PointTypeErrorCountReset = "errorCountReset"
PointTypeErrorCountEOF = "errorCountEOF"
PointTypeErrorCountEOFReset = "errorCountEOFReset"
PointTypeErrorCountCRC = "errorCountCRC"
PointTypeErrorCountCRCReset = "errorCountCRCReset"
PointTypeErrorCountHR = "errorCountHR"
PointTypeErrorCountResetHR = "errorCountResetHR"
PointTypeSyncCount = "syncCount"
PointTypeSyncCountReset = "syncCountReset"
PointTypeReadOnly = "readOnly"
PointTypeURI = "uri"
PointTypeDisabled = "disabled"
PointTypeControlled = "controlled"
PointTypePeriod = "period"
// An device node describes an phyical device -- it may be the
// cloud server, gateway, etc
NodeTypeDevice = "device"
PointTypeCmdPending = "cmdPending"
PointTypeSwUpdateState = "swUpdateState"
PointTypeStartApp = "startApp"
PointTypeStartSystem = "startSystem"
PointTypeUpdateOS = "updateOS"
PointTypeUpdateApp = "updateApp"
PointTypeSysState = "sysState"
PointValueSysStateUnknown = "unknown"
PointValueSysStatePowerOff = "powerOff"
PointValueSysStateOffline = "offline"
PointValueSysStateOnline = "online"
PointTypeSwUpdateRunning = "swUpdateRunning"
PointTypeSwUpdateError = "swUpdateError"
PointTypeSwUpdatePercComplete = "swUpdatePercComplete"
PointTypeVersionOS = "versionOS"
PointTypeVersionApp = "versionApp"
PointTypeVersionHW = "versionHW"
// user node describes a system user and is used to control
// access to the system (typically through web UI)
NodeTypeUser = "user"
PointTypeFirstName = "firstName"
PointTypeLastName = "lastName"
PointTypePhone = "phone"
PointTypeEmail = "email"
PointTypePass = "pass"
// user edge points
PointTypeRole = "role"
PointValueRoleAdmin = "admin"
PointValueRoleUser = "user"
// User Authentication
NodeTypeJWT = "jwt"
PointTypeToken = "token"
// modbus nodes
// in modbus land, terminology is a big backwards, client is master,
// and server is slave.
NodeTypeModbus = "modbus"
PointTypeClientServer = "clientServer"
PointValueClient = "client"
PointValueServer = "server"
PointTypePort = "port"
PointTypeBaud = "baud"
PointTypeHRDest = "hrDest"
PointTypeProtocol = "protocol"
PointValueRTU = "RTU"
PointValueTCP = "TCP"
NodeTypeModbusIO = "modbusIo"
// FIXME, should we change modbusIoType to ioType?
PointTypeModbusIOType = "modbusIoType"
PointValueModbusDiscreteInput = "modbusDiscreteInput"
PointValueModbusCoil = "modbusCoil"
PointValueModbusInputRegister = "modbusInputRegister"
PointValueModbusHoldingRegister = "modbusHoldingRegister"
PointTypeDataFormat = "dataFormat"
PointValueUINT16 = "uint16"
PointValueINT16 = "int16"
PointValueUINT32 = "uint32"
PointValueINT32 = "int32"
PointValueFLOAT32 = "float32"
NodeTypeOneWire = "oneWire"
NodeTypeOneWireIO = "oneWireIO"
// A group node is used to group users and devices
// or generally to add structure to the node graph.
NodeTypeGroup = "group"
NodeTypeDb = "db"
PointTypeBucket = "bucket"
PointTypeOrg = "org"
// a rule node describes a rule that may run on the system
NodeTypeRule = "rule"
PointTypeActive = "active"
NodeTypeCondition = "condition"
PointTypeConditionType = "conditionType"
PointValuePointValue = "pointValue"
PointValueSchedule = "schedule"
PointTypeNodeID = "nodeID"
PointTypeTrigger = "trigger"
PointTypeStart = "start"
PointTypeEnd = "end"
PointTypeWeekday = "weekday"
PointTypeDate = "date"
PointTypePointID = "pointID"
PointTypePointKey = "pointKey"
PointTypePointType = "pointType"
PointTypePointIndex = "pointIndex"
PointTypeValueType = "valueType"
PointValueNumber = "number"
PointValueOnOff = "onOff"
PointValueText = "text"
PointTypeOperator = "operator"
PointValueGreaterThan = ">"
PointValueLessThan = "<"
PointValueEqual = "="
PointValueNotEqual = "!="
PointValueOn = "on"
PointValueOff = "off"
PointValueContains = "contains"
PointTypeValueText = "valueText"
PointTypeMinActive = "minActive"
NodeTypeAction = "action"
NodeTypeActionInactive = "actionInactive"
PointTypeAction = "action"
PointValueNotify = "notify"
PointValueSetValue = "setValue"
PointValuePlayAudio = "playAudio"
// Transient points that are used for notifications, etc.
// These points are not stored in the state of any node,
// but are recorded in the time series database to record history.
PointMsgAll = "msgAll"
PointMsgUser = "msgUser"
NodeTypeMsgService = "msgService"
PointTypeService = "service"
PointValueTwilio = "twilio"
PointValueSMTP = "smtp"
PointTypeSID = "sid"
PointTypeAuthToken = "authToken"
PointTypeFrom = "from"
NodeTypeVariable = "variable"
PointTypeVariableType = "variableType"
NodeTypeSync = "sync"
PointTypeMetricNatsCycleNodePoint = "metricNatsCycleNodePoint"
PointTypeMetricNatsCycleNodeEdgePoint = "metricNatsCycleNodeEdgePoint"
PointTypeMetricNatsCycleNode = "metricNatsCycleNode"
PointTypeMetricNatsCycleNodeChildren = "metricNatsCycleNodeChildren"
PointTypeMetricNatsPendingNodePoint = "metricNatsPendingNodePoint"
PointTypeMetricNatsPendingNodeEdgePoint = "metricNatsPendingNodeEdgePoint"
PointTypeMetricNatsThroughputNodePoint = "metricNatsThroughputNodePoint"
PointTypeMetricNatsThroughputNodeEdgePoint = "metricNatsThroughputNodeEdgePoint"
// serial MCU clients
NodeTypeSerialDev = "serialDev"
PointTypeRx = "rx"
PointTypeTx = "tx"
PointTypeHrRx = "hrRx"
PointTypeRxReset = "rxReset"
PointTypeTxReset = "txReset"
PointTypeHrRxReset = "hrRxReset"
PointTypeLog = "log"
PointTypeUptime = "uptime"
PointTypeMaxMessageLength = "maxMessageLength"
PointTypeSyncParent = "syncParent"
// CAN bus clients
NodeTypeCanBus = "canBus"
PointTypeBitRate = "bitRate"
PointTypeMsgsInDb = "msgsInDb"
PointTypeSignalsInDb = "signalsInDb"
PointTypeMsgsRecvdDb = "msgsRecvdDb"
PointTypeMsgsRecvdDbReset = "msgsRecvdDbReset"
PointTypeMsgsRecvdOther = "msgsRecvdOther"
PointTypeMsgsRecvdOtherReset = "msgsRecvdOtherReset"
NodeTypeSignalGenerator = "signalGenerator"
PointTypeSignalType = "signalType"
PointTypeMinValue = "minValue"
PointTypeMaxValue = "maxValue"
PointTypeInitialValue = "initialValue"
PointTypeRoundTo = "roundTo"
PointTypeSampleRate = "sampleRate"
PointTypeDestination = "destination"
PointTypeBatchPeriod = "batchPeriod"
PointTypeFrequency = "frequency"
PointTypeMinIncrement = "minIncrement"
PointTypeMaxIncrement = "maxIncrement"
NodeTypeFile = "file"
PointTypeName = "name"
PointTypeData = "data"
PointTypeRate = "rate"
PointTypeRateHR = "rateHR"
NodeTypeMetrics = "metrics"
PointTypeType = "type"
PointValueApp = "app"
PointValueProcess = "process"
PointValueAllProcesses = "allProcesses"
PointValueSystem = "system"
PointTypeCount = "count"
// Sys Metrics
PointTypeMetricSysLoad = "metricSysLoad"
PointTypeMetricSysCPUPercent = "metricSysCPUPercent"
PointTypeMetricSysMem = "metricSysMem"
PointTypeMetricSysMemUsedPercent = "metricSysMemUsedPercent"
PointTypeMetricSysDiskUsedPercent = "metricSysDiskUsedPercent"
PointTypeMetricSysNetBytesRecv = "metricSysNetBytesRecv"
PointTypeMetricSysNetBytesSent = "metricSysNetBytesSent"
PointTypeMetricSysUptime = "metricSysUptime"
// App Metrics
PointTypeMetricAppAlloc = "metricAppAlloc"
PointTypeMetricAppNumGoroutine = "metricAppNumGoroutine"
// process metrics
PointTypeMetricProcCPUPercent = "metricProcCPUPercent"
PointTypeMetricProcMemPercent = "metricProcMemPercent"
PointTypeMetricProcMemRSS = "metricProcMemRSS"
PointTypeHost = "host"
PointTypeHostBootTime = "hostBootTime"
PointKeyHostname = "hostname"
PointKeyOS = "os"
PointKeyPlatform = "platform"
PointKeyPlatformFamily = "platformFamily"
PointKeyPlatformVersion = "platformVersion"
PointKeyKernelVersion = "kernelVersion"
PointKeyKernelArch = "kernelArch"
PointKeyVirtualizationSystem = "virtualizationSystem"
PointKeyVirtualizationRole = "virtualizationRole"
PointKeyUsedPercent = "usedPercent"
PointKeyTotal = "total"
PointKeyAvailable = "available"
PointKeyUsed = "used"
PointKeyFree = "free"
NodeTypeShelly = "shelly"
NodeTypeShellyIo = "shellyIo"
PointTypeSwitch = "switch"
PointTypeSwitchSet = "switchSet"
PointTypeInput = "input"
PointTypeLight = "light"
PointTypeLightSet = "lightSet"
PointTypeDeviceID = "deviceID"
PointTypeIP = "ip"
PointTypeVoltage = "voltage"
PointTypeCurrent = "current"
PointTypePower = "power"
PointTypeTemperature = "temp"
PointTypeBrightness = "brightness"
PointTypeWhite = "white"
PointTypeLightTemp = "lightTemp"
PointTypeTransition = "transition"
PointTypeOffline = "offline"
PointValueShellyTypeBulbDuo = "BulbDuo"
PointValueShellyTypeRGBW2 = "rgbw2"
PointValueShellyType1PM = "1pm"
PointValueShellyTypePlugUS = "PlugUS"
PointValueShellyTypePlugUK = "PlugUK"
PointValueShellyTypePlugIT = "PlugIT"
PointValueShellyTypePlugS = "PlugS"
PointValueShellyTypeI4 = "PlusI4"
PointValueShellyTypePlus1 = "Plus1"
PointValueShellyTypePlus2PM = "Plus2PM"
PointTypeTimeSync = "timeSync"
PointTypeConnected = "connected"
NodeTypeNetworkManager = "networkManager"
NodeTypeNetworkManagerDevice = "networkManagerDevice"
NodeTypeNetworkManagerConn = "networkManagerConn"
NodeTypeNTP = "ntp"
PointTypeServer = "server"
PointTypeFallbackServer = "fallbackServer"
NodeTypeUpdate = "update"
PointTypeOSUpdate = "osUpdate"
PointTypeAppUpdate = "appUpdate"
PointTypePrefix = "prefix"
PointTypeDownloadOS = "downloadOS"
PointTypeOSDownloaded = "osDownloaded"
PointTypeDiscardDownload = "discardDownload"
PointTypeReboot = "reboot"
PointTypeAutoReboot = "autoReboot"
PointTypeAutoDownload = "autoDownload"
PointTypeDirectory = "directory"
PointTypeRefresh = "refresh"
)