diff --git a/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml b/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml index 7a7231d..3ba0e4d 100644 --- a/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml +++ b/.github/ISSUE_TEMPLATE/BUG-REPORT.yaml @@ -54,7 +54,7 @@ body: - type: textarea id: reprod attributes: - label: "How to reproduce it (setp by step)" + label: "How to reproduce it (step by step)" description: Please enter an explicit description of your issue value: | 1. Go to... diff --git a/Network.cpp b/Network.cpp index af54a44..04e3c1f 100644 --- a/Network.cpp +++ b/Network.cpp @@ -236,7 +236,6 @@ bool Network::connectWired() { Serial.print("Set hostname to:"); Serial.println(ETH.getHostname()); if(!ETH.begin(settings.Ethernet.phyAddress, settings.Ethernet.PWRPin, settings.Ethernet.MDCPin, settings.Ethernet.MDIOPin, settings.Ethernet.phyType, settings.Ethernet.CLKMode)) { - Serial.println("Ethernet Begin failed"); if(settings.connType == conn_types::ethernetpref) { this->wifiFallback = true; @@ -246,9 +245,10 @@ bool Network::connectWired() { } else { if(!settings.IP.dhcp) { - if(!ETH.config(settings.IP.ip, settings.IP.gateway, settings.IP.subnet, settings.IP.dns1, settings.IP.dns2)) - Serial.println("Unable to configure static IP address...."); - ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); + if(!ETH.config(settings.IP.ip, settings.IP.gateway, settings.IP.subnet, settings.IP.dns1, settings.IP.dns2)) { + Serial.println("Unable to configure static IP address...."); + ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); + } } else ETH.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); @@ -467,7 +467,9 @@ bool Network::openSoftAP() { // If no clients have connected in 3 minutes from starting this server reboot this pig. This will // force a reboot cycle until we have some response. That is unless the SSID has been cleared. - if(clients == 0 && strlen(settings.WIFI.ssid) > 0 && millis() - startTime > 3 * 60000) { + if(clients == 0 && + (strlen(settings.WIFI.ssid) > 0 || settings.connType == conn_types::ethernet || settings.connType == conn_types::ethernetpref) && + millis() - startTime > 3 * 60000) { Serial.println(); Serial.println("Stopping AP Mode"); WiFi.softAPdisconnect(true); diff --git a/Somfy.cpp b/Somfy.cpp index 56f2c55..6d24bc1 100644 --- a/Somfy.cpp +++ b/Somfy.cpp @@ -3193,19 +3193,16 @@ void SomfyShadeController::emitState(uint8_t num) { } void SomfyShadeController::publish() { this->updateGroupFlags(); - StaticJsonDocument<128> docShades; - StaticJsonDocument<128> docGroups; - JsonArray arrShades = docShades.to(); - JsonArray arrGroups = docGroups.to(); + char arrIds[128] = "["; for(uint8_t i = 0; i < SOMFY_MAX_SHADES; i++) { SomfyShade *shade = &this->shades[i]; - if(shade->getShadeId() == 255) { - continue; - } - arrShades.add(shade->getShadeId()); + if(shade->getShadeId() == 255) continue; + if(strlen(arrIds) > 1) strcat(arrIds, ","); + itoa(shade->getShadeId(), &arrIds[strlen(arrIds)], 10); shade->publish(); } - mqtt.publish("shades", arrShades, true); + strcat(arrIds, "]"); + mqtt.publish("shades", arrIds, true); for(uint8_t i = 1; i <= SOMFY_MAX_SHADES; i++) { SomfyShade *shade = this->getShadeById(i); if(shade) continue; @@ -3213,18 +3210,21 @@ void SomfyShadeController::publish() { SomfyShade::unpublish(i); } } + strcpy(arrIds, "["); for(uint8_t i = 0; i < SOMFY_MAX_GROUPS; i++) { SomfyGroup *group = &this->groups[i]; if(group->getGroupId() == 255) continue; - arrGroups.add(group->getGroupId()); + if(strlen(arrIds) > 1) strcat(arrIds, ","); + itoa(group->getGroupId(), &arrIds[strlen(arrIds)], 10); group->publish(); } + strcat(arrIds, "]"); + mqtt.publish("groups", arrIds, true); for(uint8_t i = 1; i <= SOMFY_MAX_GROUPS; i++) { SomfyGroup *group = this->getGroupById(i); if(group) continue; else SomfyGroup::unpublish(i); } - mqtt.publish("groups", arrGroups, true); } uint8_t SomfyShadeController::getNextShadeId() { // There is no shortcut for this since the deletion of diff --git a/SomfyController.ino.esp32.bin b/SomfyController.ino.esp32.bin index cc20c14..c806bb0 100644 Binary files a/SomfyController.ino.esp32.bin and b/SomfyController.ino.esp32.bin differ diff --git a/SomfyController.ino.esp32s3.bin b/SomfyController.ino.esp32s3.bin index f63e93b..6e4144d 100644 Binary files a/SomfyController.ino.esp32s3.bin and b/SomfyController.ino.esp32s3.bin differ