Files
OpenBK7231T_App/src/httpserver/script_ha_discovery.js
2022-10-15 07:56:26 -05:00

22 lines
533 B
JavaScript

//The content of this file get set into ha_discovery_script (new_http.cs)
function send_ha_disc() {
var xhr = new XMLHttpRequest();
xhr.open(
"GET",
"/ha_discovery?prefix=" + document.getElementById("ha_disc_topic").value,
false
);
xhr.onload = function () {
if (xhr.status === 200) {
alert("MQTT discovery queued");
} else if (xhr.status === 404) {
alert("Error invoking ha_discovery");
}
};
xhr.onerror = function () {
alert("Error invoking ha_discovery");
};
xhr.send();
}