-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
311 lines (291 loc) · 13.6 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="description" content="Enttoi : Documentation">
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>Enttoi</title>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<a id="forkme_banner" href="https://github.com/Enttoi">View on GitHub</a>
<h1 id="project_title">Enttoi</h1>
<h2 id="project_tagline">Documentation</h2>
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<h3>
<a id="overview" class="anchor" href="#overview" aria-hidden="true"><span class="octicon octicon-link"></span></a>Overview
</h3>
<p>Enttoi is system that collects sensors data, push them to centralized place, which allows to see their state in real-time and gather statistics.</p>
<p>There is a blog post that goes into details of the project <a href="https://blog.jenyay.com/enttoi-project/">here</a>.</p>
<p>
Her is a high level architecture of the system:
<a href="images/architecture_diagram.png" title="Enttoi Architecture">
<img src="images/architecture_diagram.png" alt="Enttoi Architecture">
</a>
</p>
<p>
Above building blocks mapped to repositories with their source code:
<ul>
<li><a href="https://github.com/Enttoi/enttoi-client-rpi" target="_blank">Rpi client</a> or <a href="https://github.com/Enttoi/enttoi-client-server-arduino">Arduino client-server</a>, or any other that capable to send sensors state to HTTP endpoint.</li>
<li><a href="https://github.com/Enttoi/enttoi-gateway" target="_blank">Gateway</a> - endpoint for all clients/sensors; receives their states, figures out whether it was changed and based on it persist it and sends notification to MQ.</li>
<li><a href="https://github.com/Enttoi/enttoi-jobs/tree/master/src/ClientsState" target="_blank">State processing</a> - background job to monitor availbility of clients. If a client didn't report state or keep alive during some period it will notify that the client went offline. </li>
<li><a href="https://github.com/Enttoi/enttoi-jobs/tree/master/src/HistoryWriter" target="_blank">History writer</a> - monitors queues and writes all changes to state of clients and sensors.</li>
<li><a href="https://github.com/Enttoi/enttoi-jobs/tree/master/src/SensorStateStats" target="_blank">History processing</a> - converts historical data to queryable statistics data.</li>
<li><a href="https://github.com/Enttoi/enttoi-api" target="_blank">API</a> - expose meta data, states data and statistics via REST and websocket.</li>
<li><a href="https://github.com/Enttoi/enttoi-ui-web" target="_blank">Web client</a> - exposes API's data via web interface.</li>
</ul>
</p>
<h3>
<a id="data-modeling" class="anchor" href="#data-modeling" aria-hidden="true"><span class="octicon octicon-link"></span></a>Data Modeling
</h3>
<p>
The data resides into two storage types:
<ul>
<li>
<i>Storage tables</i> - store raw data as it received from sensors.
<table class="compact">
<caption>SensorsHistory</caption>
<tr>
<th>Field</th>
<th>[Structure]/Type/"Value"</th>
</tr>
<tr>
<td>Partition Key</td>
<td>[ClientId]_[SensorType]_[SensorId]</td>
</tr>
<tr>
<td>Row Key</td>
<td>Timestamp in Unix format</td>
</tr>
<tr>
<td>ClientId</td>
<td>String (Guid)</td>
</tr>
<tr>
<td>SensorType</td>
<td>String</td>
</tr>
<tr>
<td>SensorId</td>
<td>Int32</td>
</tr>
<tr>
<td>State</td>
<td>Int32</td>
</tr>
<tr>
<td>TimeStamp</td>
<td>DateTime</td>
</tr>
</table>
<table class="compact">
<caption>SensorsState</caption>
<tr>
<th>Field</th>
<th>[Structure]/Type/"Value"</th>
</tr>
<tr>
<td>Partition Key</td>
<td>[ClientID]</td>
</tr>
<tr>
<td>Row Key</td>
<td>[SensorType]_[SensorID]</td>
</tr>
<tr>
<td>ClientId</td>
<td>String (Guid)</td>
</tr>
<tr>
<td>SensorType</td>
<td>String</td>
</tr>
<tr>
<td>SensorId</td>
<td>Int32</td>
</tr>
<tr>
<td>State</td>
<td>Int32</td>
</tr>
<tr>
<td>TimeStamp</td>
<td>DateTime</td>
</tr>
<tr>
<td>PreviousState</td>
<td>Int32</td>
</tr>
<tr>
<td>PreviousStateDurationMs</td>
<td>Int32</td>
</tr>
</table>
<table class="compact">
<caption>ClientState</caption>
<tr>
<th>Field</th>
<th>[Structure]/Type/"Value"</th>
</tr>
<tr>
<td>Partition Key</td>
<td>[SensorId]</td>
</tr>
<tr>
<td>Row Key</td>
<td>"LastPing"</td>
</tr>
<tr>
<td>ClientId</td>
<td>String</td>
</tr>
<tr>
<td>TimeStamp</td>
<td>DateTime</td>
</tr>
</table>
</li>
<li>
<i>Storage queues</i> - notifies on changes to states.
<table class="compact">
<caption>sensor-state-changed</caption>
<tr>
<th>Property</th>
<th>Type</th>
</tr>
<tr>
<td>clientId</td>
<td>String (Guid)</td>
</tr>
<tr>
<td>sensorType</td>
<td>String</td>
</tr>
<tr>
<td>sensorId</td>
<td>String</td>
</tr>
<tr>
<td>newState</td>
<td>String</td>
</tr>
<tr>
<td>previousState</td>
<td>String</td>
</tr>
<tr>
<td>previousStateDurationMs</td>
<td>Number</td>
</tr>
<tr>
<td>timestamp</td>
<td>DateTime</td>
</tr>
</table>
<table class="compact">
<caption>client-state-changed</caption>
<tr>
<th>Property</th>
<th>Type</th>
</tr>
<tr>
<td>clientId</td>
<td>String (Guid)</td>
</tr>
<tr>
<td>newState</td>
<td>Boolean</td>
</tr>
<tr>
<td>previousStateDurationMs</td>
<td>Number</td>
</tr>
<tr>
<td>timestamp</td>
<td>DateTime</td>
</tr>
</table>
</li>
<li>
<i>DocumentDB</i> - configurations and processed state of clients and sensors
<table class="compact">
<caption>ClientsCollection</caption>
<tr>
<th>Property</th>
<th>Type</th>
</tr>
<tr>
<td>id</td>
<td>String (Guid)</td>
</tr>
<tr>
<td>isDisabled</td>
<td>Boolean</td>
</tr>
<tr>
<td>token</td>
<td>String</td>
</tr>
<tr>
<td>tags</td>
<td>Array of string</td>
</tr>
<tr>
<td>isOnline</td>
<td>Boolean</td>
</tr>
<tr>
<td>isOnlineChanged</td>
<td>DateTime</td>
</tr>
<tr>
<td>Sensors</td>
<td>
Array of
<table>
<tr>
<td>sensorType</td>
<td>String</td>
</tr>
<tr>
<td>sensorId</td>
<td>Int32</td>
</tr>
</table>
</td>
</tr>
</table>
</li>
</ul>
</p>
<h3>
<a id="authors-and-contributors" class="anchor" href="#authors-and-contributors" aria-hidden="true"><span class="octicon octicon-link"></span></a>Authors and Contributors
</h3>
<p>All contributers and authors can be found <a href="https://github.com/orgs/Enttoi/people">here</a>.</p>
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p>Published with <a href="https://pages.github.com">GitHub Pages</a></p>
</footer>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-68155422-1");
pageTracker._trackPageview();
} catch (err) { }
</script>
</body>
</html>