upgrade to ha-mqtt v1.5.1 - calling withStateTopic() and restoreFromState() is redundant

This commit is contained in:
Nicu Hodos 2025-02-07 16:46:21 +01:00
parent f7ba499292
commit cf581bc03e
2 changed files with 4 additions and 4 deletions

View File

@ -33,19 +33,19 @@ namespace Devices {
[](const char* msg) {
turnLed(strcmp("ON", msg) == 0);
}
}).withStateTopic().restoreFromState().build();
}).restoreStateFromCommand().build();
auto brightnessMqtt = Builder<Number>::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<Switch>::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<Button>::instance(new Button{"Restart", "restart",

View File

@ -23,7 +23,7 @@ lib_deps =
sparkfun/SparkFun BME280@^2.0.9
arkhipenko/TaskScheduler@^3.8.5
https://git.hodos.ro/libraries/wifi.git@^2.0.0
https://git.hodos.ro/libraries/ha-mqtt.git@^1.4.0
https://git.hodos.ro/libraries/ha-mqtt.git@^1.5.1
build_flags = -D WIFI_ALWAYS_ON=1 -D ADAFRUIT_BME=1
[env:laptop_home]