use boolean renderer

This commit is contained in:
proddy
2020-10-05 16:57:56 +02:00
parent 28b5461a85
commit 644292f23b

View File

@@ -57,7 +57,8 @@ void Shower::loop() {
// first check to see if hot water has been on long enough to be recognized as a Shower/Bath
if (!shower_on_ && (time_now - timer_start_) > SHOWER_MIN_DURATION) {
shower_on_ = true;
Mqtt::publish("shower_active", (bool)true);
char s[7];
Mqtt::publish("shower_active", Helpers::render_boolean(s, true));
LOG_DEBUG(F("[Shower] hot water still running, starting shower timer"));
}
// check if the shower has been on too long
@@ -78,7 +79,8 @@ void Shower::loop() {
if ((timer_pause_ - timer_start_) > SHOWER_OFFSET_TIME) {
duration_ = (timer_pause_ - timer_start_ - SHOWER_OFFSET_TIME);
if (duration_ > SHOWER_MIN_DURATION) {
Mqtt::publish(F("shower_active"), (bool)false);
char s[7];
Mqtt::publish(F("shower_active"), Helpers::render_boolean(s, false));
LOG_DEBUG(F("[Shower] finished with duration %d"), duration_);
publish_values();
}