mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 19:12:10 +01:00
Somfy: publish SunFlag, Sunny and Windy states
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
This commit is contained in:
parent
ac4fcab029
commit
c74935aa01
1 changed files with 12 additions and 1 deletions
13
Somfy.cpp
13
Somfy.cpp
|
|
@ -1010,7 +1010,6 @@ void SomfyShade::emitState(uint8_t num, const char *evt) {
|
||||||
mqtt.publish(topic, static_cast<int8_t>(floor(this->myPos)));
|
mqtt.publish(topic, static_cast<int8_t>(floor(this->myPos)));
|
||||||
snprintf(topic, sizeof(topic), "shades/%u/tiltType", this->shadeId);
|
snprintf(topic, sizeof(topic), "shades/%u/tiltType", this->shadeId);
|
||||||
mqtt.publish(topic, static_cast<uint8_t>(this->tiltType));
|
mqtt.publish(topic, static_cast<uint8_t>(this->tiltType));
|
||||||
snprintf(topic, sizeof(topic), "shades/%u/flags", this->flags);
|
|
||||||
if(this->tiltType != tilt_types::none) {
|
if(this->tiltType != tilt_types::none) {
|
||||||
snprintf(topic, sizeof(topic), "shades/%u/myTiltPos", this->shadeId);
|
snprintf(topic, sizeof(topic), "shades/%u/myTiltPos", this->shadeId);
|
||||||
mqtt.publish(topic, static_cast<int8_t>(floor(this->myTiltPos)));
|
mqtt.publish(topic, static_cast<int8_t>(floor(this->myTiltPos)));
|
||||||
|
|
@ -1019,6 +1018,18 @@ void SomfyShade::emitState(uint8_t num, const char *evt) {
|
||||||
snprintf(topic, sizeof(topic), "shades/%u/tiltTarget", this->shadeId);
|
snprintf(topic, sizeof(topic), "shades/%u/tiltTarget", this->shadeId);
|
||||||
mqtt.publish(topic, static_cast<uint8_t>(floor(this->tiltTarget)));
|
mqtt.publish(topic, static_cast<uint8_t>(floor(this->tiltTarget)));
|
||||||
}
|
}
|
||||||
|
else if (this->shadeType == shade_types::awning) {
|
||||||
|
const uint8_t sunFlag = !!(this->flags & static_cast<uint8_t>(somfy_flags_t::SunFlag));
|
||||||
|
const uint8_t isSunny = !!(this->flags & static_cast<uint8_t>(somfy_flags_t::Sunny));
|
||||||
|
const uint8_t isWindy = !!(this->flags & static_cast<uint8_t>(somfy_flags_t::Windy));
|
||||||
|
|
||||||
|
snprintf(topic, sizeof(topic), "shades/%u/sunFlag", this->shadeId);
|
||||||
|
mqtt.publish(topic, sunFlag);
|
||||||
|
snprintf(topic, sizeof(topic), "shades/%u/sunny", this->shadeId);
|
||||||
|
mqtt.publish(topic, isSunny);
|
||||||
|
snprintf(topic, sizeof(topic), "shades/%u/windy", this->shadeId);
|
||||||
|
mqtt.publish(topic, isWindy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool SomfyShade::isIdle() { return this->direction == 0 && this->tiltDirection == 0; }
|
bool SomfyShade::isIdle() { return this->direction == 0 && this->tiltDirection == 0; }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue