mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Fix static IP for ETH connections #268
This commit is contained in:
parent
bf8da394d5
commit
bbefe7fe6d
5 changed files with 19 additions and 17 deletions
22
Somfy.cpp
22
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>();
|
||||
JsonArray arrGroups = docGroups.to<JsonArray>();
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue