mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-05-19 20:53:26 +02:00
Fixes
This commit is contained in:
@@ -18,19 +18,16 @@ void StatusBinarySensor::loop() {
|
||||
bool status = network_is_connected();
|
||||
#ifdef USE_MQTT
|
||||
if (mqtt::global_mqtt_client != nullptr) {
|
||||
status = mqtt::global_mqtt_client->is_connected();
|
||||
status = status && mqtt::global_mqtt_client->is_connected();
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_API
|
||||
if (api::global_api_server != nullptr) {
|
||||
status = api::global_api_server->is_connected();
|
||||
status = status && api::global_api_server->is_connected();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this->last_status_ != status) {
|
||||
this->publish_state(status);
|
||||
this->last_status_ = status;
|
||||
}
|
||||
this->publish_state(status);
|
||||
}
|
||||
void StatusBinarySensor::setup() { this->publish_state(false); }
|
||||
void StatusBinarySensor::dump_config() { LOG_BINARY_SENSOR("", "Status Binary Sensor", this); }
|
||||
|
||||
Reference in New Issue
Block a user