mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 23:18:10 +01:00
Fixes
This commit is contained in:
parent
bd45f6bd8e
commit
aa7389432e
3 changed files with 5 additions and 10 deletions
|
@ -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]))
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue