File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 2
2
sidebar_position : 2
3
3
---
4
4
5
+ import AsyncUiWrapper from " ../../src/components/AsyncUiWrapper" ;
6
+
5
7
# MQTT API
6
8
7
9
Die MQTT API folgt der [ REST API] ( ./rest-api ) Struktur.
8
10
Alle API IDs (z.B. die Loadpoint ID) beginnen bei ` 1 ` .
9
11
12
+ <AsyncUiWrapper />
13
+
10
14
- ` evcc ` : root topic
11
15
- ` evcc/status ` : status (` online ` /` offline ` )
12
16
- ` evcc/updated ` : timestamp of last update
Original file line number Diff line number Diff line change
1
+ import AsyncApiComponent from "@asyncapi/react-component" ;
2
+
3
+ const configs = { } ;
4
+ const customCss = "" ;
5
+
6
+ export default ( ) => {
7
+ const containerRef = useRef ( null ) ;
8
+
9
+ useEffect ( ( ) => {
10
+ if ( containerRef . current ?. attachShadow ) {
11
+ try {
12
+ const shadowRoot = containerRef . current . attachShadow ( { mode : "open" } ) ;
13
+ const style = document . createElement ( "style" ) ;
14
+ style . textContent = customCss ;
15
+ shadowRoot . appendChild ( style ) ;
16
+
17
+ const div = document . createElement ( "div" ) ;
18
+ shadowRoot . appendChild ( div ) ;
19
+
20
+ const root = ReactDOM . createRoot ( div ) ;
21
+ root . render (
22
+ < AsyncApiComponent
23
+ schema = { { url : "/mqtt-api.yaml" } }
24
+ config = { configs }
25
+ /> ,
26
+ ) ;
27
+ } catch ( e ) {
28
+ console . error ( e ) ;
29
+ }
30
+ }
31
+ } , [ ] ) ;
32
+
33
+ return < div ref = { containerRef } > </ div > ;
34
+ } ;
You can’t perform that action at this time.
0 commit comments