diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 1fbe933d..d631234c 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -181,6 +181,7 @@ #define HEARTBEAT_REPORT_HOSTNAME 1 #define HEARTBEAT_REPORT_APP 1 #define HEARTBEAT_REPORT_VERSION 1 +#define HEARTBEAT_REPORT_BOARD 1 #define HEARTBEAT_REPORT_INTERVAL 0 //------------------------------------------------------------------------------ @@ -617,6 +618,7 @@ PROGMEM const char* const custom_reset_string[] = { #define MQTT_TOPIC_UARTIN "uartin" #define MQTT_TOPIC_UARTOUT "uartout" #define MQTT_TOPIC_LOADAVG "loadavg" +#define MQTT_TOPIC_BOARD "board" // Light module #define MQTT_TOPIC_CHANNEL "channel" diff --git a/code/espurna/config/hardware.h b/code/espurna/config/hardware.h index 68722f99..61deabcc 100644 --- a/code/espurna/config/hardware.h +++ b/code/espurna/config/hardware.h @@ -772,7 +772,6 @@ #define LED1_PIN 13 #define LED1_PIN_INVERSE 1 - // ----------------------------------------------------------------------------- // YJZK // ----------------------------------------------------------------------------- @@ -1258,7 +1257,6 @@ #define LIGHT_CH3_INVERSE 0 #define LIGHT_CH4_INVERSE 0 - #elif defined(ARILUX_AL_LC02) // Info @@ -1301,7 +1299,6 @@ #define LIGHT_CH4_INVERSE 0 #define LIGHT_CH5_INVERSE 0 - #elif defined(ARILUX_AL_LC11) // Info @@ -1324,7 +1321,6 @@ #define LIGHT_CH4_INVERSE 0 #define LIGHT_CH5_INVERSE 0 - #elif defined(ARILUX_E27) // Info @@ -1590,6 +1586,98 @@ #define LED1_PIN 4 #define LED1_PIN_INVERSE 1 +// ----------------------------------------------------------------------------- +// HEYGO HY02 +// ----------------------------------------------------------------------------- + +#elif defined(HEYGO_HY02) + + // Info + #define MANUFACTURER "HEYGO" + #define DEVICE "HY02" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 0 + #define LED1_PIN_INVERSE 0 + #define LED2_PIN 15 + #define LED2_PIN_INVERSE 0 + + // HLW8012 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 3 + #define HLW8012_CF1_PIN 14 + #define HLW8012_CF_PIN 5 + + #define HLW8012_VOLTAGE_R_UP ( 2 * 1200000 ) // Upstream voltage resistor + +// ----------------------------------------------------------------------------- +// Maxcio W-US002S +// ----------------------------------------------------------------------------- + +#elif defined(MAXCIO_WUS002S) + + // Info + #define MANUFACTURER "MAXCIO" + #define DEVICE "WUS002S" + + // Buttons + #define BUTTON1_PIN 2 + #define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 13 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 3 + #define LED1_PIN_INVERSE 0 + + // HLW8012 + #ifndef HLW8012_SUPPORT + #define HLW8012_SUPPORT 1 + #endif + #define HLW8012_SEL_PIN 12 + #define HLW8012_CF1_PIN 5 + #define HLW8012_CF_PIN 4 + + #define HLW8012_CURRENT_R 0.002 // Current resistor + #define HLW8012_VOLTAGE_R_UP ( 2 * 1000000 ) // Upstream voltage resistor + +// ----------------------------------------------------------------------------- +// YiDian XS-SSA05 +// ----------------------------------------------------------------------------- + +#elif defined(YIDIAN_XSSSA05) + + // Info + #define MANUFACTURER "YIDIAN" + #define DEVICE "XSSSA05" + + // Buttons + #define BUTTON1_PIN 13 + #define BUTTON1_MODE BUTTON_PUSHBUTTON + #define BUTTON1_RELAY 1 + + // Relays + #define RELAY1_PIN 12 + #define RELAY1_TYPE RELAY_TYPE_NORMAL + + // LEDs + #define LED1_PIN 4 + #define LED1_PIN_INVERSE 0 + // ----------------------------------------------------------------------------- // TEST boards (do not use!!) // ----------------------------------------------------------------------------- diff --git a/code/espurna/scheduler.ino b/code/espurna/scheduler.ino index faa89e68..b78f3fc7 100644 --- a/code/espurna/scheduler.ino +++ b/code/espurna/scheduler.ino @@ -26,7 +26,7 @@ void _schWebSocketOnSend(JsonObject &root){ scheduler["schEnabled"] = getSetting("schEnabled", i, 1).toInt() == 1; scheduler["schSwitch"] = getSetting("schSwitch", i, 0).toInt(); scheduler["schAction"] = getSetting("schAction", i, 0).toInt(); - scheduler["schType"] = getSetting("schType", i, 0); + scheduler["schType"] = getSetting("schType", i, 0).toInt(); scheduler["schHour"] = getSetting("schHour", i, 0).toInt(); scheduler["schMinute"] = getSetting("schMinute", i, 0).toInt(); scheduler["schWDs"] = getSetting("schWDs", i, ""); diff --git a/code/espurna/utils.ino b/code/espurna/utils.ino index 9f0e8e0f..bef49c81 100644 --- a/code/espurna/utils.ino +++ b/code/espurna/utils.ino @@ -137,6 +137,9 @@ void heartbeat() { #if (HEARTBEAT_REPORT_VERSION) mqttSend(MQTT_TOPIC_VERSION, APP_VERSION); #endif + #if (HEARTBEAT_REPORT_BOARD) + mqttSend(MQTT_TOPIC_BOARD, getBoardName().c_str()); + #endif #if (HEARTBEAT_REPORT_HOSTNAME) mqttSend(MQTT_TOPIC_HOSTNAME, getSetting("hostname").c_str()); #endif diff --git a/code/html/custom.js b/code/html/custom.js index b2e90172..70181a10 100644 --- a/code/html/custom.js +++ b/code/html/custom.js @@ -1349,8 +1349,8 @@ $(function() { $(".button-add-network").on("click", function() { $(".more", addNetwork()).toggle(); }); - $(".button-add-switch-schedule").on("click", { schType: "1" }, addSchedule); - $(".button-add-light-schedule").on("click", { schType: "2" }, addSchedule); + $(".button-add-switch-schedule").on("click", { schType: 1 }, addSchedule); + $(".button-add-light-schedule").on("click", { schType: 2 }, addSchedule); $(document).on("change", "input", hasChanged); $(document).on("change", "select", hasChanged);