Mercurial > code > home > repos > mqtt_metrics
annotate src/main.ts @ 0:0b5b4ede1bf5
start with a mockup of the debugging display
author | drewp@bigasterisk.com |
---|---|
date | Fri, 09 Aug 2024 15:09:22 -0700 |
parents | |
children | 3d7f2dc9beec |
rev | line source |
---|---|
0
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
1 import { LitElement, TemplateResult, css, html } from "lit"; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
2 import { customElement } from "lit/decorators.js"; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
3 |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
4 @customElement("mm-page") |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
5 export class MmPage extends LitElement { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
6 static styles = [ |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
7 css` |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
8 :host { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
9 display: flex; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
10 flex-direction: column; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
11 height: 100vh; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
12 background: #121212; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
13 color: white; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
14 text-shadow: 0.6px 0.6px 0px #ffffff70; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
15 font-family: monospace; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
16 font-size: 135%; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
17 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
18 div.message { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
19 color: #888; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
20 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
21 .msgKey { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
22 color: #006699; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
23 padding-left: 14px; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
24 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
25 .msgValue { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
26 color: #ff4500; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
27 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
28 .metricName { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
29 color: #008000; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
30 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
31 .metricLabelName { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
32 color: #9400d3; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
33 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
34 .metricLabelValue { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
35 color: #ffc125; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
36 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
37 .metricValue { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
38 color: #4169e1; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
39 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
40 `, |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
41 ]; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
42 render() { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
43 return html` |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
44 <h1>Mqtt metrics</h1> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
45 |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
46 <div class="message"> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
47 <div> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
48 Incoming mqtt message: <span class="msgKey">t</span>=<span class="msgValue">${"2024-08-09 14:43:28"}</span> <span class="msgKey">topic</span>=<span |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
49 class="msgValue" |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
50 >${"tr-air-quality/sensor/particulate_matter__10_0__m_concentration/state"}</span |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
51 > |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
52 <span class="msgKey">message</span>=<span class="msgValue">${"12"}</span> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
53 </div> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
54 <div> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
55 Converted to metrics event: |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
56 <span class="metricName">pm_concentration</span> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
57 { |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
58 <span class="metricLabelName">location</span>="<span class="metricLabelValue">rr</span>", <span class="metricLabelName">size</span>="<span |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
59 class="metricLabelValue" |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
60 >10</span |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
61 >" } value=<span class="metricValue">12</span> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
62 </div> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
63 </div> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
64 |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
65 <p> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
66 <a href="metrics">metrics</a> | |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
67 </p> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
68 <bigast-loginbar></bigast-loginbar> |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
69 `; |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
70 } |
0b5b4ede1bf5
start with a mockup of the debugging display
drewp@bigasterisk.com
parents:
diff
changeset
|
71 } |