mirror of
https://github.com/esphome/esphome.git
synced 2025-02-15 01:18:16 +00:00
Merge branch 'dev' into integration
This commit is contained in:
commit
0859535b46
@ -147,7 +147,7 @@ void MQTTClientComponent::dump_config() {
|
|||||||
ESP_LOGCONFIG(TAG, " Availability: '%s'", this->availability_.topic.c_str());
|
ESP_LOGCONFIG(TAG, " Availability: '%s'", this->availability_.topic.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool MQTTClientComponent::can_proceed() { return this->is_connected(); }
|
bool MQTTClientComponent::can_proceed() { return network::is_disabled() || this->is_connected(); }
|
||||||
|
|
||||||
void MQTTClientComponent::start_dnslookup_() {
|
void MQTTClientComponent::start_dnslookup_() {
|
||||||
for (auto &subscription : this->subscriptions_) {
|
for (auto &subscription : this->subscriptions_) {
|
||||||
|
@ -29,6 +29,14 @@ bool is_connected() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool is_disabled() {
|
||||||
|
#ifdef USE_WIFI
|
||||||
|
if (wifi::global_wifi_component != nullptr)
|
||||||
|
return wifi::global_wifi_component->is_disabled();
|
||||||
|
#endif
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
network::IPAddress get_ip_address() {
|
network::IPAddress get_ip_address() {
|
||||||
#ifdef USE_ETHERNET
|
#ifdef USE_ETHERNET
|
||||||
if (ethernet::global_eth_component != nullptr)
|
if (ethernet::global_eth_component != nullptr)
|
||||||
|
@ -8,6 +8,8 @@ namespace network {
|
|||||||
|
|
||||||
/// Return whether the node is connected to the network (through wifi, eth, ...)
|
/// Return whether the node is connected to the network (through wifi, eth, ...)
|
||||||
bool is_connected();
|
bool is_connected();
|
||||||
|
/// Return whether the network is disabled (only wifi for now)
|
||||||
|
bool is_disabled();
|
||||||
/// Get the active network hostname
|
/// Get the active network hostname
|
||||||
std::string get_use_address();
|
std::string get_use_address();
|
||||||
IPAddress get_ip_address();
|
IPAddress get_ip_address();
|
||||||
|
@ -389,6 +389,10 @@ void WiFiComponent::print_connect_params_() {
|
|||||||
bssid_t bssid = wifi_bssid();
|
bssid_t bssid = wifi_bssid();
|
||||||
|
|
||||||
ESP_LOGCONFIG(TAG, " Local MAC: %s", get_mac_address_pretty().c_str());
|
ESP_LOGCONFIG(TAG, " Local MAC: %s", get_mac_address_pretty().c_str());
|
||||||
|
if (this->is_disabled()) {
|
||||||
|
ESP_LOGCONFIG(TAG, " WiFi is disabled!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
ESP_LOGCONFIG(TAG, " SSID: " LOG_SECRET("'%s'"), wifi_ssid().c_str());
|
ESP_LOGCONFIG(TAG, " SSID: " LOG_SECRET("'%s'"), wifi_ssid().c_str());
|
||||||
ESP_LOGCONFIG(TAG, " IP Address: %s", wifi_sta_ip().str().c_str());
|
ESP_LOGCONFIG(TAG, " IP Address: %s", wifi_sta_ip().str().c_str());
|
||||||
ESP_LOGCONFIG(TAG, " BSSID: " LOG_SECRET("%02X:%02X:%02X:%02X:%02X:%02X"), bssid[0], bssid[1], bssid[2], bssid[3],
|
ESP_LOGCONFIG(TAG, " BSSID: " LOG_SECRET("%02X:%02X:%02X:%02X:%02X:%02X"), bssid[0], bssid[1], bssid[2], bssid[3],
|
||||||
|
@ -50,7 +50,6 @@ from esphome.zeroconf import (
|
|||||||
DashboardImportDiscovery,
|
DashboardImportDiscovery,
|
||||||
DashboardStatus,
|
DashboardStatus,
|
||||||
)
|
)
|
||||||
|
|
||||||
from .async_adapter import AsyncEvent
|
from .async_adapter import AsyncEvent
|
||||||
from .util import chunked, friendly_name_slugify, password_hash
|
from .util import chunked, friendly_name_slugify, password_hash
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ def sub(path, pattern, repl, expected_count=1):
|
|||||||
content, count = re.subn(pattern, repl, content, flags=re.MULTILINE)
|
content, count = re.subn(pattern, repl, content, flags=re.MULTILINE)
|
||||||
if expected_count is not None:
|
if expected_count is not None:
|
||||||
assert count == expected_count, f"Pattern {pattern} replacement failed!"
|
assert count == expected_count, f"Pattern {pattern} replacement failed!"
|
||||||
with open(path, "wt") as fh:
|
with open(path, "w") as fh:
|
||||||
fh.write(content)
|
fh.write(content)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from typing import Iterator
|
from collections.abc import Iterator
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from mock import Mock
|
from unittest.mock import Mock
|
||||||
|
|
||||||
from esphome import cpp_helpers as ch
|
from esphome import cpp_helpers as ch
|
||||||
from esphome import const
|
from esphome import const
|
||||||
|
Loading…
x
Reference in New Issue
Block a user