foist
[kismet-logviewer.git] / logviewer / static / js / kismet.ui.rtl433.js
1
2 "use strict";
3
4 /* Highlight rtl devices */
5 kismet_ui.AddDeviceRowHighlight({
6     name: "RTL433 Devices",
7     description: "RTL433 Sensor",
8     priority: 100,
9     defaultcolor: "#ffb3cc",
10     defaultenable: true,
11     fields: [
12         'kismet.device.base.phyname'
13     ],
14     selector: function(data) {
15         return data['kismet.device.base.phyname'] === "RTL433";
16     }
17 });
18
19 kismet_ui.AddDeviceDetail("rtl433", "RTL-433 (SDR)", 0, {
20     filter: function(data) {
21         return (data['kismet.device.base.phyname'] === "RTL433");
22     },
23     draw: function(data, target) {
24         target.devicedata(data, {
25             "id": "rtl433Data",
26             "fields": [
27             {
28                 field: "rtl433.device/rtl433.device.common/rtl433.device.model",
29                 title: "Model",
30                 empty: "<i>Unknown</i>"
31             },
32             {
33                 field: "rtl433.device/rtl433.device.common/rtl433.device.id",
34                 title: "Device ID",
35                 empty: "<i>Unknown</i>"
36             },
37             {
38                 field: "rtl433.device/rtl433.device.common/rtl433.device.rtlchannel",
39                 title: "Channel",
40                 filterOnZero: true,
41             },
42             {
43                 field: "rtl433.device/rtl433.device.common/rtl433.device.battery",
44                 title: "Battery",
45                 filterOnEmpty: true,
46             },
47             {
48                 field: "rtl433.device/rtl433.device.thermometer",
49                 groupTitle: "Thermometer",
50                 id: "group_therm_data",
51                 filterOnEmpty: true,
52                 fields: [
53                 {
54                     field: "rtl433.device/rtl433.device.thermometer/rtl433.device.temperature",
55                     title: "Temperature",
56                     filterOnEmpty: true,
57                     render: function(opts) {
58                         return kismet_ui.renderTemperature(opts['value'], 2);
59                     }
60                 },
61                 {
62                     field: "rtl433.device/rtl433.device.thermometer/rtl433.device.humidity",
63                     title: "Humidity (%)",
64                     filterOnEmpty: true,
65                     filterOnZero: true,
66                     render: function(opts) {
67                         return opts['value'] + "%";
68                     }
69                 },
70                 ]
71             },
72             {
73                 field: "rtl433.device/rtl433.device.weatherstation",
74                 groupTitle: "Weather",
75                 id: "group_weather_data",
76                 filterOnEmpty: true,
77                 fields: [
78                 {
79                     field: "rtl433.device/rtl433.device.weatherstation/rtl433.device.wind_dir",
80                     title: "Wind Direction",
81                     filterOnEmpty: true,
82                     render: function(opts) {
83                         var rv = opts['value'] + "&deg; (" + 
84                             kismet_ui.DegToDir(opts['value']) + ")";
85
86                         /*
87                         rv += '<br>';
88
89                         rv += '<span class="fa-stack" style="font-size: 16pt;">';
90                         rv += '<i class="fa fa-stack-1x fa-circle-o" />';
91                         rv += '<i class="fa fa-stack-1x fa-chevron-up" style="' +
92                             '-ms-transform: rotate(' + opts['value'] + 'deg);' +
93                             '-webkit-transform: rotate(' + opts['value'] + 'deg);' +
94                             'transform: rotate(' + opts['value'] + 'deg);' +
95                             '" />';
96                         rv += '</span>';
97                         */
98
99                         return rv;
100                     }
101                 },
102                 {
103                     field: "rtl433.device/rtl433.device.weatherstation/rtl433.device.wind_speed",
104                     title: "Wind Speed",
105                     filterOnEmpty: true,
106                     render: function(opts) {
107                         return kismet_ui.renderSpeed(opts['value'], 2);
108                     }
109                 },
110                 {
111                     field: "rtl433.device/rtl433.device.weatherstation/rtl433.device.wind_gust",
112                     title: "Wind Gust",
113                     filterOnEmpty: true,
114                     render: function(opts) {
115                         return kismet_ui.renderSpeed(opts['value'], 2);
116                     }
117                 },
118                 {
119                     field: "rtl433.device/rtl433.device.weatherstation/rtl433.device.rain",
120                     title: "Rain",
121                     filterOnEmpty: true
122                 },
123                 ]
124             },
125             {
126                 field: "rtl433.device/rtl433.device.tpms",
127                 groupTitle: "Tire pressure",
128                 id: "group_tpms_data",
129                 filterOnEmpty: true,
130                 fields: [
131                 {
132                     field: "rtl433.device/rtl433.device.tpms/rtl433.device.tpms.pressure_bar",
133                     title: "Pressure",
134                     filterOnZero: true,
135                     render: function(opts) {
136                         return opts['value'] + " bar";
137                     },
138                     help: "Reported TPMS pressure in bars",
139                 },
140                 {
141                     field: "rtl433.device/rtl433.device.tpms/rtl433.device.tpms.pressure_kpa",
142                     title: "Pressure",
143                     filterOnZero: true,
144                     render: function(opts) {
145                         return opts['value'] + " kPa";
146                     },
147                     help: "Reported TPMS pressure in kPa",
148                 },
149                 ]
150             },
151             {
152                 field: "rtl433.device/rtl433.device.switch",
153                 groupTitle: "Switch",
154                 id: "group_switch_data",
155                 filterOnEmpty: true,
156                 fields: [
157                 {
158                     field: "rtl433.device/rtl433.device.switch/rtl433.device.switch.1",
159                     title: "Switch 1",
160                     filterOnEmpty: true,
161                     render: function(opts) {
162                         return opts['value'];
163                     }
164                 },
165                 {
166                     field: "rtl433.device/rtl433.device.switch/rtl433.device.switch.2",
167                     title: "Switch 2",
168                     filterOnEmpty: true,
169                     render: function(opts) {
170                         return opts['value'];
171                     }
172                 },
173                 {
174                     field: "rtl433.device/rtl433.device.switch/rtl433.device.switch.3",
175                     title: "Switch 3",
176                     filterOnEmpty: true,
177                     render: function(opts) {
178                         return opts['value'];
179                     }
180                 },
181                 {
182                     field: "rtl433.device/rtl433.device.switch/rtl433.device.switch.4",
183                     title: "Switch 4",
184                     filterOnEmpty: true,
185                     render: function(opts) {
186                         return opts['value'];
187                     }
188                 },
189                 {
190                     field: "rtl433.device/rtl433.device.switch/rtl433.device.switch.5",
191                     title: "Switch 5",
192                     filterOnEmpty: true,
193                     render: function(opts) {
194                         return opts['value'];
195                     }
196                 },
197                 ]
198             },
199             {
200                 field: "rtl433.device/rtl433.device.lightningsensor",
201                 groupTitle: "Lightning Sensor",
202                 id: "group_lightning_data",
203                 filterOnEmpty: true,
204                 fields: [
205                 {
206                     field: "rtl433.device/rtl433.device.lightningsensor/rtl433.device.lightning_strike_count",
207                     title: "Strike Count",
208                     filterOnEmpty: true,
209                     help: "Last reported lighting strike count (may reset arbitrarily)"
210                 },
211                 {
212                     field: "rtl433.device/rtl433.device.lightningsensor/rtl433.device.lightning_storm_active",
213                     title: "Storm Active",
214                     filterOnEmpty: true,
215                     help: "Storm currently active",
216                     render: function(opts) {
217                         if (opts['value'])
218                             return "Active";
219                         return "Inactive";
220                     }
221                 },
222                 {
223                     field: "rtl433.device/rtl433.device.lightningsensor/rtl433.device.lightning_rfi",
224                     title: "RFI",
225                     filterOnEmpty: true,
226                     help: "Radio Frequency Interference from lightning activity"
227                 },
228                 {
229                     field: "rtl433.device/rtl433.device.lightningsensor/rtl433.device.lightning_storm_distance",
230                     title: "Storm distance",
231                     filterOnEmpty: true,
232                     help: "Estimated storm distance (no distance units provided)"
233                 },
234                 ]
235             },
236
237             ],
238         });
239     },
240 });
241