mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
MQTT publish shower on start
This commit is contained in:
@@ -28,10 +28,7 @@ void Shower::start() {
|
|||||||
shower_alert_ = settings.shower_alert;
|
shower_alert_ = settings.shower_alert;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (shower_timer_ || shower_alert_) {
|
send_mqtt_stat(false); // send first MQTT publish
|
||||||
char s[7];
|
|
||||||
Mqtt::publish(F("shower_active"), Helpers::render_boolean(s, false));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Shower::loop() {
|
void Shower::loop() {
|
||||||
@@ -95,7 +92,12 @@ void Shower::loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send status of shower to MQTT
|
||||||
void Shower::send_mqtt_stat(bool state) {
|
void Shower::send_mqtt_stat(bool state) {
|
||||||
|
if (!shower_timer_ && !shower_alert_) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// if we're in HA mode make sure we've first sent out the HA MQTT Discovery config topic
|
// if we're in HA mode make sure we've first sent out the HA MQTT Discovery config topic
|
||||||
if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!ha_config_)) {
|
if ((Mqtt::mqtt_format() == Mqtt::Format::HA) && (!ha_config_)) {
|
||||||
Mqtt::register_mqtt_ha_binary_sensor(F("Shower Active"), EMSdevice::DeviceType::BOILER, "shower_active");
|
Mqtt::register_mqtt_ha_binary_sensor(F("Shower Active"), EMSdevice::DeviceType::BOILER, "shower_active");
|
||||||
|
|||||||
Reference in New Issue
Block a user