From cf581bc03e9ea476cc39e0ed39d91cd8f02be940 Mon Sep 17 00:00:00 2001 From: Nicu Hodos Date: Fri, 7 Feb 2025 16:46:21 +0100 Subject: [PATCH] upgrade to ha-mqtt v1.5.1 - calling withStateTopic() and restoreFromState() is redundant --- include/devices.h | 6 +++--- platformio.ini | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/devices.h b/include/devices.h index 8f67ef3..4f174d6 100644 --- a/include/devices.h +++ b/include/devices.h @@ -33,19 +33,19 @@ namespace Devices { [](const char* msg) { turnLed(strcmp("ON", msg) == 0); } - }).withStateTopic().restoreFromState().build(); + }).restoreStateFromCommand().build(); auto brightnessMqtt = Builder::instance(new Number{ "Brightness", "brightness", [](const char* msg) { Display::Brightness::set(String{ msg }.toInt()); } - }).withMin(BRIGHTNESS_MIN).withMax(BRIGHTNESS_MAX).withStep(BRIGHTNESS_STEP).withStateTopic().restoreFromState().build(); + }).withMin(BRIGHTNESS_MIN).withMax(BRIGHTNESS_MAX).withStep(BRIGHTNESS_STEP).restoreStateFromCommand().build(); auto hourFormatMqtt = Builder::instance(new Switch{ "Format 24h", "format_24h", [](const char* msg) { strcmp("ON", msg) == 0 ? Display::changeHourFormat24(true) : Display::changeHourFormat24(false); } - }).withStateTopic().restoreFromState().build(); + }).restoreStateFromCommand().build(); auto button = Builder