publish led state at startup
This commit is contained in:
parent
22544c225a
commit
f1d41ade51
@ -109,6 +109,10 @@ namespace Mqtt {
|
||||
if (client.connected()) publish(hourFormatMqtt->stateTopic, format24 ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
void publishLedState() {
|
||||
Mqtt::publish(Mqtt::ledMqtt->stateTopic, digitalRead(LED_BUILTIN) ? "OFF" : "ON");
|
||||
}
|
||||
|
||||
void publishConfig() {
|
||||
for (Ha::Component* cmp : sensors) {
|
||||
publishComponentConfig(*cmp);
|
||||
|
||||
@ -25,7 +25,7 @@ Task tButton(TASK_IMMEDIATE, TASK_ONCE, []() {
|
||||
Display::displayTemp(Bmp::data.readTemp());
|
||||
}, &ts);
|
||||
Task tLed(TASK_IMMEDIATE, TASK_ONCE, []() {
|
||||
Mqtt::publish(Mqtt::ledMqtt->stateTopic, digitalRead(LED_BUILTIN) ? "OFF" : "ON");
|
||||
Mqtt::publishLedState();
|
||||
}, &ts);
|
||||
|
||||
void setup() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user