diff --git a/Code/data/hwconfig.html b/Code/data/hwconfig.html
index 5aefb787..f0b2b6f3 100644
--- a/Code/data/hwconfig.html
+++ b/Code/data/hwconfig.html
@@ -119,8 +119,8 @@
Hardware:
DSP |
- data/td/rx
- clk/tx
+ data/td/tx
+ clk/rx
cs/ld
audio
|
@@ -174,8 +174,8 @@ Hardware:
}
if(dsp == 4 || dsp == 5 || dsp == 6 || dsp == 7 || dsp == 8)
{
- p4 = 7;
- p5 = 6;
+ p4 = 6;
+ p5 = 7;
p6 = null;
p7 = null;
}
@@ -202,8 +202,8 @@ Hardware:
}
if(dsp == 4 || dsp == 5 || dsp == 6 || dsp == 7 || dsp == 8)
{
- p4 = 5;
- p5 = 4;
+ p4 = 4;
+ p5 = 5;
p6 = null;
p7 = null;
}
@@ -230,8 +230,8 @@ Hardware:
}
if(dsp == 4 || dsp == 5 || dsp == 6 || dsp == 7 || dsp == 8)
{
- p4 = 3;
- p5 = 4;
+ p4 = 4;
+ p5 = 3;
p6 = null;
p7 = null;
}
diff --git a/Code/datazip/chkupdatefw.html.gz b/Code/datazip/chkupdatefw.html.gz
index be54f17d..ecf35cde 100644
Binary files a/Code/datazip/chkupdatefw.html.gz and b/Code/datazip/chkupdatefw.html.gz differ
diff --git a/Code/datazip/config.html.gz b/Code/datazip/config.html.gz
index 741c9c33..74bca5c5 100644
Binary files a/Code/datazip/config.html.gz and b/Code/datazip/config.html.gz differ
diff --git a/Code/datazip/favicon.ico.gz b/Code/datazip/favicon.ico.gz
index 52b7e635..4e2195ed 100644
Binary files a/Code/datazip/favicon.ico.gz and b/Code/datazip/favicon.ico.gz differ
diff --git a/Code/datazip/function.js.gz b/Code/datazip/function.js.gz
index c2f38306..e48e1de9 100644
Binary files a/Code/datazip/function.js.gz and b/Code/datazip/function.js.gz differ
diff --git a/Code/datazip/hwconfig.html.gz b/Code/datazip/hwconfig.html.gz
index 32a034bf..7543061e 100644
Binary files a/Code/datazip/hwconfig.html.gz and b/Code/datazip/hwconfig.html.gz differ
diff --git a/Code/datazip/hwtestinfo.html.gz b/Code/datazip/hwtestinfo.html.gz
index eb686451..e8b464c5 100644
Binary files a/Code/datazip/hwtestinfo.html.gz and b/Code/datazip/hwtestinfo.html.gz differ
diff --git a/Code/datazip/index.html.gz b/Code/datazip/index.html.gz
index 7a470774..61a61ffe 100644
Binary files a/Code/datazip/index.html.gz and b/Code/datazip/index.html.gz differ
diff --git a/Code/datazip/index.js.gz b/Code/datazip/index.js.gz
index 13733496..c0e640ef 100644
Binary files a/Code/datazip/index.js.gz and b/Code/datazip/index.js.gz differ
diff --git a/Code/datazip/main.css.gz b/Code/datazip/main.css.gz
index bd2f610e..b307489f 100644
Binary files a/Code/datazip/main.css.gz and b/Code/datazip/main.css.gz differ
diff --git a/Code/datazip/mqtt.html.gz b/Code/datazip/mqtt.html.gz
index 8164ef45..4ddd7ecb 100644
Binary files a/Code/datazip/mqtt.html.gz and b/Code/datazip/mqtt.html.gz differ
diff --git a/Code/datazip/remove.html.gz b/Code/datazip/remove.html.gz
index 93bd9787..87dc457f 100644
Binary files a/Code/datazip/remove.html.gz and b/Code/datazip/remove.html.gz differ
diff --git a/Code/datazip/success.html.gz b/Code/datazip/success.html.gz
index e75df157..615e1e09 100644
Binary files a/Code/datazip/success.html.gz and b/Code/datazip/success.html.gz differ
diff --git a/Code/datazip/upload.html.gz b/Code/datazip/upload.html.gz
index 46813b76..65bb98ac 100644
Binary files a/Code/datazip/upload.html.gz and b/Code/datazip/upload.html.gz differ
diff --git a/Code/datazip/webconfig.html.gz b/Code/datazip/webconfig.html.gz
index 0b4c84d4..faac8c07 100644
Binary files a/Code/datazip/webconfig.html.gz and b/Code/datazip/webconfig.html.gz differ
diff --git a/Code/datazip/wifi.html.gz b/Code/datazip/wifi.html.gz
index a09e3816..784f1a25 100644
Binary files a/Code/datazip/wifi.html.gz and b/Code/datazip/wifi.html.gz differ
diff --git a/Code/fw/firmware.bin b/Code/fw/firmware.bin
index 0749e5b1..cb792bd3 100644
Binary files a/Code/fw/firmware.bin and b/Code/fw/firmware.bin differ
diff --git a/Code/fw/version.txt b/Code/fw/version.txt
index c1be15f0..c6b2ccb1 100644
--- a/Code/fw/version.txt
+++ b/Code/fw/version.txt
@@ -1 +1 @@
-2023-05-13-1551
\ No newline at end of file
+2023-05-19-1021
\ No newline at end of file
diff --git a/Code/lib/BWC_unified/bwc.cpp b/Code/lib/BWC_unified/bwc.cpp
index d19e5517..33bbf9c2 100644
--- a/Code/lib/BWC_unified/bwc.cpp
+++ b/Code/lib/BWC_unified/bwc.cpp
@@ -781,7 +781,7 @@ String BWC::getJSONStates() {
doc[F("HJT")] = cio->cio_states.jets;
doc[F("BRT")] = dsp->dsp_states.brightness;
doc[F("ERR")] = cio->cio_states.error;
- doc[F("GOD")] = cio->cio_states.godmode;
+ doc[F("GOD")] = (uint8_t)cio->cio_states.godmode;
doc[F("TGT")] = cio->cio_states.target;
doc[F("TMP")] = cio->cio_states.temperature;
doc[F("VTMC")] = _virtual_temp;
diff --git a/Code/lib/dsp/DSP_4W.cpp b/Code/lib/dsp/DSP_4W.cpp
index 4db71ff0..77c0fb00 100644
--- a/Code/lib/dsp/DSP_4W.cpp
+++ b/Code/lib/dsp/DSP_4W.cpp
@@ -1,7 +1,7 @@
#include "DSP_4W.h"
#include "util.h"
-void DSP_4W::setup(int dsp_rx, int dsp_tx, int dummy, int dummy2)
+void DSP_4W::setup(int dsp_tx, int dsp_rx, int dummy, int dummy2)
{
_dsp_serial.begin(9600, SWSERIAL_8N1, dsp_tx, dsp_rx, false, 63);
_dsp_serial.setTimeout(20);
diff --git a/Code/lib/dsp/DSP_4W.h b/Code/lib/dsp/DSP_4W.h
index ca4fe68f..00477c26 100644
--- a/Code/lib/dsp/DSP_4W.h
+++ b/Code/lib/dsp/DSP_4W.h
@@ -9,7 +9,7 @@ class DSP_4W : public DSP
public:
DSP_4W(){};
virtual ~DSP_4W(){};
- void setup(int dsp_rx, int dsp_tx, int dummy, int dummy2);
+ void setup(int dsp_tx, int dsp_rx, int dummy, int dummy2);
void stop();
void pause_resume(bool action) override;
void updateToggles();
diff --git a/Code/src/config.h b/Code/src/config.h
index fd24e397..e93c7f86 100644
--- a/Code/src/config.h
+++ b/Code/src/config.h
@@ -5,7 +5,7 @@
#include
#endif
#define DEVICE_NAME "layzspa"
-#define FW_VERSION "2023-05-13-1551"
+#define FW_VERSION "2023-05-19-1021"
#define HA_PREFIX "homeassistant"
#define PROM_NAMESPACE "layzspa"
diff --git a/Code/src/ha.txt b/Code/src/ha.txt
index 74ec59b4..575a122d 100644
--- a/Code/src/ha.txt
+++ b/Code/src/ha.txt
@@ -1,6 +1,8 @@
void setupHA()
{
+ /* DEVICE */
+
if(!mqttClient.connected()){
String s = F("HA setup failed. MQTT not connected");
bwc.saveDebugInfo(s);
@@ -27,7 +29,11 @@ void setupHA()
devicedoc["dev"][F("sw_version")] = FW_VERSION;
- //brightness slider
+ /************/
+ /* NUMBER */
+ /************/
+
+ /* brightness slider */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/number/") + mqttBaseTopic + F("_brightness/config");
@@ -55,7 +61,12 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // pressed button sensor
+
+ /************/
+ /* SENSORS */
+ /************/
+
+ /* pressed button sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_pressed_button/config");
@@ -77,7 +88,9 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // reboot time sensor
+
+
+ /* reboot time sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_reboot_time/config");
@@ -100,7 +113,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // reboot reason sensor
+ /* reboot reason sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_reboot_reason/config");
@@ -122,7 +135,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // WiFi SSID sensor
+ /* WiFi SSID sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_ssid/config");
@@ -146,7 +159,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // WiFi RSSI sensor
+ /* WiFi RSSI sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_rssi/config");
@@ -171,7 +184,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // WiFi local ip sensor
+ /* WiFi local ip sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_ip/config");
@@ -196,7 +209,7 @@ void setupHA()
doc.garbageCollect();
- // connect count sensor
+ /* connect count sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_connect_count/config");
@@ -219,34 +232,7 @@ void setupHA()
doc.garbageCollect();
-
-// // spa time to target temperature sensor
-// doc["dev"] = devicedoc["dev"];
-// payload = "";
-// topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_time_to_target/config");
-// // Serial.println(topic);
-// doc["name"] = mqttBaseTopic + F(" time to target");
-// doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_time_to_target")+mychipid;
-// doc["stat_t"] = mqttBaseTopic+F("/times");
-// doc["unit_of_meas"] = F("hours");
-// doc["val_tpl"] = F("{{ (value_json.TTTT / 3600 | float) | round(2) }}");
-// doc["expire_after"] = 700;
-// doc["icon"] = F("mdi:clock");
-// doc["avty_t"] = mqttBaseTopic+F("/Status");
-// doc["pl_avail"] = F("Alive");
-// doc["pl_not_avail"] = F("Dead");
-// if (serializeJson(doc, payload) == 0)
-// {
-// // Serial.println(F("Failed to serialize HA message!"));
-// return;
-// }
-// mqttClient.publish(topic.c_str(), payload.c_str(), true);
-// mqttClient.loop();
-// // Serial.println(payload);
-// doc.clear();
-// doc.garbageCollect();
-
- // spa time to ready sensor
+ /* spa time to ready sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_time_to_ready/config");
@@ -273,7 +259,7 @@ void setupHA()
doc.garbageCollect();
- // spa energy sensor
+ /* spa energy sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_energy/config");
@@ -301,7 +287,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa daily energy sensor
+ /* spa daily energy sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_today/config");
@@ -329,7 +315,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa power sensor
+ /* spa power sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_power/config");
@@ -357,7 +343,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa chlorine age sensor
+ /* spa chlorine age sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_chlorine_age/config");
@@ -383,7 +369,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa filter age sensor
+ /* spa filter age sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_filter_age/config");
@@ -409,7 +395,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa uptime sensor
+ /* spa uptime sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_uptime/config");
@@ -435,7 +421,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa pump time sensor
+ /* spa pump time sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_pumptime/config");
@@ -461,7 +447,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa heater time sensor
+ /* spa heater time sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_heatertime/config");
@@ -487,7 +473,7 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa air time sensor
+ /* spa air time sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_airtime/config");
@@ -513,20 +499,21 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa lock binary_sensor
+ /* spa temperature sensor f */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_lock/config");
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_temperature_f/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" lock");
- doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_lock")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" temp (F)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_temp_f")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["val_tpl"] = F("{% if value_json.LCK == 1 %}OFF{% else %}ON{% endif %}");
- doc["dev_cla"] = F("lock");
+ doc["unit_of_meas"] = "°F";
+ doc["val_tpl"] = F("{{ value_json.TMPF }}");
doc["expire_after"] = 700;
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
+ doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -538,20 +525,21 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa heater binary_sensor
+ /* spa temperature sensor c */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_heater/config");
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_temp_c/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" heater");
- doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_heater")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" temp (C)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_temp_c")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["val_tpl"] = F("{% if value_json.RED == 1 %}ON{% else %}OFF{% endif %}");
- doc["dev_cla"] = F("heat");
+ doc["unit_of_meas"] = "°C";
+ doc["val_tpl"] = F("{{ value_json.TMPC }}");
doc["expire_after"] = 700;
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
+ doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -563,23 +551,24 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa ready binary_sensor
+ /* spa virtual temperature sensor f */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_ready/config");
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_virtualtemp_f/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" ready");
- doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_ready")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" virtual temp (F)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_virtual_temp_f")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["val_tpl"] = F("{% if value_json.TMP > 30 %}{% if value_json.TMP >= value_json.TGT-1 %}ON{% else %}OFF{% endif %}{% else %}OFF{% endif %}");
+ doc["unit_of_meas"] = "°F";
+ doc["val_tpl"] = F("{{ value_json.VTMF | round(2) }}");
doc["expire_after"] = 700;
- doc["icon"] = F("mdi:hot-tub");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
+ doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize HA message!"));
+ // Serial.println(F("Failed to serialize vtf"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -588,23 +577,24 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa connection status binary_sensor
+ /* spa virtual temperature sensor c */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_connection/config");
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_virtualtemp_c/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" connection");
- doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_connection")+mychipid;
- doc["stat_t"] = mqttBaseTopic+F("/Status");
- doc["dev_cla"] = F("connectivity");
+ doc["name"] = mqttBaseTopic + F(" virtual temp (C)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_virtual_temp_c")+mychipid;
+ doc["stat_t"] = mqttBaseTopic+F("/message");
+ doc["unit_of_meas"] = "°C";
+ doc["val_tpl"] = F("{{ value_json.VTMC | round(2) }}");
+ doc["expire_after"] = 700;
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["pl_on"] = "Alive";
- doc["pl_off"] = "Dead";
+ doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize HA message!"));
+ // Serial.println(F("Failed to serialize vtc"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -613,28 +603,24 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa heat regulation switch
+ /* spa target temperature sensor f */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_heat_regulation/config");
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_target_temp_f/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" heat regulation");
- doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_heat_regulation")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" target temp (F)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_target_temp_f")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["val_tpl"] = F("{% if value_json.RED == 1 %}1{% elif value_json.GRN == 1 %}1{% else %}0{% endif %}");
+ doc["unit_of_meas"] = "°F";
+ doc["val_tpl"] = F("{{ value_json.TGTF }}");
doc["expire_after"] = 700;
- doc["icon"] = F("mdi:radiator");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["pl_on"] = F("{CMD:3,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["pl_off"] = F("{CMD:3,VALUE:false,XTIME:0,INTERVAL:0}");
- doc["state_on"] = 1;
- doc["state_off"] = 0;
+ doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize HA message!"));
+ // Serial.println(F("Failed to serialize tgtf!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -643,63 +629,50 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa waterjets switch
- /*TODO: make this work*/
-// if(HASJETS)
- if(true)
+ /* spa target temperature sensor c */
+ doc["dev"] = devicedoc["dev"];
+ payload = "";
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_target_temp_c/config");
+ // Serial.println(topic);
+ doc["name"] = mqttBaseTopic + F(" target temp (C)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_target_temp_c")+mychipid;
+ doc["stat_t"] = mqttBaseTopic+F("/message");
+ doc["unit_of_meas"] = "°C";
+ doc["val_tpl"] = F("{{ value_json.TGTC }}");
+ doc["expire_after"] = 700;
+ doc["avty_t"] = mqttBaseTopic+F("/Status");
+ doc["pl_avail"] = F("Alive");
+ doc["pl_not_avail"] = F("Dead");
+ doc["dev_cla"] = F("temperature");
+ if (serializeJson(doc, payload) == 0)
{
- doc["dev"] = devicedoc["dev"];
- payload = "";
- topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_jets/config");
- // Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" jets");
- doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_jets")+mychipid;
- doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["val_tpl"] = F("{{ value_json.HJT }}");
- doc["expire_after"] = 700;
- doc["icon"] = F("mdi:hydro-power");
- doc["avty_t"] = mqttBaseTopic+F("/Status");
- doc["pl_avail"] = F("Alive");
- doc["pl_not_avail"] = F("Dead");
- doc["pl_on"] = F("{CMD:11,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["pl_off"] = F("{CMD:11,VALUE:false,XTIME:0,INTERVAL:0}");
- doc["state_on"] = 1;
- doc["state_off"] = 0;
- if (serializeJson(doc, payload) == 0)
- {
- // Serial.println(F("Failed to serialize HA message!"));
- return;
- }
- mqttClient.publish(topic.c_str(), payload.c_str(), true);
- mqttClient.loop();
- // Serial.println(payload);
- doc.clear();
- doc.garbageCollect();
+ // Serial.println(F("Failed to serialize tgt!"));
+ return;
}
+ mqttClient.publish(topic.c_str(), payload.c_str(), true);
+ mqttClient.loop();
+ // Serial.println(payload);
+ doc.clear();
+ doc.garbageCollect();
- // spa airbubbles switch
+ /* spa ambient temperature sensor c */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_airbubbles/config");
+ topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_amb_temp_c/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" airbubbles");
- doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_airbubbles")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" ambient temp (C)");
+ doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_amb_temp_c")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["val_tpl"] = F("{{ value_json.AIR }}");
+ doc["unit_of_meas"] = "°C";
+ doc["val_tpl"] = F("{{ value_json.AMBC }}");
doc["expire_after"] = 700;
- doc["icon"] = F("mdi:chart-bubble");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["pl_on"] = F("{CMD:2,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["pl_off"] = F("{CMD:2,VALUE:false,XTIME:0,INTERVAL:0}");
- doc["state_on"] = 1;
- doc["state_off"] = 0;
+ doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize HA message!"));
+ // Serial.println(F("Failed to serialize amb!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -708,25 +681,25 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa pump switch
+ /******************/
+ /* BINARY SENSORS */
+ /******************/
+
+
+ /* spa lock binary_sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_pump/config");
+ topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_lock/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" pump");
- doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_pump")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" lock");
+ doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_lock")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["val_tpl"] = F("{{ value_json.FLT }}");
+ doc["val_tpl"] = F("{% if value_json.LCK == 1 %}OFF{% else %}ON{% endif %}");
+ doc["dev_cla"] = F("lock");
doc["expire_after"] = 700;
- doc["icon"] = F("mdi:pump");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["pl_on"] = F("{CMD:4,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["pl_off"] = F("{CMD:4,VALUE:false,XTIME:0,INTERVAL:0}");
- doc["state_on"] = 1;
- doc["state_off"] = 0;
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -738,25 +711,20 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa temperature unit switch
+ /* spa heater binary_sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_temperature_unit/config");
+ topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_heater/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" temperature unit F-C");
- doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_unit")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" heater");
+ doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_heater")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["val_tpl"] = F("{{ value_json.UNT }}");
+ doc["val_tpl"] = F("{% if value_json.RED == 1 %}ON{% else %}OFF{% endif %}");
+ doc["dev_cla"] = F("heat");
doc["expire_after"] = 700;
- doc["icon"] = F("mdi:circle-outline");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["pl_on"] = F("{CMD:1,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["pl_off"] = F("{CMD:1,VALUE:false,XTIME:0,INTERVAL:0}");
- doc["state_on"] = 1;
- doc["state_off"] = 0;
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -768,16 +736,17 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa reset chlorine timer button
+ /* spa ready binary_sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/button/") + mqttBaseTopic + F("_reset_chlorine/config");
+ topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_ready/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" reset chlorine timer");
- doc["uniq_id"] = F("button.") + mqttBaseTopic + F("_reset_chlorine")+mychipid;
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["payload_press"] = F("{CMD:9,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["icon"] = F("mdi:restart");
+ doc["name"] = mqttBaseTopic + F(" ready");
+ doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_ready")+mychipid;
+ doc["stat_t"] = mqttBaseTopic+F("/message");
+ doc["val_tpl"] = F("{% if value_json.TMP > 30 %}{% if value_json.TMP >= value_json.TGT-1 %}ON{% else %}OFF{% endif %}{% else %}OFF{% endif %}");
+ doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:hot-tub");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
@@ -792,19 +761,20 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa reset filter timer button
+ /* spa connection status binary_sensor */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/button/") + mqttBaseTopic + F("_reset_filter/config");
+ topic = String(HA_PREFIX) + F("/binary_sensor/") + mqttBaseTopic + F("_connection/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" reset filter timer");
- doc["uniq_id"] = F("button.") + mqttBaseTopic + F("_reset_filter")+mychipid;
- doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["payload_press"] = F("{CMD:10,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["icon"] = F("mdi:restart");
+ doc["name"] = mqttBaseTopic + F(" connection");
+ doc["uniq_id"] = F("binary_sensor.") + mqttBaseTopic + F("_connection")+mychipid;
+ doc["stat_t"] = mqttBaseTopic+F("/Status");
+ doc["dev_cla"] = F("connectivity");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
+ doc["pl_on"] = "Alive";
+ doc["pl_off"] = "Dead";
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -816,20 +786,31 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa restart esp button
+
+ /******************/
+ /* SWITCHES */
+ /******************/
+
+
+ /* spa heat regulation switch */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/button/") + mqttBaseTopic + F("_restart_esp/config");
+ topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_heat_regulation/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" restart esp");
- doc["uniq_id"] = F("button.") + mqttBaseTopic + F("_restart_esp")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" heat regulation");
+ doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_heat_regulation")+mychipid;
+ doc["stat_t"] = mqttBaseTopic+F("/message");
doc["cmd_t"] = mqttBaseTopic+F("/command");
- doc["payload_press"] = F("{CMD:6,VALUE:true,XTIME:0,INTERVAL:0}");
- doc["icon"] = F("mdi:restart");
- doc["dev_cla"] = F("restart");
+ doc["val_tpl"] = F("{% if value_json.RED == 1 %}1{% elif value_json.GRN == 1 %}1{% else %}0{% endif %}");
+ doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:radiator");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
+ doc["pl_on"] = F("{CMD:3,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["pl_off"] = F("{CMD:3,VALUE:false,XTIME:0,INTERVAL:0}");
+ doc["state_on"] = 1;
+ doc["state_off"] = 0;
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -841,24 +822,56 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- doc.clear();
- doc.garbageCollect();
+ /* spa waterjets switch */
+ doc["dev"] = devicedoc["dev"];
+ payload = "";
+ topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_jets/config");
+ // Serial.println(topic);
+ doc["name"] = mqttBaseTopic + F(" jets");
+ doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_jets")+mychipid;
+ doc["stat_t"] = mqttBaseTopic+F("/message");
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["val_tpl"] = F("{{ value_json.HJT }}");
+ doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:hydro-power");
+ doc["avty_t"] = mqttBaseTopic+F("/Status");
+ doc["pl_avail"] = F("Alive");
+ doc["pl_not_avail"] = F("Dead");
+ doc["pl_on"] = F("{CMD:11,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["pl_off"] = F("{CMD:11,VALUE:false,XTIME:0,INTERVAL:0}");
+ doc["state_on"] = 1;
+ doc["state_off"] = 0;
+ if (serializeJson(doc, payload) == 0)
+ {
+ // Serial.println(F("Failed to serialize HA message!"));
+ return;
+ }
+ mqttClient.publish(topic.c_str(), payload.c_str(), true);
+ mqttClient.loop();
+ // Serial.println(payload);
+ doc.clear();
+ doc.garbageCollect();
+
- // spa temperature sensor f
+ /* spa airbubbles switch */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_temperature_f/config");
+ topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_airbubbles/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" temp (F)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_temp_f")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" airbubbles");
+ doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_airbubbles")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°F";
- doc["val_tpl"] = F("{{ value_json.TMPF }}");
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["val_tpl"] = F("{{ value_json.AIR }}");
doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:chart-bubble");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
+ doc["pl_on"] = F("{CMD:2,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["pl_off"] = F("{CMD:2,VALUE:false,XTIME:0,INTERVAL:0}");
+ doc["state_on"] = 1;
+ doc["state_off"] = 0;
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -870,21 +883,25 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa temperature sensor c
+ /* spa pump switch */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_temp_c/config");
+ topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_pump/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" temp (C)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_temp_c")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" pump");
+ doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_pump")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°C";
- doc["val_tpl"] = F("{{ value_json.TMPC }}");
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["val_tpl"] = F("{{ value_json.FLT }}");
doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:pump");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
+ doc["pl_on"] = F("{CMD:4,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["pl_off"] = F("{CMD:4,VALUE:false,XTIME:0,INTERVAL:0}");
+ doc["state_on"] = 1;
+ doc["state_off"] = 0;
if (serializeJson(doc, payload) == 0)
{
// Serial.println(F("Failed to serialize HA message!"));
@@ -896,24 +913,28 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa virtual temperature sensor f
+ /* spa temperature unit switch */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_virtualtemp_f/config");
+ topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_temperature_unit/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" virtual temp (F)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_virtual_temp_f")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" temperature unit F-C");
+ doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_unit")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°F";
- doc["val_tpl"] = F("{{ value_json.VTMF | round(2) }}");
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["val_tpl"] = F("{{ value_json.UNT }}");
doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:circle-outline");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
+ doc["pl_on"] = F("{CMD:1,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["pl_off"] = F("{CMD:1,VALUE:false,XTIME:0,INTERVAL:0}");
+ doc["state_on"] = 1;
+ doc["state_off"] = 0;
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize vtf"));
+ // Serial.println(F("Failed to serialize HA message!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -922,24 +943,29 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa virtual temperature sensor c
+ /* spa take control switch */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_virtualtemp_c/config");
+ topic = String(HA_PREFIX) + F("/switch/") + mqttBaseTopic + F("_take_ctrl/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" virtual temp (C)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_virtual_temp_c")+mychipid;
+ doc["name"] = mqttBaseTopic + F(" take control");
+ doc["uniq_id"] = F("switch.") + mqttBaseTopic + F("_ctrl")+mychipid;
doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°C";
- doc["val_tpl"] = F("{{ value_json.VTMC | round(2) }}");
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["val_tpl"] = F("{{ value_json.GOD }}");
doc["expire_after"] = 700;
+ doc["icon"] = F("mdi:steering");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
+ doc["pl_on"] = F("{CMD:17,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["pl_off"] = F("{CMD:17,VALUE:false,XTIME:0,INTERVAL:0}");
+ doc["state_on"] = 1;
+ doc["state_off"] = 0;
+ doc["assumed_state"] = 0; //get rid of lightning buttons
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize vtc"));
+ // Serial.println(F("Failed to serialize HA message!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -948,24 +974,28 @@ void setupHA()
doc.clear();
doc.garbageCollect();
-// spa target temperature sensor f
+
+ /******************/
+ /* BUTTONS */
+ /******************/
+
+
+ /* spa reset chlorine timer button */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_target_temp_f/config");
+ topic = String(HA_PREFIX) + F("/button/") + mqttBaseTopic + F("_reset_chlorine/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" target temp (F)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_target_temp_f")+mychipid;
- doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°F";
- doc["val_tpl"] = F("{{ value_json.TGTF }}");
- doc["expire_after"] = 700;
+ doc["name"] = mqttBaseTopic + F(" reset chlorine timer");
+ doc["uniq_id"] = F("button.") + mqttBaseTopic + F("_reset_chlorine")+mychipid;
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["payload_press"] = F("{CMD:9,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["icon"] = F("mdi:restart");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize tgtf!"));
+ // Serial.println(F("Failed to serialize HA message!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -974,24 +1004,22 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa target temperature sensor c
+ /* spa reset filter timer button */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_target_temp_c/config");
+ topic = String(HA_PREFIX) + F("/button/") + mqttBaseTopic + F("_reset_filter/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" target temp (C)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_target_temp_c")+mychipid;
- doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°C";
- doc["val_tpl"] = F("{{ value_json.TGTC }}");
- doc["expire_after"] = 700;
+ doc["name"] = mqttBaseTopic + F(" reset filter timer");
+ doc["uniq_id"] = F("button.") + mqttBaseTopic + F("_reset_filter")+mychipid;
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["payload_press"] = F("{CMD:10,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["icon"] = F("mdi:restart");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize tgt!"));
+ // Serial.println(F("Failed to serialize HA message!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -1000,24 +1028,23 @@ void setupHA()
doc.clear();
doc.garbageCollect();
- // spa ambient temperature sensor c
+ /* spa restart esp button */
doc["dev"] = devicedoc["dev"];
payload = "";
- topic = String(HA_PREFIX) + F("/sensor/") + mqttBaseTopic + F("_amb_temp_c/config");
+ topic = String(HA_PREFIX) + F("/button/") + mqttBaseTopic + F("_restart_esp/config");
// Serial.println(topic);
- doc["name"] = mqttBaseTopic + F(" ambient temp (C)");
- doc["uniq_id"] = F("sensor.") + mqttBaseTopic + F("_amb_temp_c")+mychipid;
- doc["stat_t"] = mqttBaseTopic+F("/message");
- doc["unit_of_meas"] = "°C";
- doc["val_tpl"] = F("{{ value_json.AMBC }}");
- doc["expire_after"] = 700;
+ doc["name"] = mqttBaseTopic + F(" restart esp");
+ doc["uniq_id"] = F("button.") + mqttBaseTopic + F("_restart_esp")+mychipid;
+ doc["cmd_t"] = mqttBaseTopic+F("/command");
+ doc["payload_press"] = F("{CMD:6,VALUE:true,XTIME:0,INTERVAL:0}");
+ doc["icon"] = F("mdi:restart");
+ doc["dev_cla"] = F("restart");
doc["avty_t"] = mqttBaseTopic+F("/Status");
doc["pl_avail"] = F("Alive");
doc["pl_not_avail"] = F("Dead");
- doc["dev_cla"] = F("temperature");
if (serializeJson(doc, payload) == 0)
{
- // Serial.println(F("Failed to serialize amb!"));
+ // Serial.println(F("Failed to serialize HA message!"));
return;
}
mqttClient.publish(topic.c_str(), payload.c_str(), true);
@@ -1026,8 +1053,15 @@ void setupHA()
doc.clear();
doc.garbageCollect();
+ doc.clear();
+ doc.garbageCollect();
+
+
+ /****************/
+ /* CLIMATE */
+ /****************/
- // spa climate control
+ /* spa climate control */
doc["dev"] = devicedoc["dev"];
payload = "";
diff --git a/Code/src/main.cpp b/Code/src/main.cpp
index a06e025a..502ad0e4 100644
--- a/Code/src/main.cpp
+++ b/Code/src/main.cpp
@@ -635,14 +635,15 @@ void handleHWtest()
errors += digitalRead(bwc.pins[pin+3]) != state;
}
if(errors > 499)
- result += F("CIO to DSP pin ") + String(pin+3) + F(" fail!");
+ result += F("CIO to DSP pin ") + String(pin+3) + F(" fail!\n");
else if(errors == 0)
- result += F("CIO to DSP pin ") + String(pin+3) + F(" success!");
+ result += F("CIO to DSP pin ") + String(pin+3) + F(" success!\n");
else
- result += F("CIO to DSP pin ") + String(pin+3) + " " + String(errors/500) + F("\% bad");
+ result += F("CIO to DSP pin ") + String(pin+3) + " " + String(errors/500) + F("\% bad\n");
errors = 0;
delay(0);
}
+ result += F("\n");
for(int pin = 0; pin < 3; pin++)
{
pinMode(bwc.pins[pin+3], OUTPUT);
@@ -655,11 +656,11 @@ void handleHWtest()
errors += digitalRead(bwc.pins[pin]) != state;
}
if(errors > 499)
- result += F("DSP to CIO pin ") + String(pin+3) + F(" fail!");
+ result += F("DSP to CIO pin ") + String(pin+3) + F(" fail!\n");
else if(errors == 0)
- result += F("DSP to CIO pin ") + String(pin+3) + F(" success!");
+ result += F("DSP to CIO pin ") + String(pin+3) + F(" success!\n");
else
- result += F("DSP to CIO pin ") + String(pin+3) + " " + String(errors/500) + F("\% bad");
+ result += F("DSP to CIO pin ") + String(pin+3) + " " + String(errors/500) + F("\% bad\n");
errors = 0;
delay(0);
}
@@ -1960,4 +1961,4 @@ void handleESPInfo()
// void setupHA(){}
// void handlePrometheusMetrics(){}
#include "ha.txt"
- #include "prometheus.txt"
\ No newline at end of file
+ #include "prometheus.txt"