publish state for hour format at startup
This commit is contained in:
parent
3cc84ae4d2
commit
b5e91195e7
@ -105,6 +105,10 @@ namespace Mqtt {
|
||||
publish(brightnessMqtt->stateTopic, message);
|
||||
}
|
||||
|
||||
void publishHourFormat(bool format24) {
|
||||
if (client.connected()) publish(hourFormatMqtt->stateTopic, format24 ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
void publishConfig() {
|
||||
for (Ha::Component* cmp : sensors) {
|
||||
publishComponentConfig(*cmp);
|
||||
@ -113,6 +117,7 @@ namespace Mqtt {
|
||||
publishComponentConfig(*cmp);
|
||||
}
|
||||
publishBrightness();
|
||||
publishHourFormat(Display::hourFormat24);
|
||||
ts.deleteTask(tPublishConfig);
|
||||
}
|
||||
|
||||
@ -153,9 +158,7 @@ namespace Mqtt {
|
||||
|
||||
void setup() {
|
||||
Display::Brightness::onChanged(publishBrightness);
|
||||
Display::onHourFormatChanged([](bool format24) {
|
||||
if (client.connected()) publish(hourFormatMqtt->stateTopic, format24 ? "ON" : "OFF");
|
||||
});
|
||||
Display::onHourFormatChanged(publishHourFormat);
|
||||
client.onConnect([](bool sessionPresent) {
|
||||
tPublishConfig.enable();
|
||||
tPublishBmp.enableIfNot();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user