| ... | ... |
@@ -28,7 +28,7 @@ broker = None |
| 28 | 28 |
latestHtml = "" |
| 29 | 29 |
previousLastFcnt = 0 |
| 30 | 30 |
|
| 31 |
-def htmlLatest(deveui,subID,FCnt,timeLatest,lat,lon,err,rssi): |
|
| 31 |
+def htmlLatest(deveui,subID,FCnt,timeLatest,lat,lon,err,rssi,comment=None): |
|
| 32 | 32 |
global latestHtml |
| 33 | 33 |
global previousLastFcnt |
| 34 | 34 |
htmlOutput="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n" |
| ... | ... |
@@ -78,6 +78,8 @@ def htmlLatest(deveui,subID,FCnt,timeLatest,lat,lon,err,rssi): |
| 78 | 78 |
htmlOutput+="<div id=\"position\">"+str(lat)+"° "+str(lon)+"° "+str(err)+"m</div>\n" |
| 79 | 79 |
htmlOutput+="<div id=\"rssi\">"+str(rssi)+"dB</div>\n" |
| 80 | 80 |
htmlOutput+="<div id=\"delta\">Δ: "+str(FCnt-previousLastFcnt)+"</div>\n" |
| 81 |
+ if comment is not None: |
|
| 82 |
+ htmlOutput+="<div id=\"comment\">"+comment+"</div>\n" |
|
| 81 | 83 |
previousLastFcnt = FCnt |
| 82 | 84 |
htmlOutput+="</p>\n" |
| 83 | 85 |
htmlOutput+="<p>\n<div id=\"reload\"><button class=\"btn-green\" onClick=\"window.location.reload();\">Reload</div>\n</p>\n" |
| ... | ... |
@@ -101,6 +103,7 @@ def on_message(client, userdata, msg): |
| 101 | 103 |
if "uplink" in msg.topic: |
| 102 | 104 |
csvLine="" |
| 103 | 105 |
#print("Uplink received for SubID: "+parseTopic[1]+" and DevEUI: "+parseTopic[3])
|
| 106 |
+ #print(json_data) |
|
| 104 | 107 |
try: |
| 105 | 108 |
parsed=json.loads(json_data) |
| 106 | 109 |
pattern = '%Y-%m-%dT%H:%M:%S.%f%z' |
| ... | ... |
@@ -138,10 +141,12 @@ def on_message(client, userdata, msg): |
| 138 | 141 |
except: |
| 139 | 142 |
#warn("GPS Timeout")
|
| 140 | 143 |
warn("UL ID: "+parseTopic[1]+" D: "+parseTopic[3]+" F: "+str(FCnt)+" Type: "+messageType+" GPS Timeout")
|
| 144 |
+ htmlLatest(parseTopic[3],parseTopic[1],FCnt,parsed['DevEUI_uplink']['Time'],lat,lon,err,parsed['DevEUI_uplink']['LrrRSSI'],"GPS TImeout or Non-GPS position") |
|
| 141 | 145 |
return |
| 142 | 146 |
else: |
| 143 | 147 |
isPosition=False |
| 144 | 148 |
say("UL ID: "+parseTopic[1]+" D: "+parseTopic[3]+" F: "+str(FCnt)+" Type: "+messageType)
|
| 149 |
+ htmlLatest(parseTopic[3],parseTopic[1],FCnt,parsed['DevEUI_uplink']['Time'],lat,lon,err,parsed['DevEUI_uplink']['LrrRSSI'],messageType) |
|
| 145 | 150 |
return |
| 146 | 151 |
else: |
| 147 | 152 |
isPosition=False |
| ... | ... |
@@ -291,6 +296,7 @@ class MyServer(BaseHTTPRequestHandler): |
| 291 | 296 |
if "/favicon.png" in self.path or "/style.css" in self.path: |
| 292 | 297 |
splitPath=self.path.split('/')
|
| 293 | 298 |
localFilename=splitPath[len(splitPath)-1] |
| 299 |
+ #print(localFilename) |
|
| 294 | 300 |
try: |
| 295 | 301 |
|
| 296 | 302 |
f = open(rootdir + "/" + localFilename,'rb') #open requested file |
| ... | ... |
@@ -470,7 +476,7 @@ def httpInitRun(): |
| 470 | 476 |
|
| 471 | 477 |
|
| 472 | 478 |
say("HTTP started http://%s:%s" % (server['address'], server['port']))
|
| 473 |
- htmlLatest(str(0),str(0),0,str(0),0,0,0,0) |
|
| 479 |
+ htmlLatest(str(0),str(0),0,str(0),0,0,0,0,"Waiting for uplink") |
|
| 474 | 480 |
try: |
| 475 | 481 |
webServer.serve_forever() |
| 476 | 482 |
except KeyboardInterrupt: |
| ... | ... |
@@ -0,0 +1,220 @@ |
| 1 |
+html {
|
|
| 2 |
+ font-family: "Lucida Sans", sans-serif; |
|
| 3 |
+ text-align: center; |
|
| 4 |
+} |
|
| 5 |
+body,h1,h2{
|
|
| 6 |
+ background-color:#eee; |
|
| 7 |
+ font-family:arial,verdana,sans-serif |
|
| 8 |
+} |
|
| 9 |
+ |
|
| 10 |
+h1{font-size: 2.5em; color:#aaa}
|
|
| 11 |
+h2{text-indent:30px;color:#888; text-align: center}
|
|
| 12 |
+ |
|
| 13 |
+a{text-decoration:none}
|
|
| 14 |
+#a:link,a:visited{color:#cc9630}
|
|
| 15 |
+#a:hover{color:#fff;background-color:#cc9630}
|
|
| 16 |
+#a:link,a:visited{color:#cc9630}
|
|
| 17 |
+#a:hover{color:#fff;background-color:#3090cc}
|
|
| 18 |
+a:link,a:visited{color:#cc9630}
|
|
| 19 |
+a:hover{}
|
|
| 20 |
+ |
|
| 21 |
+/* Default Section Display */ |
|
| 22 |
+ |
|
| 23 |
+.empty-list li {
|
|
| 24 |
+ list-style-type: none; |
|
| 25 |
+ display: inline; |
|
| 26 |
+} |
|
| 27 |
+li {
|
|
| 28 |
+ list-style-type: none; |
|
| 29 |
+} |
|
| 30 |
+.empty-list img {
|
|
| 31 |
+ margin-top: 10px; |
|
| 32 |
+ border: 1px solid #666; |
|
| 33 |
+ width: 95%; |
|
| 34 |
+ max-height: 90vh; |
|
| 35 |
+ object-fit: contain; |
|
| 36 |
+ display: inline; |
|
| 37 |
+} |
|
| 38 |
+ |
|
| 39 |
+.row {
|
|
| 40 |
+ margin-left: auto; |
|
| 41 |
+ margin-right: auto; |
|
| 42 |
+ width: 50% |
|
| 43 |
+ |
|
| 44 |
+} |
|
| 45 |
+ |
|
| 46 |
+.loglines {
|
|
| 47 |
+ font-family: monospace; |
|
| 48 |
+ text-align: left; |
|
| 49 |
+} |
|
| 50 |
+.logOK {
|
|
| 51 |
+ display: inline; |
|
| 52 |
+ color: #00AF00; |
|
| 53 |
+ font-weight: bold; |
|
| 54 |
+} |
|
| 55 |
+.logWARN {
|
|
| 56 |
+ display: inline; |
|
| 57 |
+ color: #E8A317; |
|
| 58 |
+ font-weight: bold; |
|
| 59 |
+} |
|
| 60 |
+.logERROR {
|
|
| 61 |
+ display: inline; |
|
| 62 |
+ color: #FF0000; |
|
| 63 |
+ font-weight: bold; |
|
| 64 |
+} |
|
| 65 |
+ |
|
| 66 |
+.column {
|
|
| 67 |
+ float: left; |
|
| 68 |
+ color:#cc9630; |
|
| 69 |
+} |
|
| 70 |
+.genres-item-description {
|
|
| 71 |
+ color:#ccc; |
|
| 72 |
+} |
|
| 73 |
+ |
|
| 74 |
+#colLeft {
|
|
| 75 |
+ width: 2%; |
|
| 76 |
+ background-color:#111; |
|
| 77 |
+ color:#cc9630; |
|
| 78 |
+ height: 80vh; |
|
| 79 |
+ z-index: -1; |
|
| 80 |
+} |
|
| 81 |
+#colRight {
|
|
| 82 |
+ float: right; |
|
| 83 |
+ width: 2%; |
|
| 84 |
+ background-color:#111; |
|
| 85 |
+ color:#cc9630; |
|
| 86 |
+ height: 80vh; |
|
| 87 |
+ z-index: -1; |
|
| 88 |
+} |
|
| 89 |
+#colMiddle {
|
|
| 90 |
+ max-width: 96%; |
|
| 91 |
+ max-height: 85vh; |
|
| 92 |
+ display: inline; |
|
| 93 |
+} |
|
| 94 |
+ |
|
| 95 |
+.center {
|
|
| 96 |
+ display: block; |
|
| 97 |
+ width: 99%; |
|
| 98 |
+ min-width: 700px; |
|
| 99 |
+ margin-left: auto; |
|
| 100 |
+ margin-right: auto; |
|
| 101 |
+} |
|
| 102 |
+ |
|
| 103 |
+/* Clear floats after the columns */ |
|
| 104 |
+.row:after {
|
|
| 105 |
+ content: ""; |
|
| 106 |
+ display: table; |
|
| 107 |
+ clear: both; |
|
| 108 |
+} |
|
| 109 |
+ |
|
| 110 |
+.mangaKey {
|
|
| 111 |
+ background-color: transparent; |
|
| 112 |
+} |
|
| 113 |
+ |
|
| 114 |
+.arrow-up, |
|
| 115 |
+.arrow-down, |
|
| 116 |
+.arrow-left, |
|
| 117 |
+.arrow-right, |
|
| 118 |
+.fs-on, |
|
| 119 |
+.fs-off, |
|
| 120 |
+.reload-circle {
|
|
| 121 |
+ width: 0; |
|
| 122 |
+ height: 0; |
|
| 123 |
+ display: inline-block; |
|
| 124 |
+} |
|
| 125 |
+ |
|
| 126 |
+.arrow-up {
|
|
| 127 |
+ border-left: 12px solid transparent; |
|
| 128 |
+ border-right: 12px solid transparent; |
|
| 129 |
+ border-bottom: 24px solid #cc9630; |
|
| 130 |
+} |
|
| 131 |
+ |
|
| 132 |
+.arrow-down {
|
|
| 133 |
+ border-left: 12px solid transparent; |
|
| 134 |
+ border-right: 12px solid transparent; |
|
| 135 |
+ border-top: 24px solid #cc9630; |
|
| 136 |
+} |
|
| 137 |
+ |
|
| 138 |
+.arrow-right {
|
|
| 139 |
+ border-top: 12px solid transparent; |
|
| 140 |
+ border-bottom: 12px solid transparent; |
|
| 141 |
+ border-left: 12px solid #cc9630; |
|
| 142 |
+} |
|
| 143 |
+ |
|
| 144 |
+.arrow-left {
|
|
| 145 |
+ border-top: 12px solid transparent; |
|
| 146 |
+ border-bottom: 12px solid transparent; |
|
| 147 |
+ border-right:12px solid #cc9630; |
|
| 148 |
+} |
|
| 149 |
+.fs-on {
|
|
| 150 |
+ border-top: 16px solid #cc9630; |
|
| 151 |
+ border-left: 16px solid transparent; |
|
| 152 |
+} |
|
| 153 |
+.fs-off {
|
|
| 154 |
+ border-top: 8px solid transparent; |
|
| 155 |
+ border-bottom: 8px solid transparent; |
|
| 156 |
+ border-left: 8px solid #cc9630; |
|
| 157 |
+ border-right: 8px solid #cc9630; |
|
| 158 |
+} |
|
| 159 |
+ |
|
| 160 |
+.reload-circle {
|
|
| 161 |
+ margin-left: 1%; |
|
| 162 |
+ margin-right: 1%; |
|
| 163 |
+ width: 10px; |
|
| 164 |
+ height: 10px; |
|
| 165 |
+ border-radius: 14px; |
|
| 166 |
+ border: 8px solid #cc9630; |
|
| 167 |
+ border-top-color: transparent; |
|
| 168 |
+ -webkit-transform: rotate(45deg); |
|
| 169 |
+} |
|
| 170 |
+ |
|
| 171 |
+#deveui { font-size: 1.4em;}
|
|
| 172 |
+#fcnt { font-size: 1.8em; }
|
|
| 173 |
+#time { font-size: 1.4em; }
|
|
| 174 |
+#position { display: inline-block; font-size: 1.5em; text-align: center; }
|
|
| 175 |
+#rssi { font-size: 1.2em; }
|
|
| 176 |
+#delta { font-size: 1.0em; }
|
|
| 177 |
+#comment { font-size: 0.8em; }
|
|
| 178 |
+ |
|
| 179 |
+button {
|
|
| 180 |
+ position: relative; |
|
| 181 |
+ width: 300px; |
|
| 182 |
+ height: 40px; |
|
| 183 |
+ margin: 10px auto; |
|
| 184 |
+ padding: 0; |
|
| 185 |
+ font-size: 22px; |
|
| 186 |
+ text-align: center; |
|
| 187 |
+ color: white; |
|
| 188 |
+ border: none; |
|
| 189 |
+ outline: none; |
|
| 190 |
+ cursor: pointer; |
|
| 191 |
+ overflow: hidden; |
|
| 192 |
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); |
|
| 193 |
+ transition: transform 0.4s ease-in-out; |
|
| 194 |
+} |
|
| 195 |
+.btn-green {
|
|
| 196 |
+ background: #1abc9c; |
|
| 197 |
+ border-bottom: 2px solid #12ab8d; |
|
| 198 |
+ box-shadow: inset 0 -2px #12ab8d; |
|
| 199 |
+} |
|
| 200 |
+.btn-green-menu {
|
|
| 201 |
+ display: inline; |
|
| 202 |
+ width: 100px; |
|
| 203 |
+ background: #1abc9c; |
|
| 204 |
+ border-bottom: 2px solid #12ab8d; |
|
| 205 |
+ box-shadow: inset 0 -2px #12ab8d; |
|
| 206 |
+} |
|
| 207 |
+ |
|
| 208 |
+#latest, |
|
| 209 |
+#log, |
|
| 210 |
+#home {
|
|
| 211 |
+ display: inline; |
|
| 212 |
+} |
|
| 213 |
+ |
|
| 214 |
+ |
|
| 215 |
+@media screen and (max-width: 768px) {
|
|
| 216 |
+ /*#colLeft { display: none; }
|
|
| 217 |
+ #colRight { display: none; }*/
|
|
| 218 |
+ .row2 { display: block; }
|
|
| 219 |
+ .center { min-width: 90vw; }
|
|
| 220 |
+} |