Skip to content

Commit 98acb7c

Browse files
committed
format help text
1 parent 3ac437f commit 98acb7c

File tree

1 file changed

+68
-39
lines changed

1 file changed

+68
-39
lines changed

Diff for: src/views/GeneralConfig.vue

+68-39
Original file line numberDiff line numberDiff line change
@@ -128,71 +128,100 @@
128128
$store.state.mqtt['openWB/general/http_api']
129129
"
130130
@update:model-value="
131-
sendSystemCommand('httpApi', {'active': $event})
131+
sendSystemCommand('httpApi', { active: $event })
132132
"
133133
>
134134
<template #help>
135135
<p>
136136
Mit der HTTP-API kann man den Wert eines
137-
MQTT-Topics per HTTPs (Port 8443) oder optional
138-
auch HTTP (Port 8090) abfragen. Ein Zugriff ist
139-
nur lesend möglich, nicht schreibend. Es wird
140-
empfohlen, nur HTTPs zu aktivieren.
137+
MQTT-Topics per HTTPs (Port 8443) abfragen oder
138+
neu setzen. Topics können über GET oder POST
139+
abgefragt, neue Werte nur mit POST gesetzt
140+
werden.
141141
</p>
142142
<p>
143-
Beispiel: Abfrage des aktuellen
143+
Beispiel 1: Abfrage des aktuellen
144144
Systemzeitstempels
145145
</p>
146146
<ul>
147147
<li>
148-
Verschlüsselter GET-Request:
149-
<a
150-
:href="`https://${getIpAddress()}:8443/?topic=openWB/system/time`"
151-
target="_blank"
152-
rel="noopener noreferrer"
148+
GET-Request:<br />
149+
<openwb-base-copy-to-clipboard
150+
class="text-info"
151+
tooltip="URL kopieren"
153152
>
154153
https://{{
155154
getIpAddress()
156-
}}:8443/?topic=openWB/system/time
157-
</a>
155+
}}:8443/v1/?topic=openWB/system/time
156+
</openwb-base-copy-to-clipboard>
158157
</li>
159158
<li>
160-
GET-Request (falls unverschlüsseltes HTTP
161-
aktiviert wurde):
162-
<a
163-
:href="`http://${getIpAddress()}:8080/?topic=openWB/system/time`"
164-
target="_blank"
165-
rel="noopener noreferrer"
159+
POST-Request über 'curl' mit privatem
160+
SSL-Zertifikat und Verarbeitung durch
161+
'jq':<br />
162+
<openwb-base-copy-to-clipboard
163+
class="text-info"
164+
tooltip="Befehl kopieren"
166165
>
167-
http://{{
168-
getIpAddress()
169-
}}:8080/?topic=openWB/system/time
170-
</a>
166+
curl -k -s -X POST --data
167+
'{"topic":"openWB/system/time"}'
168+
https://{{ getIpAddress() }}:8443/v1/ |
169+
jq .
170+
</openwb-base-copy-to-clipboard>
171171
</li>
172172
</ul>
173173
<p>
174174
Die zurückgegebenen Daten sind im JSON-Format.
175175
Der Inhalt ist nach folgendem Schema aufgebaut:
176176
</p>
177-
<pre>
178-
{
179-
"topic": "openWB/system/time",
180-
"value": 1721287000.646975,
181-
"status": "success"
182-
}
183-
</pre>
177+
<pre class="border border-info w-100 p-1">{{
178+
JSON.stringify(
179+
{
180+
status: "success",
181+
topic: "openWB/system/time",
182+
message: 1721287000.646975,
183+
},
184+
null,
185+
4,
186+
)
187+
}}</pre>
184188
<p>
185-
Im Fehlerfall wird der Status auf "error"
189+
Im Fehlerfall wird der Status auf "failed"
186190
gesetzt und eine Fehlermeldung zurückgegeben.
187191
</p>
188-
<pre>
189-
{
190-
"topic": "openWB/unbekanntes/topic",
191-
"value": null,
192-
"status": "error",
193-
"error": "Topic not found"
194-
}
195-
</pre>
192+
<p>Beispiel 2: integriertes Display abschalten</p>
193+
<ul>
194+
<li>
195+
POST-Request über 'curl' mit privatem
196+
SSL-Zertifikat und Verarbeitung durch
197+
'jq':<br />
198+
<openwb-base-copy-to-clipboard
199+
class="text-info"
200+
tooltip="Befehl kopieren"
201+
>
202+
curl -k -s -X POST --data '{"topic":
203+
"openWB/set/optional/int_display/active",
204+
"message": false}' https://{{
205+
getIpAddress()
206+
}}:8443/v1/ | jq .
207+
</openwb-base-copy-to-clipboard>
208+
</li>
209+
</ul>
210+
<p>
211+
Die zurückgegebenen Daten sind im JSON-Format.
212+
Der Inhalt ist nach folgendem Schema aufgebaut:
213+
</p>
214+
<pre class="border border-info w-100 p-1">{{
215+
JSON.stringify(
216+
{
217+
status: "success",
218+
topic: "openWB/set/optional/int_display/active",
219+
message: false,
220+
},
221+
null,
222+
4,
223+
)
224+
}}</pre>
196225
</template>
197226
</openwb-base-button-group-input>
198227
</div>

0 commit comments

Comments
 (0)