diff --git a/esphome/components/ethernet/__init__.py b/esphome/components/ethernet/__init__.py index 50a0d99d32..ce7422d05b 100644 --- a/esphome/components/ethernet/__init__.py +++ b/esphome/components/ethernet/__init__.py @@ -67,7 +67,7 @@ CONFIG_SCHEMA = cv.All(cv.Schema({ cv.Optional(CONF_USE_ADDRESS): cv.string_strict, cv.Optional('hostname'): cv.invalid("The hostname option has been removed in 1.11.0"), -}), validate) +}).extend(cv.COMPONENT_SCHEMA), validate) def manual_ip(config): @@ -84,6 +84,7 @@ def manual_ip(config): @coroutine_with_priority(60.0) def to_code(config): var = cg.new_Pvariable(config[CONF_ID]) + yield cg.register_component(var, config) cg.add(var.set_phy_addr(config[CONF_PHY_ADDR])) cg.add(var.set_mdc_pin(config[CONF_MDC_PIN])) diff --git a/esphome/components/status/status_binary_sensor.cpp b/esphome/components/status/status_binary_sensor.cpp index 5485c6ebcd..d004c70b95 100644 --- a/esphome/components/status/status_binary_sensor.cpp +++ b/esphome/components/status/status_binary_sensor.cpp @@ -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); } diff --git a/esphome/components/status/status_binary_sensor.h b/esphome/components/status/status_binary_sensor.h index fa121291a1..08aa0fb32f 100644 --- a/esphome/components/status/status_binary_sensor.h +++ b/esphome/components/status/status_binary_sensor.h @@ -16,9 +16,6 @@ class StatusBinarySensor : public binary_sensor::BinarySensor, public Component float get_setup_priority() const override { return setup_priority::DATA; } bool is_status_binary_sensor() const override { return true; } - - protected: - bool last_status_{false}; }; } // namespace status