mirror of
https://github.com/esphome/esphome.git
synced 2024-11-28 01:34:18 +01:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
3839d6e6b7
10 changed files with 88 additions and 32 deletions
|
@ -105,7 +105,7 @@ class CustomAPIDevice {
|
|||
/** Subscribe to the state (or attribute state) of an entity from Home Assistant.
|
||||
*
|
||||
* Usage:
|
||||
*å
|
||||
*
|
||||
* ```cpp
|
||||
* void setup() override {
|
||||
* subscribe_homeassistant_state(&CustomNativeAPI::on_state_changed, "sensor.weather_forecast");
|
||||
|
|
|
@ -410,7 +410,7 @@ void EthernetComponent::start_connect_() {
|
|||
global_eth_component->ipv6_count_ = 0;
|
||||
#endif /* USE_NETWORK_IPV6 */
|
||||
this->connect_begin_ = millis();
|
||||
this->status_set_warning();
|
||||
this->status_set_warning("waiting for IP configuration");
|
||||
|
||||
esp_err_t err;
|
||||
err = esp_netif_set_hostname(this->eth_netif_, App.get_name().c_str());
|
||||
|
@ -576,11 +576,11 @@ void EthernetComponent::ksz8081_set_clock_reference_(esp_eth_mac_t *mac) {
|
|||
/*
|
||||
* Bit 7 is `RMII Reference Clock Select`. Default is `0`.
|
||||
* KSZ8081RNA:
|
||||
* 0 - clock input to XI (Pin 8) is 25 MHz for RMII – 25 MHz clock mode.
|
||||
* 1 - clock input to XI (Pin 8) is 50 MHz for RMII – 50 MHz clock mode.
|
||||
* 0 - clock input to XI (Pin 8) is 25 MHz for RMII - 25 MHz clock mode.
|
||||
* 1 - clock input to XI (Pin 8) is 50 MHz for RMII - 50 MHz clock mode.
|
||||
* KSZ8081RND:
|
||||
* 0 - clock input to XI (Pin 8) is 50 MHz for RMII – 50 MHz clock mode.
|
||||
* 1 - clock input to XI (Pin 8) is 25 MHz (driven clock only, not a crystal) for RMII – 25 MHz clock mode.
|
||||
* 0 - clock input to XI (Pin 8) is 50 MHz for RMII - 50 MHz clock mode.
|
||||
* 1 - clock input to XI (Pin 8) is 25 MHz (driven clock only, not a crystal) for RMII - 25 MHz clock mode.
|
||||
*/
|
||||
if ((phy_control_2 & (1 << 7)) != (1 << 7)) {
|
||||
phy_control_2 |= 1 << 7;
|
||||
|
|
|
@ -244,7 +244,7 @@ void FeedbackCover::loop() {
|
|||
|
||||
// update current position at requested interval, regardless of who started the movement
|
||||
// so that we also update UI if there was an external movement
|
||||
// don´t save intermediate positions
|
||||
// don't save intermediate positions
|
||||
if (now - this->last_publish_time_ > this->update_interval_) {
|
||||
this->publish_state(false);
|
||||
this->last_publish_time_ = now;
|
||||
|
@ -274,7 +274,7 @@ void FeedbackCover::control(const CoverCall &call) {
|
|||
if (pos == this->position) {
|
||||
// already at target,
|
||||
|
||||
// for covers with built in end stop, if we don´t have sensors we should send the command again
|
||||
// for covers with built in end stop, if we don't have sensors we should send the command again
|
||||
// to make sure the assumed state is not wrong
|
||||
if (this->has_built_in_endstop_ && ((pos == COVER_OPEN
|
||||
#ifdef USE_BINARY_SENSOR
|
||||
|
|
|
@ -29,7 +29,7 @@ enum MAX6956GPIORegisters {
|
|||
MAX6956_PORT_CONFIG_START = 0x09, // Port Configuration P7, P6, P5, P4
|
||||
MAX6956_CURRENT_START = 0x12, // Current054
|
||||
MAX6956_1PORT_VALUE_START = 0x20, // Port 0 only (virtual port, no action)
|
||||
MAX6956_8PORTS_VALUE_START = 0x44, // 8 ports 4–11 (data bits D0–D7)
|
||||
MAX6956_8PORTS_VALUE_START = 0x44, // 8 ports 4-11 (data bits D0-D7)
|
||||
};
|
||||
|
||||
enum MAX6956GPIOFlag { FLAG_LED = 0x20 };
|
||||
|
|
|
@ -100,7 +100,7 @@ def process_calibration(value):
|
|||
elif isinstance(value, list):
|
||||
if len(value) != 3:
|
||||
raise cv.Invalid(
|
||||
"Steinhart–Hart Calibration must consist of exactly three values"
|
||||
"Steinhart-Hart Calibration must consist of exactly three values"
|
||||
)
|
||||
value = cv.Schema([validate_calibration_parameter])(value)
|
||||
a, b, c = calc_steinhart_hart(value)
|
||||
|
|
|
@ -1,16 +1,11 @@
|
|||
#include "sntp_component.h"
|
||||
#include "esphome/core/log.h"
|
||||
|
||||
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
||||
#include "lwip/apps/sntp.h"
|
||||
#ifdef USE_ESP_IDF
|
||||
#include "esp_sntp.h"
|
||||
#endif
|
||||
#endif
|
||||
#ifdef USE_ESP8266
|
||||
#elif USE_ESP8266
|
||||
#include "sntp.h"
|
||||
#endif
|
||||
#ifdef USE_RP2040
|
||||
#else
|
||||
#include "lwip/apps/sntp.h"
|
||||
#endif
|
||||
|
||||
|
@ -27,14 +22,14 @@ static const char *const TAG = "sntp";
|
|||
void SNTPComponent::setup() {
|
||||
#ifndef USE_HOST
|
||||
ESP_LOGCONFIG(TAG, "Setting up SNTP...");
|
||||
#if defined(USE_ESP32) || defined(USE_LIBRETINY)
|
||||
if (sntp_enabled()) {
|
||||
sntp_stop();
|
||||
#if defined(USE_ESP_IDF)
|
||||
if (esp_sntp_enabled()) {
|
||||
esp_sntp_stop();
|
||||
}
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
#endif
|
||||
#ifdef USE_ESP8266
|
||||
esp_sntp_setoperatingmode(ESP_SNTP_OPMODE_POLL);
|
||||
#else
|
||||
sntp_stop();
|
||||
sntp_setoperatingmode(SNTP_OPMODE_POLL);
|
||||
#endif
|
||||
|
||||
sntp_setservername(0, strdup(this->server_1_.c_str()));
|
||||
|
@ -45,7 +40,7 @@ void SNTPComponent::setup() {
|
|||
sntp_setservername(2, strdup(this->server_3_.c_str()));
|
||||
}
|
||||
#ifdef USE_ESP_IDF
|
||||
sntp_set_sync_interval(this->get_update_interval());
|
||||
esp_sntp_set_sync_interval(this->get_update_interval());
|
||||
#endif
|
||||
|
||||
sntp_init();
|
||||
|
|
|
@ -58,7 +58,7 @@ void WiFiComponent::setup() {
|
|||
|
||||
void WiFiComponent::start() {
|
||||
ESP_LOGCONFIG(TAG, "Starting WiFi...");
|
||||
ESP_LOGCONFIG(TAG, " Local MAC: %s", get_mac_address_pretty().c_str());
|
||||
ESP_LOGCONFIG(TAG, " Local MAC: %s", get_mac_address_pretty().c_str());
|
||||
this->last_connected_ = millis();
|
||||
|
||||
uint32_t hash = this->has_sta() ? fnv1_hash(App.get_compilation_time()) : 88491487UL;
|
||||
|
@ -135,7 +135,7 @@ void WiFiComponent::loop() {
|
|||
|
||||
switch (this->state_) {
|
||||
case WIFI_COMPONENT_STATE_COOLDOWN: {
|
||||
this->status_set_warning();
|
||||
this->status_set_warning("waiting to reconnect");
|
||||
if (millis() - this->action_started_ > 5000) {
|
||||
if (this->fast_connect_ || this->retry_hidden_) {
|
||||
this->start_connecting(this->sta_[0], false);
|
||||
|
@ -146,13 +146,13 @@ void WiFiComponent::loop() {
|
|||
break;
|
||||
}
|
||||
case WIFI_COMPONENT_STATE_STA_SCANNING: {
|
||||
this->status_set_warning();
|
||||
this->status_set_warning("scanning for networks");
|
||||
this->check_scanning_finished();
|
||||
break;
|
||||
}
|
||||
case WIFI_COMPONENT_STATE_STA_CONNECTING:
|
||||
case WIFI_COMPONENT_STATE_STA_CONNECTING_2: {
|
||||
this->status_set_warning();
|
||||
this->status_set_warning("associating to network");
|
||||
this->check_connecting_finished();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ async def to_code(config):
|
|||
# the '+1' modifier is relative to the device's own address that will
|
||||
# be automatically added to the provided list.
|
||||
cg.add_build_flag(f"-DCONFIG_WIREGUARD_MAX_SRC_IPS={len(allowed_ips) + 1}")
|
||||
cg.add_library("droscy/esp_wireguard", "0.4.0")
|
||||
cg.add_library("droscy/esp_wireguard", "0.4.1")
|
||||
|
||||
await cg.register_component(var, config)
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ lib_deps =
|
|||
ESP8266mDNS ; mdns (Arduino built-in)
|
||||
DNSServer ; captive_portal (Arduino built-in)
|
||||
crankyoldgit/IRremoteESP8266@~2.8.4 ; heatpumpir
|
||||
droscy/esp_wireguard@0.4.0 ; wireguard
|
||||
droscy/esp_wireguard@0.4.1 ; wireguard
|
||||
build_flags =
|
||||
${common:arduino.build_flags}
|
||||
-Wno-nonnull-compare
|
||||
|
@ -124,7 +124,7 @@ lib_deps =
|
|||
DNSServer ; captive_portal (Arduino built-in)
|
||||
esphome/ESP32-audioI2S@2.0.7 ; i2s_audio
|
||||
crankyoldgit/IRremoteESP8266@~2.8.4 ; heatpumpir
|
||||
droscy/esp_wireguard@0.4.0 ; wireguard
|
||||
droscy/esp_wireguard@0.4.1 ; wireguard
|
||||
build_flags =
|
||||
${common:arduino.build_flags}
|
||||
-DUSE_ESP32
|
||||
|
@ -143,7 +143,7 @@ framework = espidf
|
|||
lib_deps =
|
||||
${common:idf.lib_deps}
|
||||
espressif/esp32-camera@1.0.0 ; esp32_camera
|
||||
droscy/esp_wireguard@0.4.0 ; wireguard
|
||||
droscy/esp_wireguard@0.4.1 ; wireguard
|
||||
build_flags =
|
||||
${common:idf.build_flags}
|
||||
-Wno-nonnull-compare
|
||||
|
@ -174,6 +174,8 @@ build_flags =
|
|||
extends = common:arduino
|
||||
platform = libretiny
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
droscy/esp_wireguard@0.4.1 ; wireguard
|
||||
build_flags =
|
||||
${common:arduino.build_flags}
|
||||
-DUSE_LIBRETINY
|
||||
|
|
59
tests/components/wireguard/test.bk72xx.yaml
Normal file
59
tests/components/wireguard/test.bk72xx.yaml
Normal file
|
@ -0,0 +1,59 @@
|
|||
wifi:
|
||||
ssid: "MySSID1"
|
||||
password: "password1"
|
||||
|
||||
time:
|
||||
- platform: sntp
|
||||
|
||||
wireguard:
|
||||
address: 172.16.34.100
|
||||
netmask: 255.255.255.0
|
||||
# NEVER use the following keys for your vpn, they are now public!
|
||||
private_key: wPBMxtNYH3mChicrbpsRpZIasIdPq3yZuthn23FbGG8=
|
||||
peer_public_key: Hs2JfikvYU03/Kv3YoAs1hrUIPPTEkpsZKSPUljE9yc=
|
||||
peer_preshared_key: 20fjM5GRnSolGPC5SRj9ljgIUyQfruv0B0bvLl3Yt60=
|
||||
peer_endpoint: wg.server.example
|
||||
peer_persistent_keepalive: 25s
|
||||
peer_allowed_ips:
|
||||
- 172.16.34.0/24
|
||||
- 192.168.4.0/24
|
||||
|
||||
binary_sensor:
|
||||
- platform: wireguard
|
||||
status:
|
||||
name: 'WireGuard Status'
|
||||
enabled:
|
||||
name: 'WireGuard Enabled'
|
||||
|
||||
sensor:
|
||||
- platform: wireguard
|
||||
latest_handshake:
|
||||
name: 'WireGuard Latest Handshake'
|
||||
|
||||
text_sensor:
|
||||
- platform: wireguard
|
||||
address:
|
||||
name: 'WireGuard Address'
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
name: 'Toggle WireGuard'
|
||||
entity_category: config
|
||||
on_press:
|
||||
- if:
|
||||
condition: wireguard.enabled
|
||||
then:
|
||||
- wireguard.disable:
|
||||
else:
|
||||
- wireguard.enable:
|
||||
|
||||
- platform: template
|
||||
name: 'Log WireGuard status'
|
||||
entity_category: config
|
||||
on_press:
|
||||
- if:
|
||||
condition: wireguard.peer_online
|
||||
then:
|
||||
- logger.log: 'wireguard remote peer is online'
|
||||
else:
|
||||
- logger.log: 'wireguard remote peer is offline'
|
Loading…
Reference in a new issue