fix: turn a group's sun flag on, not off, for MQTT sunFlag 1

groups/+/sunFlag/set sent Flag for 1 and SunFlag for 0, the opposite of the
shade topic.  SunFlag turns the flag on.  Both topics now take the command
from sunFlagCommand() so they can't drift apart again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-12 20:55:21 +02:00
parent b51292889f
commit d85b3d30c8
4 changed files with 11 additions and 6 deletions

View file

@ -127,8 +127,7 @@ void MQTTClass::receive(const char *topic, byte*payload, uint32_t length) {
shade->setMyPosition(shade->myPos, val);
}
else if(strncmp(command, "sunFlag", sizeof(command)) == 0) {
if(val > 0) shade->sendCommand(somfy_commands::SunFlag);
else shade->sendCommand(somfy_commands::Flag);
shade->sendCommand(sunFlagCommand(val > 0));
}
else if(strncmp(command, "position", sizeof(command)) == 0) {
if(val >= 0 && val <= 100) {
@ -164,10 +163,7 @@ void MQTTClass::receive(const char *topic, byte*payload, uint32_t length) {
group->sendCommand(somfy_commands::My);
}
else if(strncmp(command, "sunFlag", sizeof(command)) == 0) {
if(val > 0)
group->sendCommand(somfy_commands::Flag);
else
group->sendCommand(somfy_commands::SunFlag);
group->sendCommand(sunFlagCommand(val > 0));
}
else if(strncmp(command, "sunny", sizeof(command)) == 0) {
if(val >= 0) group->sendSensorCommand(-1, val, group->repeats);