Browse Source

Merge remote-tracking branch 'xoseperez/dev' into lightfox-dual

rules-rpn
Andrey F. Kupreychik 6 years ago
parent
commit
b0eb847155
17 changed files with 380 additions and 94 deletions
  1. +1
    -1
      .github/contribute.md
  2. +2
    -0
      code/espurna/config/arduino.h
  3. +19
    -1
      code/espurna/config/dependencies.h
  4. +62
    -1
      code/espurna/config/hardware.h
  5. +89
    -8
      code/espurna/domoticz.ino
  6. +12
    -0
      code/espurna/influxdb.ino
  7. +13
    -0
      code/espurna/led.ino
  8. +1
    -0
      code/espurna/ota.ino
  9. +1
    -33
      code/espurna/relay.ino
  10. +95
    -38
      code/espurna/rfbridge.ino
  11. +1
    -2
      code/espurna/rfm69.ino
  12. +15
    -3
      code/espurna/thinkspeak.ino
  13. +7
    -3
      code/espurna/utils.ino
  14. +2
    -0
      code/espurna/wifi.ino
  15. +8
    -3
      code/espurna/ws.ino
  16. +1
    -1
      code/ota.py
  17. +51
    -0
      code/platformio.ini

+ 1
- 1
.github/contribute.md View File

@ -9,7 +9,7 @@ Second. Let's try to keep it homogeneous and readable. I have my coding style. I
* **Only touch relevant files** (beware if your editor has auto-formatting feature enabled)
* If you are adding a new functionality (new hardware, new library support) not related to an existing component move it to it's **own modules** (.ino file)
* If you are adding new library, include it in one of the **sample travis profiles**, so our integrated CI will try to compile it.
* Make sure you check [Coding Style](CodingStyle)
* Make sure you check [Coding Style](https://github.com/xoseperez/espurna/wiki/CodingStyle)
* PRs that don't compile (break Travis) or cause more coding errors (as reported by Codacy) will not be merged. Please fix the issue. Same goes for PRs that are raised against older commit in dev - you might need to rebase and resolve conflicts.


+ 2
- 0
code/espurna/config/arduino.h View File

@ -110,6 +110,8 @@
//#define MAGICHOME_ZJ_WFMN_B_11
//#define GBLIFE_RGBW_SOCKET
//#define SMARTLIFE_MINI_SMART_SOCKET
//#define GOSUND_SP1_V23
//#define ARILUX_AL_LC02_V14
//#define FOXEL_LIGHTFOX_DUAL
//--------------------------------------------------------------------------------


+ 19
- 1
code/espurna/config/dependencies.h View File

@ -33,9 +33,21 @@
#define DEBUG_SERIAL_SUPPORT 0
#endif
#if ALEXA_SUPPORT
#undef BROKER_SUPPORT
#define BROKER_SUPPORT 1 // If Alexa enabled enable BROKER
#endif
#if INFLUXDB_SUPPORT
#undef BROKER_SUPPORT
#define BROKER_SUPPORT 1 // If InfluxDB enabled enable BROKER
#endif
#if DOMOTICZ_SUPPORT
#undef MQTT_SUPPORT
#define MQTT_SUPPORT 1 // If Domoticz enabled enable MQTT
#undef BROKER_SUPPORT
#define BROKER_SUPPORT 1 // If Domoticz enabled enable BROKER
#endif
#if HOMEASSISTANT_SUPPORT
@ -45,8 +57,14 @@
#ifndef ASYNC_TCP_SSL_ENABLED
#if THINGSPEAK_USE_SSL && THINGSPEAK_USE_ASYNC
#undef THINGSPEAK_SUPPORT // Thingspeak in ASYNC mode requires ASYNC_TCP_SSL_ENABLED
#undef THINGSPEAK_SUPPORT
#define THINGSPEAK_SUPPORT 0 // Thingspeak in ASYNC mode requires ASYNC_TCP_SSL_ENABLED
#endif
#endif
#if THINKSPEAK_SUPPORT
#undef BROKER_SUPPORT
#define BROKER_SUPPORT 1 // If Thingspeak enabled enable BROKER
#endif
#if SCHEDULER_SUPPORT


+ 62
- 1
code/espurna/config/hardware.h View File

@ -1637,6 +1637,26 @@
#define LIGHT_CH3_INVERSE 0
#define LIGHT_CH4_INVERSE 0
#elif defined(ARILUX_AL_LC02_V14)
// Info
#define MANUFACTURER "ARILUX"
#define DEVICE "AL_LC02_V14"
#define RELAY_PROVIDER RELAY_PROVIDER_LIGHT
#define LIGHT_PROVIDER LIGHT_PROVIDER_DIMMER
#define DUMMY_RELAY_COUNT 1
// Light
#define LIGHT_CHANNELS 4
#define LIGHT_CH1_PIN 14 // RED
#define LIGHT_CH2_PIN 5 // GREEN
#define LIGHT_CH3_PIN 12 // BLUE
#define LIGHT_CH4_PIN 13 // WHITE1
#define LIGHT_CH1_INVERSE 0
#define LIGHT_CH2_INVERSE 0
#define LIGHT_CH3_INVERSE 0
#define LIGHT_CH4_INVERSE 0
#elif defined(ARILUX_AL_LC06)
// Info
@ -2651,7 +2671,7 @@
// * Blitzwolf (https://www.amazon.es/Inteligente-Temporización-Dispositivos-Cualquier-BlitzWolf/dp/B07BMQP142)
// * HomeCube (https://www.amazon.de/Steckdose-Homecube-intelligente-Verbrauchsanzeige-funktioniert/dp/B076Q2LKHG)
// * Coosa (https://www.amazon.com/COOSA-Monitoring-Function-Campatible-Assiatant/dp/B0788W9TDR)
// * Goosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5)
// * Gosund (http://www.gosund.com/?m=content&c=index&a=show&catid=6&id=5)
// * Ablue (https://www.amazon.de/Intelligente-Steckdose-Ablue-Funktioniert-Assistant/dp/B076DRFRZC)
// -----------------------------------------------------------------------------
@ -2774,6 +2794,47 @@
#define HLW8012_POWER_RATIO 2533110
#define HLW8012_INTERRUPT_ON FALLING
// -----------------------------------------------------------------------------
// Several boards under different names uing a power chip labelled BL0937 or HJL-01
// -----------------------------------------------------------------------------
#elif defined(GOSUND_SP1_V23)
// Info
#define MANUFACTURER "GOSUND"
#define DEVICE "SP1_v23"
// Buttons
#define BUTTON1_PIN 3
#define BUTTON1_MODE BUTTON_PUSHBUTTON | BUTTON_DEFAULT_HIGH
#define BUTTON1_RELAY 1
// Relays
#define RELAY1_PIN 14
#define RELAY1_TYPE RELAY_TYPE_NORMAL
// LEDs
#define LED1_PIN 1
#define LED1_PIN_INVERSE 1
#define LED2_PIN 13
#define LED2_PIN_INVERSE 0
#define LED2_MODE LED_MODE_FINDME
#define LED2_RELAY 1
// HJL01 / BL0937
#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_SEL_CURRENT LOW
#define HLW8012_CURRENT_RATIO 25740
#define HLW8012_VOLTAGE_RATIO 313400
#define HLW8012_POWER_RATIO 3414290
#define HLW8012_INTERRUPT_ON FALLING
// ----------------------------------------------------------------------------------------
// Homecube 16A is similar but some pins differ and it also has RGB LEDs
// https://www.amazon.de/gp/product/B07D7RVF56/ref=oh_aui_detailpage_o00_s01?ie=UTF8&psc=1


+ 89
- 8
code/espurna/domoticz.ino View File

@ -67,11 +67,79 @@ void _domoticzMqtt(unsigned int type, const char * topic, const char * payload)
// IDX
unsigned int idx = root["idx"];
unsigned char relayID = _domoticzRelay(idx);
if (relayID >= 0) {
unsigned char value = root["nvalue"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %u for IDX %u\n"), value, idx);
relayStatus(relayID, value == 1);
String stype = root["stype"];
if (
(stype.equals("RGB") || stype.equals("RGBW") || stype.equals("RGBWW"))
) {
#if LIGHT_PROVIDER != LIGHT_PROVIDER_NONE
if (lightHasColor()) {
// m field contains information about color mode (enum ColorMode from domoticz ColorSwitch.h):
unsigned int cmode = root["Color"]["m"];
unsigned int cval;
if (cmode == 3 || cmode == 4) { // ColorModeRGB or ColorModeCustom - see domoticz ColorSwitch.h
// RED
cval = root["Color"]["r"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received RED value %u for IDX %u\n"), cval, idx);
lightChannel(0, cval);
// GREEN
cval = root["Color"]["g"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received GREEN value %u for IDX %u\n"), cval, idx);
lightChannel(1, cval);
// BLUE
cval = root["Color"]["b"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received BLUE value %u for IDX %u\n"), cval, idx);
lightChannel(2, cval);
// WARM WHITE or MONOCHROME WHITE if supported
if (lightChannels() > 3) {
cval = root["Color"]["ww"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received WARM WHITE value %u for IDX %u\n"), cval, idx);
lightChannel(3, cval);
}
// COLD WHITE if supported
if (lightChannels() > 4) {
cval = root["Color"]["cw"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received COLD WHITE value %u for IDX %u\n"), cval, idx);
lightChannel(4, cval);
}
unsigned int brightness = root["Level"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received BRIGHTNESS value %u for IDX %u\n"), brightness, idx);
unsigned int br = (brightness / 100.0) * LIGHT_MAX_BRIGHTNESS;
DEBUG_MSG_P(PSTR("[DOMOTICZ] Calculated BRIGHTNESS value %u for IDX %u\n"), br, idx);
lightBrightness(br); // domoticz uses 100 as maximum value while we're using LIGHT_MAX_BRIGHTNESS
// update lights
lightUpdate(true, mqttForward());
}
unsigned char relayID = _domoticzRelay(idx);
if (relayID >= 0) {
unsigned char value = root["nvalue"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %u for IDX %u\n"), value, idx);
relayStatus(relayID, value > 0);
}
}
#else
DEBUG_MSG_P(PSTR("[DOMOTICZ] ESPurna compiled without LIGHT_PROVIDER"));
#endif
} else {
unsigned char relayID = _domoticzRelay(idx);
if (relayID >= 0) {
unsigned char value = root["nvalue"];
DEBUG_MSG_P(PSTR("[DOMOTICZ] Received value %u for IDX %u\n"), value, idx);
relayStatus(relayID, value == 1);
}
}
}
@ -80,6 +148,15 @@ void _domoticzMqtt(unsigned int type, const char * topic, const char * payload)
};
#if BROKER_SUPPORT
void _domoticzBrokerCallback(const char * topic, unsigned char id, const char * payload) {
if (strcmp(MQTT_TOPIC_RELAY, topic) == 0) {
unsigned char value = atoi(payload);
domoticzSendRelay(id, value == 1);
}
}
#endif // BROKER_SUPPORT
#if WEB_SUPPORT
bool _domoticzWebSocketOnReceive(const char * key, JsonVariant& value) {
@ -137,16 +214,16 @@ template<typename T> void domoticzSend(const char * key, T nvalue) {
domoticzSend(key, nvalue, "");
}
void domoticzSendRelay(unsigned char relayID) {
void domoticzSendRelay(unsigned char relayID, bool status) {
if (!_dcz_enabled) return;
char buffer[15];
snprintf_P(buffer, sizeof(buffer), PSTR("dczRelayIdx%u"), relayID);
domoticzSend(buffer, relayStatus(relayID) ? "1" : "0");
domoticzSend(buffer, status ? "1" : "0");
}
void domoticzSendRelays() {
for (uint8_t relayID=0; relayID < relayCount(); relayID++) {
domoticzSendRelay(relayID);
domoticzSendRelay(relayID, relayStatus(relayID));
}
}
@ -165,6 +242,10 @@ void domoticzSetup() {
wsOnReceiveRegister(_domoticzWebSocketOnReceive);
#endif
#if BROKER_SUPPORT
brokerRegister(_domoticzBrokerCallback);
#endif
// Callbacks
mqttRegister(_domoticzMqtt);
espurnaRegisterReload(_domoticzConfigure);


+ 12
- 0
code/espurna/influxdb.ino View File

@ -38,6 +38,14 @@ void _idbConfigure() {
}
}
#if BROKER_SUPPORT
void _idbBrokerCallback(const char * topic, unsigned char id, const char * payload) {
if (strcmp(MQTT_TOPIC_RELAY, topic) == 0) {
idbSend(topic, id, (char *) payload);
}
}
#endif // BROKER_SUPPORT
// -----------------------------------------------------------------------------
bool idbSend(const char * topic, const char * payload) {
@ -108,6 +116,10 @@ void idbSetup() {
wsOnReceiveRegister(_idbWebSocketOnReceive);
#endif
#if BROKER_SUPPORT
brokerRegister(_idbBrokerCallback);
#endif
// Main callbacks
espurnaRegisterReload(_idbConfigure);


+ 13
- 0
code/espurna/led.ino View File

@ -73,6 +73,14 @@ void _ledWebSocketOnSend(JsonObject& root) {
#endif
#if BROKER_SUPPORT
void _ledBrokerCallback(const char * topic, unsigned char id, const char * payload) {
if (strcmp(MQTT_TOPIC_RELAY, topic) == 0) {
ledUpdate(true);
}
}
#endif // BROKER_SUPPORT
#if MQTT_SUPPORT
void _ledMQTTCallback(unsigned int type, const char * topic, const char * payload) {
@ -173,6 +181,11 @@ void ledSetup() {
wsOnReceiveRegister(_ledWebSocketOnReceive);
#endif
#if BROKER_SUPPORT
brokerRegister(_ledBrokerCallback);
#endif
DEBUG_MSG_P(PSTR("[LED] Number of leds: %d\n"), _leds.size());
// Main callbacks


+ 1
- 0
code/espurna/ota.ino View File

@ -118,6 +118,7 @@ void _otaFrom(const char * host, unsigned int port, const char * url) {
_ota_size += len;
DEBUG_MSG_P(PSTR("[OTA] Progress: %u bytes\r"), _ota_size);
delay(0);
}, NULL);


+ 1
- 33
code/espurna/relay.ino View File

@ -166,7 +166,7 @@ void _relayProcess(bool mode) {
// Only process the relays we have to change
if (target == _relays[id].current_status) continue;
// Only process the relays we have change to the requested mode
// Only process the relays we have to change to the requested mode
if (target != mode) continue;
// Only process if the change_time has arrived
@ -203,24 +203,6 @@ void _relayProcess(bool mode) {
}
#if DOMOTICZ_SUPPORT
domoticzSendRelay(id);
#endif
#if INFLUXDB_SUPPORT
relayInfluxDB(id);
#endif
#if THINGSPEAK_SUPPORT
tspkEnqueueRelay(id, target);
tspkFlush();
#endif
// Flag relay-based LEDs to update status
#if LED_SUPPORT
ledUpdate(true);
#endif
_relays[id].report = false;
_relays[id].group_report = false;
@ -995,20 +977,6 @@ void relaySetupMQTT() {
#endif
//------------------------------------------------------------------------------
// InfluxDB
//------------------------------------------------------------------------------
#if INFLUXDB_SUPPORT
void relayInfluxDB(unsigned char id) {
if (id >= _relays.size()) return;
idbSend(MQTT_TOPIC_RELAY, id, relayStatus(id) ? "1" : "0");
}
#endif
//------------------------------------------------------------------------------
// Settings
//------------------------------------------------------------------------------


+ 95
- 38
code/espurna/rfbridge.ino View File

@ -453,7 +453,50 @@ bool _rfbSameOnOff(unsigned char id) {
return _rfbCompare(rfbRetrieve(id, true).c_str(), rfbRetrieve(id, false).c_str());
}
void _rfbParseCode(char * code) {
// The payload may be a code in HEX format ([0-9A-Z]{18}) or
// the code comma the number of times to transmit it.
char * tok = strtok(code, ",");
// Check if a switch is linked to that message
unsigned char id;
unsigned char status = 0;
if (_rfbMatch(tok, id, status)) {
if (status == 2) {
relayToggle(id);
} else {
relayStatus(id, status == 1);
}
return;
}
#if RF_RAW_SUPPORT
byte message[RF_MAX_MESSAGE_SIZE];
int len = _rfbToArray(tok, message, 0);
if ((len > 0) && (isRFRaw || len != RF_MESSAGE_SIZE)) {
_rfbSendRawOnce(message, len);
} else {
tok = strtok(NULL, ",");
byte times = (tok != NULL) ? atoi(tok) : 1;
_rfbSend(message, times);
}
#else // RF_RAW_SUPPORT
byte message[RF_MESSAGE_SIZE];
if (_rfbToArray(tok, message)) {
tok = strtok(NULL, ",");
byte times = (tok != NULL) ? atoi(tok) : 1;
_rfbSend(message, times);
}
#endif // RF_RAW_SUPPORT
}
#if MQTT_SUPPORT
void _rfbMqttCallback(unsigned int type, const char * topic, const char * payload) {
if (type == MQTT_CONNECT_EVENT) {
@ -498,55 +541,65 @@ void _rfbMqttCallback(unsigned int type, const char * topic, const char * payloa
#endif
#if not RF_SUPPORT
if (isRFOut || isRFRaw) {
// The payload may be a code in HEX format ([0-9A-Z]{18}) or
// the code comma the number of times to transmit it.
char * tok = strtok((char *) payload, ",");
// Check if a switch is linked to that message
unsigned char id;
unsigned char status = 0;
if (_rfbMatch(tok, id, status)) {
if (status == 2) {
relayToggle(id);
} else {
relayStatus(id, status == 1);
}
return;
if (isRFOut || isRFRaw) {
_rfbParseCode((char *) payload);
}
#endif // not RF_SUPPORT
#if RF_RAW_SUPPORT
}
byte message[RF_MAX_MESSAGE_SIZE];
int len = _rfbToArray(tok, message, 0);
if ((len > 0) && (isRFRaw || len != RF_MESSAGE_SIZE)) {
_rfbSendRawOnce(message, len);
} else {
tok = strtok(NULL, ",");
byte times = (tok != NULL) ? atoi(tok) : 1;
_rfbSend(message, times);
}
}
#else // RF_RAW_SUPPORT
#endif // MQTT_SUPPORT
byte message[RF_MESSAGE_SIZE];
if (_rfbToArray(tok, message)) {
tok = strtok(NULL, ",");
byte times = (tok != NULL) ? atoi(tok) : 1;
_rfbSend(message, times);
}
#if API_SUPPORT
#endif // RF_RAW_SUPPORT
void _rfbAPISetup() {
apiRegister(MQTT_TOPIC_RFOUT,
[](char * buffer, size_t len) {
snprintf_P(buffer, len, PSTR("OK"));
},
[](const char * payload) {
_rfbParseCode((char *) payload);
}
);
apiRegister(MQTT_TOPIC_RFLEARN,
[](char * buffer, size_t len) {
snprintf_P(buffer, len, PSTR("OK"));
},
[](const char * payload) {
// The payload must be the relayID plus the mode (0 or 1)
char * tok = strtok((char *) payload, ",");
if (NULL == tok) return;
if (!isNumber(tok)) return;
_learnId = atoi(tok);
if (_learnId >= relayCount()) {
DEBUG_MSG_P(PSTR("[RF] Wrong learnID (%d)\n"), _learnId);
return;
}
tok = strtok(NULL, ",");
if (NULL == tok) return;
_learnStatus = (char) tok[0] != '0';
_rfbLearn();
}
);
#endif // not RF_SUPPORT
}
#if RF_RAW_SUPPORT
apiRegister(MQTT_TOPIC_RFRAW,
[](char * buffer, size_t len) {
snprintf_P(buffer, len, PSTR("OK"));
},
[](const char * payload) {
_rfbParseCode(payload);
}
);
#endif // RF_RAW_SUPPORT
}
#endif
#endif // API_SUPPORT
#if TERMINAL_SUPPORT
@ -693,6 +746,10 @@ void rfbSetup() {
mqttRegister(_rfbMqttCallback);
#endif
#if API_SUPPORT
_rfbAPISetup();
#endif
#if WEB_SUPPORT
wsOnSendRegister(_rfbWebSocketOnSend);
wsOnActionRegister(_rfbWebSocketOnAction);


+ 1
- 2
code/espurna/rfm69.ino View File

@ -118,9 +118,8 @@ void _rfm69Process(packet_t * data) {
// Is node beyond RFM69_MAX_NODES?
if (data->senderID >= RFM69_MAX_NODES) return;
// Count seen nodes and packets
// Count seen nodes
if (_rfm69_node_info[data->senderID].count == 0) ++_rfm69_node_count;
++_rfm69_packet_count;
// Detect duplicates and missing packets
// packetID==0 means device is not sending packetID info


+ 15
- 3
code/espurna/thinkspeak.ino View File

@ -35,6 +35,16 @@ unsigned char _tspk_tries = 0;
// -----------------------------------------------------------------------------
#if BROKER_SUPPORT
void _tspkBrokerCallback(const char * topic, unsigned char id, const char * payload) {
if (strcmp(MQTT_TOPIC_RELAY, topic) == 0) {
tspkEnqueueRelay(id, (char *) payload);
tspkFlush();
}
}
#endif // BROKER_SUPPORT
#if WEB_SUPPORT
bool _tspkWebSocketOnReceive(const char * key, JsonVariant& value) {
@ -259,12 +269,10 @@ void _tspkFlush() {
// -----------------------------------------------------------------------------
bool tspkEnqueueRelay(unsigned char index, unsigned char status) {
bool tspkEnqueueRelay(unsigned char index, char * payload) {
if (!_tspk_enabled) return true;
unsigned char id = getSetting("tspkRelay", index, 0).toInt();
if (id > 0) {
char payload[3] = {0};
itoa(status ? 1 : 0, payload, 10);
_tspkEnqueue(id, payload);
return true;
}
@ -298,6 +306,10 @@ void tspkSetup() {
wsOnReceiveRegister(_tspkWebSocketOnReceive);
#endif
#if BROKER_SUPPORT
brokerRegister(_tspkBrokerCallback);
#endif
DEBUG_MSG_P(PSTR("[THINGSPEAK] Async %s, SSL %s\n"),
THINGSPEAK_USE_ASYNC ? "ENABLED" : "DISABLED",
THINGSPEAK_USE_SSL ? "ENABLED" : "DISABLED"


+ 7
- 3
code/espurna/utils.ino View File

@ -573,15 +573,19 @@ bool isNumber(const char * s) {
unsigned char len = strlen(s);
if (0 == len) return false;
bool decimal = false;
bool digit = false;
for (unsigned char i=0; i<len; i++) {
if (s[i] == '-') {
if (('-' == s[i]) || ('+' == s[i])) {
if (i>0) return false;
} else if (s[i] == '.') {
if (!digit) return false;
if (decimal) return false;
decimal = true;
} else if (!isdigit(s[i])) {
return false;
} else {
digit = true;
}
}
return true;
}
return digit;
}

+ 2
- 0
code/espurna/wifi.ino View File

@ -469,6 +469,7 @@ void _wifiWebSocketOnAction(uint32_t client_id, const char * action, JsonObject&
void wifiDebug(WiFiMode_t modes) {
#if DEBUG_SUPPORT
bool footer = false;
if (((modes & WIFI_STA) > 0) && ((WiFi.getMode() & WIFI_STA) > 0)) {
@ -509,6 +510,7 @@ void wifiDebug(WiFiMode_t modes) {
if (footer) {
DEBUG_MSG_P(PSTR("[WIFI] ----------------------------------------------\n"));
}
#endif //DEBUG_SUPPORT
}


+ 8
- 3
code/espurna/ws.ino View File

@ -66,8 +66,6 @@ bool _wsAuth(AsyncWebSocketClient * client) {
}
if (index == WS_BUFFER_SIZE) {
DEBUG_MSG_P(PSTR("[WEBSOCKET] Validation check failed\n"));
wsSend_P(client->id(), PSTR("{\"message\": 10}"));
return false;
}
@ -367,8 +365,15 @@ void _wsEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventTy
if (type == WS_EVT_CONNECT) {
client->_tempObject = nullptr;
#ifndef NOWSAUTH
if (!_wsAuth(client)) return;
if (!_wsAuth(client)) {
wsSend_P(client->id(), PSTR("{\"message\": 10}"));
DEBUG_MSG_P(PSTR("[WEBSOCKET] Validation check failed\n"));
client->close();
return;
}
#endif
IPAddress ip = client->remoteIP();


+ 1
- 1
code/ota.py View File

@ -75,7 +75,7 @@ def list_devices():
"""
Shows the list of discovered devices
"""
output_format="{:>3} {:<14} {:<15} {:<17} {:<12} {:<8} {:<25} {:<8} {:<8} {:<10}"
output_format="{:>3} {:<14} {:<15} {:<17} {:<12} {:<12} {:<25} {:<8} {:<8} {:<10}"
print(output_format.format(
"#",
"HOSTNAME",


+ 51
- 0
code/platformio.ini View File

@ -1427,6 +1427,31 @@ upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:arilux-al-lc02-v14]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DARILUX_AL_LC02_V14
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:arilux-al-lc02-v14-ota]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DARILUX_AL_LC02_V14
upload_speed = ${common.upload_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:arilux-al-lc06]
platform = ${common.platform}
framework = ${common.framework}
@ -2753,6 +2778,32 @@ upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts}
[env:gosund-sp1-v23]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DGOSUND_SP1_V23
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
extra_scripts = ${common.extra_scripts}
[env:gosund-sp1-v23-ota]
platform = ${common.platform}
framework = ${common.framework}
board = ${common.board_1m}
board_build.flash_mode = ${common.flash_mode}
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_flags = ${common.build_flags_1m0m} -DGOSUND_SP1_V23
upload_speed = ${common.upload_speed}
monitor_speed = ${common.monitor_speed}
upload_port = ${common.upload_port}
upload_flags = ${common.upload_flags}
extra_scripts = ${common.extra_scripts}
[env:homecube-16a]
platform = ${common.platform}
framework = ${common.framework}


Loading…
Cancel
Save