mirror of
https://github.com/esphome/esphome.git
synced 2025-11-20 08:46:01 +00:00
Merge remote-tracking branch 'upstream/dev' into integration
This commit is contained in:
@@ -66,10 +66,14 @@ SubstituteFilter::SubstituteFilter(const std::initializer_list<Substitution> &su
|
||||
: substitutions_(substitutions) {}
|
||||
|
||||
optional<std::string> SubstituteFilter::new_value(std::string value) {
|
||||
std::size_t pos;
|
||||
for (const auto &sub : this->substitutions_) {
|
||||
while ((pos = value.find(sub.from)) != std::string::npos)
|
||||
std::size_t pos = 0;
|
||||
while ((pos = value.find(sub.from, pos)) != std::string::npos) {
|
||||
value.replace(pos, sub.from.size(), sub.to);
|
||||
// Advance past the replacement to avoid infinite loop when
|
||||
// the replacement contains the search pattern (e.g., f -> foo)
|
||||
pos += sub.to.size();
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -872,7 +872,13 @@ bssid_t WiFiComponent::wifi_bssid() {
|
||||
return bssid;
|
||||
}
|
||||
std::string WiFiComponent::wifi_ssid() { return WiFi.SSID().c_str(); }
|
||||
int8_t WiFiComponent::wifi_rssi() { return WiFi.status() == WL_CONNECTED ? WiFi.RSSI() : WIFI_RSSI_DISCONNECTED; }
|
||||
int8_t WiFiComponent::wifi_rssi() {
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
return WIFI_RSSI_DISCONNECTED;
|
||||
int8_t rssi = WiFi.RSSI();
|
||||
// Values >= 31 are error codes per NONOS SDK API, not valid RSSI readings
|
||||
return rssi >= 31 ? WIFI_RSSI_DISCONNECTED : rssi;
|
||||
}
|
||||
int32_t WiFiComponent::get_wifi_channel() { return WiFi.channel(); }
|
||||
network::IPAddress WiFiComponent::wifi_subnet_mask_() { return {(const ip_addr_t *) WiFi.subnetMask()}; }
|
||||
network::IPAddress WiFiComponent::wifi_gateway_ip_() { return {(const ip_addr_t *) WiFi.gatewayIP()}; }
|
||||
|
||||
@@ -115,8 +115,8 @@ wifi:
|
||||
password: PASSWORD123
|
||||
|
||||
time:
|
||||
platform: sntp
|
||||
id: time_id
|
||||
- platform: sntp
|
||||
id: sntp_time
|
||||
|
||||
text:
|
||||
- id: lvgl_text
|
||||
|
||||
@@ -478,19 +478,19 @@ lvgl:
|
||||
id: hello_label
|
||||
text:
|
||||
time_format: "%c"
|
||||
time: time_id
|
||||
time: sntp_time
|
||||
- lvgl.label.update:
|
||||
id: hello_label
|
||||
text:
|
||||
time_format: "%c"
|
||||
time: !lambda return id(time_id).now();
|
||||
time: !lambda return id(sntp_time).now();
|
||||
- lvgl.label.update:
|
||||
id: hello_label
|
||||
text:
|
||||
time_format: "%c"
|
||||
time: !lambda |-
|
||||
ESP_LOGD("label", "multi-line lambda");
|
||||
return id(time_id).now();
|
||||
return id(sntp_time).now();
|
||||
on_value:
|
||||
logger.log:
|
||||
format: "state now %d"
|
||||
|
||||
@@ -4,6 +4,7 @@ wifi:
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
id: sntp_time
|
||||
|
||||
mqtt:
|
||||
broker: "192.168.178.84"
|
||||
|
||||
@@ -3,6 +3,7 @@ wifi:
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
id: sntp_time
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
|
||||
@@ -4,8 +4,10 @@ wifi:
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
id: sntp_time
|
||||
|
||||
wireguard:
|
||||
time_id: sntp_time
|
||||
address: 172.16.34.100
|
||||
netmask: 255.255.255.0
|
||||
# NEVER use the following keys for your VPN -- they are now public!
|
||||
|
||||
Reference in New Issue
Block a user