add optional ImageUpload for Webhook (#3174)

* WIP add Webhook

* fix config html for webhook
add tooltips for webhook

* webhook: fix not enabling webhook

* send webhook as json

* Update ApiKey.md

* webhook: fix only sending last "Number"

* webhook JSON is now closer to the data log in CSV format

* webhook: add img upload

* webhoop added config for imgupload

* webhook html fixes

* webhook: drop timeStampTimeUTC and switch from timeStamp to lastvalue like lokal csv to fix no timestamp on error

* add checkbox for Webhook_UploadImg

* Update sd-card/html/edit_config_template.html

* Update edit_config_template.html

* Update edit_config_template.html

* Update edit_config_template.html

* added a long timestamp to both webhook requests

---------

Co-authored-by: CaCO3 <caco3@ruinelli.ch>
This commit is contained in:
Raphael Hehl
2024-09-01 08:33:46 +02:00
committed by GitHub
parent 3a34564ee2
commit cd29690b96
8 changed files with 117 additions and 8 deletions

View File

@@ -108,6 +108,7 @@ HomeassistantDiscovery = false
;[Webhook]
;Uri = undefined
;ApiKey = undefined
;UploadImg = 0
;[GPIO]
;MainTopicMQTT = wasserzaehler/GPIO

View File

@@ -1353,7 +1353,8 @@
<td colspan="3" style="padding-left: 0px; padding-bottom: 3px;">
<h4>
<input type="checkbox" id="Category_Webhook_enabled" value="1" onclick = 'UpdateAfterCategoryCheck()' unchecked >
<label for=Category_Webhook_enabled>Webhook</label></h4>
<label for=Category_Webhook_enabled>Webhook</label>
</h4>
</td>
</tr>
@@ -1379,6 +1380,20 @@
<td>$TOOLTIP_Webhook_ApiKey</td>
</tr>
<tr class="WebhookItem">
<td class="indent1">
<input type="checkbox" id="Webhook_UploadImg_enabled" value="1" onclick = 'InvertEnableItem("Webhook", "UploadImg")' unchecked>
<label for=Webhook_UploadImg_enabled><class id="Webhook_UploadImg_text" style="color:black;">Upload Image</class></label>
</td>
<td>
<select id="Webhook_UploadImg_value1">
<option value="0" selected>NEVER</option>
<option value="1">ALWAYS</option>
<option value="2">ON_ERROR</option>
</select>
</td>
<td>$TOOLTIP_Webhook_UploadImg</td>
</tr>
<!------------- GPIO ------------------>
<tr style="border-bottom: 2px solid lightgray;">
@@ -2310,6 +2325,7 @@ function UpdateInput() {
WriteParameter(param, category, "Webhook", "Uri", true);
WriteParameter(param, category, "Webhook", "ApiKey", true);
WriteParameter(param, category, "Webhook", "UploadImg", true);
WriteParameter(param, category, "GPIO", "IO0", true);
WriteParameter(param, category, "GPIO", "IO1", true);
@@ -2391,6 +2407,7 @@ function ReadParameterAll() {
category["MQTT"]["enabled"] = document.getElementById("Category_MQTT_enabled").checked;
category["InfluxDB"]["enabled"] = document.getElementById("Category_InfluxDB_enabled").checked;
category["InfluxDBv2"]["enabled"] = document.getElementById("Category_InfluxDBv2_enabled").checked;
category["Webhook"]["enabled"] = document.getElementById("Category_Webhook_enabled").checked;
category["GPIO"]["enabled"] = document.getElementById("Category_GPIO_enabled").checked;
ReadParameter(param, "TakeImage", "RawImagesLocation", true);
@@ -2474,6 +2491,7 @@ function ReadParameterAll() {
ReadParameter(param, "Webhook", "Uri", true);
ReadParameter(param, "Webhook", "ApiKey", true);
ReadParameter(param, "Webhook", "UploadImg", true);
ReadParameter(param, "GPIO", "IO0", true);
ReadParameter(param, "GPIO", "IO1", true);

View File

@@ -237,6 +237,7 @@ function ParseConfig() {
param[catname] = new Object();
ParamAddValue(param, catname, "Uri");
ParamAddValue(param, catname, "ApiKey");
ParamAddValue(param, catname, "UploadImg");
var catname = "GPIO";
category[catname] = new Object();