File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change 22sidebar_position : 2
33---
44
5+ import AsyncUiWrapper from " ../../src/components/AsyncUiWrapper" ;
6+
57# MQTT API
68
79Die MQTT API folgt der [ REST API] ( ./rest-api ) Struktur.
810Alle API IDs (z.B. die Loadpoint ID) beginnen bei ` 1 ` .
911
12+ <AsyncUiWrapper />
13+
1014- ` evcc ` : root topic
1115- ` evcc/status ` : status (` online ` /` offline ` )
1216- ` 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