Merge branch 'dev' into dev

This commit is contained in:
CptSkippy 2024-06-02 15:34:49 -07:00 committed by GitHub
commit e8e2e33b04
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 79 additions and 18 deletions

View file

@ -105,7 +105,7 @@ class CustomAPIDevice {
/** Subscribe to the state (or attribute state) of an entity from Home Assistant. /** Subscribe to the state (or attribute state) of an entity from Home Assistant.
* *
* Usage: * Usage:
*å *
* ```cpp * ```cpp
* void setup() override { * void setup() override {
* subscribe_homeassistant_state(&CustomNativeAPI::on_state_changed, "sensor.weather_forecast"); * subscribe_homeassistant_state(&CustomNativeAPI::on_state_changed, "sensor.weather_forecast");

View file

@ -410,7 +410,7 @@ void EthernetComponent::start_connect_() {
global_eth_component->ipv6_count_ = 0; global_eth_component->ipv6_count_ = 0;
#endif /* USE_NETWORK_IPV6 */ #endif /* USE_NETWORK_IPV6 */
this->connect_begin_ = millis(); this->connect_begin_ = millis();
this->status_set_warning(); this->status_set_warning("waiting for IP configuration");
esp_err_t err; esp_err_t err;
err = esp_netif_set_hostname(this->eth_netif_, App.get_name().c_str()); 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`. * Bit 7 is `RMII Reference Clock Select`. Default is `0`.
* KSZ8081RNA: * KSZ8081RNA:
* 0 - clock input to XI (Pin 8) is 25 MHz for RMII 25 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. * 1 - clock input to XI (Pin 8) is 50 MHz for RMII - 50 MHz clock mode.
* KSZ8081RND: * KSZ8081RND:
* 0 - clock input to XI (Pin 8) is 50 MHz for RMII 50 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. * 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)) { if ((phy_control_2 & (1 << 7)) != (1 << 7)) {
phy_control_2 |= 1 << 7; phy_control_2 |= 1 << 7;

View file

@ -244,7 +244,7 @@ void FeedbackCover::loop() {
// update current position at requested interval, regardless of who started the movement // update current position at requested interval, regardless of who started the movement
// so that we also update UI if there was an external 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_) { if (now - this->last_publish_time_ > this->update_interval_) {
this->publish_state(false); this->publish_state(false);
this->last_publish_time_ = now; this->last_publish_time_ = now;
@ -274,7 +274,7 @@ void FeedbackCover::control(const CoverCall &call) {
if (pos == this->position) { if (pos == this->position) {
// already at target, // 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 // to make sure the assumed state is not wrong
if (this->has_built_in_endstop_ && ((pos == COVER_OPEN if (this->has_built_in_endstop_ && ((pos == COVER_OPEN
#ifdef USE_BINARY_SENSOR #ifdef USE_BINARY_SENSOR

View file

@ -29,7 +29,7 @@ enum MAX6956GPIORegisters {
MAX6956_PORT_CONFIG_START = 0x09, // Port Configuration P7, P6, P5, P4 MAX6956_PORT_CONFIG_START = 0x09, // Port Configuration P7, P6, P5, P4
MAX6956_CURRENT_START = 0x12, // Current054 MAX6956_CURRENT_START = 0x12, // Current054
MAX6956_1PORT_VALUE_START = 0x20, // Port 0 only (virtual port, no action) MAX6956_1PORT_VALUE_START = 0x20, // Port 0 only (virtual port, no action)
MAX6956_8PORTS_VALUE_START = 0x44, // 8 ports 411 (data bits D0D7) MAX6956_8PORTS_VALUE_START = 0x44, // 8 ports 4-11 (data bits D0-D7)
}; };
enum MAX6956GPIOFlag { FLAG_LED = 0x20 }; enum MAX6956GPIOFlag { FLAG_LED = 0x20 };

View file

@ -100,7 +100,7 @@ def process_calibration(value):
elif isinstance(value, list): elif isinstance(value, list):
if len(value) != 3: if len(value) != 3:
raise cv.Invalid( raise cv.Invalid(
"SteinhartHart Calibration must consist of exactly three values" "Steinhart-Hart Calibration must consist of exactly three values"
) )
value = cv.Schema([validate_calibration_parameter])(value) value = cv.Schema([validate_calibration_parameter])(value)
a, b, c = calc_steinhart_hart(value) a, b, c = calc_steinhart_hart(value)

View file

@ -58,7 +58,7 @@ void WiFiComponent::setup() {
void WiFiComponent::start() { void WiFiComponent::start() {
ESP_LOGCONFIG(TAG, "Starting WiFi..."); 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(); this->last_connected_ = millis();
uint32_t hash = this->has_sta() ? fnv1_hash(App.get_compilation_time()) : 88491487UL; uint32_t hash = this->has_sta() ? fnv1_hash(App.get_compilation_time()) : 88491487UL;
@ -135,7 +135,7 @@ void WiFiComponent::loop() {
switch (this->state_) { switch (this->state_) {
case WIFI_COMPONENT_STATE_COOLDOWN: { case WIFI_COMPONENT_STATE_COOLDOWN: {
this->status_set_warning(); this->status_set_warning("waiting to reconnect");
if (millis() - this->action_started_ > 5000) { if (millis() - this->action_started_ > 5000) {
if (this->fast_connect_ || this->retry_hidden_) { if (this->fast_connect_ || this->retry_hidden_) {
this->start_connecting(this->sta_[0], false); this->start_connecting(this->sta_[0], false);
@ -146,13 +146,13 @@ void WiFiComponent::loop() {
break; break;
} }
case WIFI_COMPONENT_STATE_STA_SCANNING: { case WIFI_COMPONENT_STATE_STA_SCANNING: {
this->status_set_warning(); this->status_set_warning("scanning for networks");
this->check_scanning_finished(); this->check_scanning_finished();
break; break;
} }
case WIFI_COMPONENT_STATE_STA_CONNECTING: case WIFI_COMPONENT_STATE_STA_CONNECTING:
case WIFI_COMPONENT_STATE_STA_CONNECTING_2: { case WIFI_COMPONENT_STATE_STA_CONNECTING_2: {
this->status_set_warning(); this->status_set_warning("associating to network");
this->check_connecting_finished(); this->check_connecting_finished();
break; break;
} }

View file

@ -122,7 +122,7 @@ async def to_code(config):
# the '+1' modifier is relative to the device's own address that will # the '+1' modifier is relative to the device's own address that will
# be automatically added to the provided list. # be automatically added to the provided list.
cg.add_build_flag(f"-DCONFIG_WIREGUARD_MAX_SRC_IPS={len(allowed_ips) + 1}") 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) await cg.register_component(var, config)

View file

@ -94,7 +94,7 @@ lib_deps =
ESP8266mDNS ; mdns (Arduino built-in) ESP8266mDNS ; mdns (Arduino built-in)
DNSServer ; captive_portal (Arduino built-in) DNSServer ; captive_portal (Arduino built-in)
crankyoldgit/IRremoteESP8266@~2.8.4 ; heatpumpir crankyoldgit/IRremoteESP8266@~2.8.4 ; heatpumpir
droscy/esp_wireguard@0.4.0 ; wireguard droscy/esp_wireguard@0.4.1 ; wireguard
build_flags = build_flags =
${common:arduino.build_flags} ${common:arduino.build_flags}
-Wno-nonnull-compare -Wno-nonnull-compare
@ -124,7 +124,7 @@ lib_deps =
DNSServer ; captive_portal (Arduino built-in) DNSServer ; captive_portal (Arduino built-in)
esphome/ESP32-audioI2S@2.0.7 ; i2s_audio esphome/ESP32-audioI2S@2.0.7 ; i2s_audio
crankyoldgit/IRremoteESP8266@~2.8.4 ; heatpumpir crankyoldgit/IRremoteESP8266@~2.8.4 ; heatpumpir
droscy/esp_wireguard@0.4.0 ; wireguard droscy/esp_wireguard@0.4.1 ; wireguard
build_flags = build_flags =
${common:arduino.build_flags} ${common:arduino.build_flags}
-DUSE_ESP32 -DUSE_ESP32
@ -143,7 +143,7 @@ framework = espidf
lib_deps = lib_deps =
${common:idf.lib_deps} ${common:idf.lib_deps}
espressif/esp32-camera@1.0.0 ; esp32_camera espressif/esp32-camera@1.0.0 ; esp32_camera
droscy/esp_wireguard@0.4.0 ; wireguard droscy/esp_wireguard@0.4.1 ; wireguard
build_flags = build_flags =
${common:idf.build_flags} ${common:idf.build_flags}
-Wno-nonnull-compare -Wno-nonnull-compare
@ -174,6 +174,8 @@ build_flags =
extends = common:arduino extends = common:arduino
platform = libretiny platform = libretiny
framework = arduino framework = arduino
lib_deps =
droscy/esp_wireguard@0.4.1 ; wireguard
build_flags = build_flags =
${common:arduino.build_flags} ${common:arduino.build_flags}
-DUSE_LIBRETINY -DUSE_LIBRETINY

View 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'