diff --git a/esphome/.device-builder.json b/esphome/.device-builder.json index 1406e67..845a023 100644 --- a/esphome/.device-builder.json +++ b/esphome/.device-builder.json @@ -308,6 +308,31 @@ "mac_address": "88:13:BF:68:39:2C" }, "_firmware_jobs": [ + { + "job_id": "90c4ef66ff5b", + "configuration": "esp-astroclockstepper1.yaml", + "job_type": "compile", + "status": "completed", + "created_at": "2026-06-22T10:01:22.573688+00:00", + "started_at": "2026-06-22T10:01:22.574085+00:00", + "completed_at": "2026-06-22T10:02:43.029754+00:00", + "exit_code": 0, + "error": null, + "port": "", + "new_name": "", + "depends_on": "", + "dependency_released": false, + "progress": null, + "remote_peer": "", + "remote_job_id": "", + "remote_peer_label": "", + "device_name": "", + "device_friendly_name": "", + "source": "local", + "source_pin_sha256": "", + "source_label": "", + "source_esphome_version": "" + }, { "job_id": "1a468db814e3", "configuration": "esp-astroclockstepper1.yaml", @@ -333,31 +358,6 @@ "source_label": "", "source_esphome_version": "" }, - { - "job_id": "46b32677aa36", - "configuration": "esp-astroclockstepper1.yaml", - "job_type": "compile", - "status": "completed", - "created_at": "2026-06-22T03:29:56.540282+00:00", - "started_at": "2026-06-22T03:29:56.541217+00:00", - "completed_at": "2026-06-22T03:30:10.487553+00:00", - "exit_code": 0, - "error": null, - "port": "", - "new_name": "", - "depends_on": "", - "dependency_released": false, - "progress": null, - "remote_peer": "", - "remote_job_id": "", - "remote_peer_label": "", - "device_name": "", - "device_friendly_name": "", - "source": "local", - "source_pin_sha256": "", - "source_label": "", - "source_esphome_version": "" - }, { "job_id": "dfabed27adf5", "configuration": "esp-masterbdrmwest.yaml", diff --git a/esphome/common/network_common.yaml b/esphome/common/network_common.yaml index 69803ae..11f9c16 100644 --- a/esphome/common/network_common.yaml +++ b/esphome/common/network_common.yaml @@ -1,8 +1,51 @@ +#:########################################################################################:# +# TITLE: COMMON NETWORK STATIC +# zorruno.com layout v1.1 2026 +#:########################################################################################:# +# PURPOSE: +# Common ESPHome WiFi/network package using static IP addressing. +# +# Intended for fixed devices on the main Home Assistant / IoT WiFi network. +#:########################################################################################:# +# OPERATION NOTES: +# - Uses configured WiFi SSID/password from secrets. +# - Uses static IP settings supplied by the including device YAML. +# - Provides fallback AP if configured WiFi fails. +# - Captive portal allows WiFi settings to be manually overridden. +# - Safe Mode is enabled to help recover from boot loops. +# - OTA updates are enabled. +# - IPv6 can be enabled/disabled by substitution. +#:########################################################################################:# +# REQUIRED PACKAGE VARS: +# These are normally passed in by the device YAML package include. +# +# local_device_name: +# Device name used for fallback AP SSID. +# +# local_static_ip_address: +# Static IP address for this specific device. +# +# local_current_ip_address: +# Address ESPHome should use for upload/reconnect. +# Usually the same as local_static_ip_address. +# +# local_ota_pass: +# OTA password. +#:########################################################################################:# +# OPTIONAL NOTES: +# - For portable devices, use common/network_common_dhcp.yaml instead. +# - If changing a device IP address, update local_current_ip_address during the transition. +# - After the device is reachable at the new address, set local_current_ip_address back to +# local_static_ip_address. +#:########################################################################################:# + + +#:########################################################################################:# +# SUBSTITUTIONS: +# Common network variable substitutions +#:########################################################################################:# substitutions: - ############################################################################################ - # SPECIFIC DEVICE VARIABLE SUBSTITUTIONS - # If NOT using a secrets file, just replace these with the passwords etc (in quotes) - ########################################################################################### + # WiFi Credentials wifi_ssid: !secret ha_wifi_ssid wifi_password: !secret ha_wifi_password fallback_ap_password: !secret fallback_ap_password @@ -10,92 +53,117 @@ substitutions: # Enables faster network connections, with last connected SSID being connected to and no full scan for SSID being undertaken wifi_fast_connect: "false" - # Define a domain for this device to use. i.e. iot.home.lan (so device will appear as athom-smart-plug-v2.iot.home.lan in DNS/DHCP logs) + # Define a domain for this device to use + # Example: iot.home.lan means the device appears as device-name.iot.home.lan in DNS/DHCP logs dns_domain: ".local" - # Automatically add the mac address to the name - # eg so you can use a single firmware for all devices + # Automatically add the MAC address to the device name + # Useful if using a single firmware image for multiple devices add_mac_suffix: "false" - # Enable or disable the use of IPv6 networking on the device + # Enable or disable IPv6 networking on the device ipv6_enable: "false" - - # Add these if we are giving it a static ip, or remove them in the Wifi section + + # Static IP Network Settings static_ip_subnet: !secret ha_wifi_subnet static_ip_gateway: !secret ha_wifi_gateway static_ip_dns1: !secret ha_wifi_dns1 static_ip_dns2: !secret ha_wifi_dns2 - - # Network reconnect every x hours to ensure best access point - base_interval_hours: "23" # Base interval in hours - random_offset_max_minutes: "59" # Max random offset in minutes -########################################################################################### -# Common Wifi Settings + # Fallback AP Timing + fallback_ap_timeout: "10min" + + # Network reconnect every x hours to ensure best access point + base_interval_hours: "23" + random_offset_max_minutes: "59" + + +#:########################################################################################:# +# WIFI: +# Static IP WiFi configuration with fallback AP and captive portal # https://esphome.io/components/wifi.html -# -# Power Save mode (can reduce wifi reliability) -# NONE (least power saving, Default for ESP8266) -# LIGHT (Default for ESP32) -# HIGH (most power saving) -########################################################################################### +#:########################################################################################:# wifi: ssid: ${wifi_ssid} password: ${wifi_password} - #enable_rrm: true # (ESP32 only) enable 802.11k Radio Resource Management - #enable_btm: true # (ESP32 only) enable 802.11v BSS Transition Management - power_save_mode: none # https://esphome.io/components/wifi.html#wifi-power-save-mode - manual_ip: # optional static IP address + + # ESP8266 default is NONE. Power save can reduce WiFi reliability. + power_save_mode: none + + # Static IP address + manual_ip: static_ip: ${local_static_ip_address} gateway: ${static_ip_gateway} subnet: ${static_ip_subnet} dns1: ${static_ip_dns1} dns2: ${static_ip_dns2} - use_address: ${local_current_ip_address} - ap: # Details for fallback hotspot in case wifi connection fails https://esphome.io/components/wifi.html#access-point-mode + + # Address ESPHome should use when connecting/uploading + use_address: ${local_current_ip_address} + + # Fallback hotspot in case configured WiFi connection fails + ap: ssid: ${local_device_name} password: ${fallback_ap_password} - ap_timeout: 10min # Time until it brings up fallback AP. default is 1min - # Allow rapid re-connection to previously connect WiFi SSID, skipping scan of all SSID + ap_timeout: ${fallback_ap_timeout} + + # Allow rapid re-connection to previously connected WiFi SSID, skipping scan of all SSIDs fast_connect: ${wifi_fast_connect} - # Define dns domain / suffix to add to hostname + + # Define DNS domain / suffix to add to hostname domain: ${dns_domain} + min_auth_mode: WPA2 - # Reboot eventually when Wi-Fi is down (default is 15min) + + # Reboot eventually when WiFi is down reboot_timeout: 56h -captive_portal: # extra fallback mechanism for when connecting if the configured WiFi fails -########################################################################################### -# Enable Over the Air Update Capability -# https://esphome.io/components/ota.html?highlight=ota -########################################################################################### +#:########################################################################################:# +# CAPTIVE PORTAL: +# Fallback mechanism for changing WiFi if the configured WiFi fails +# https://esphome.io/components/captive_portal.html +#:########################################################################################:# +captive_portal: + + +#:########################################################################################:# +# OTA: +# Enable Over the Air update capability +# https://esphome.io/components/ota.html +#:########################################################################################:# ota: - platform: esphome password: ${local_ota_pass} version: 2 - #- platform: web_server # Uncomment if you want to be able to do OTA with the web interface -########################################################################################### -# Safe Mode + # Optional: uncomment if you want OTA uploads through the web interface + #- platform: web_server + + +#:########################################################################################:# +# SAFE MODE: # Safe mode will detect boot loops # https://esphome.io/components/safe_mode -########################################################################################### +#:########################################################################################:# safe_mode: -########################################################################################### -# Network -# global configuration for all types of networks + +#:########################################################################################:# +# NETWORK: +# Global configuration for all network types # https://esphome.io/components/network.html -########################################################################################### +#:########################################################################################:# network: enable_ipv6: ${ipv6_enable} -########################################################################################## -# Interval -# Restart Networking every x hours + rand mins -# This ensure that the device is connected to the best AP -########################################################################################## + +#:########################################################################################:# +# SCRIPT: +# Optional network reconnect every x hours + random minutes +# +# This can be enabled if a device tends to stay connected to a weaker AP after roaming. +#:########################################################################################:# #script: # - id: random_reconnect # mode: restart @@ -103,23 +171,26 @@ network: # - lambda: |- # // Compute total delay: base hours + random offset minutes # uint32_t extra; +# # #if defined(ESP32) -# // ESP32 (both Arduino & IDF builds) uses esp_random() +# // ESP32 uses esp_random() # extra = esp_random() % (${random_offset_max_minutes} + 1); # #elif defined(ESP8266) -# // ESP8266 Arduino core +# // ESP8266 Arduino core uses os_random() # extra = os_random() % (${random_offset_max_minutes} + 1); # #else -# // Fallback to esp_random() on other platforms +# // Fallback # extra = esp_random() % (${random_offset_max_minutes} + 1); # #endif +# # uint32_t total_s = ${base_interval_hours} * 3600 + extra * 60; # ESP_LOGI("random_reconnect", "Next reconnect in %u seconds", total_s); -# // Delay inside lambda (blocks script execution but OK for reconnect timing) +# +# // Delay inside lambda blocks script execution, but is OK for reconnect timing # delay(total_s * 1000); +# # - logger.log: "network_check: performing reconnect" # - wifi.disable: {} # - delay: 1s # - wifi.enable: {} -# - script.execute: random_reconnect - +# - script.execute: random_reconnect \ No newline at end of file diff --git a/esphome/common/network_common_dhcp.yaml b/esphome/common/network_common_dhcp.yaml new file mode 100644 index 0000000..226a74b --- /dev/null +++ b/esphome/common/network_common_dhcp.yaml @@ -0,0 +1,140 @@ +#:########################################################################################:# +# TITLE: COMMON NETWORK DHCP +# zorruno.com layout v1.1 2026 +#:########################################################################################:# +# PURPOSE: +# Common ESPHome WiFi/network package using DHCP instead of static IP. +# +# Intended for portable or standalone devices where the WiFi network may change. +#:########################################################################################:# +# OPERATION NOTES: +# - Uses configured WiFi SSID/password from secrets for normal operation. +# - Uses DHCP, not static IP. +# - If configured WiFi fails, fallback AP starts after fallback_ap_timeout. +# - Captive portal allows WiFi settings to be manually overridden. +# - Captive portal WiFi changes should also be copied back into YAML later if permanent. +#:########################################################################################:# + + +#:########################################################################################:# +# SUBSTITUTIONS: +# Common network variable substitutions +#:########################################################################################:# +substitutions: + # WiFi Credentials + wifi_ssid: !secret ha_wifi_ssid + wifi_password: !secret ha_wifi_password + fallback_ap_password: !secret fallback_ap_password + + # Enables faster network connections, with last connected SSID being connected to and no full scan for SSID being undertaken + wifi_fast_connect: "false" + + # Define a domain for this device to use + dns_domain: ".local" + + # Enable or disable the use of IPv6 networking on the device + ipv6_enable: "false" + + # Fallback AP Timing + fallback_ap_timeout: "2min" + + # Network reconnect every x hours to ensure best access point + base_interval_hours: "23" + random_offset_max_minutes: "59" + + +#:########################################################################################:# +# WIFI: +# DHCP WiFi configuration with fallback AP and captive portal +# https://esphome.io/components/wifi.html +#:########################################################################################:# +wifi: + ssid: ${wifi_ssid} + password: ${wifi_password} + + # Power Save mode can reduce WiFi reliability + power_save_mode: none + + # Fallback hotspot in case configured WiFi connection fails + ap: + ssid: "${local_device_name}" + password: ${fallback_ap_password} + ap_timeout: ${fallback_ap_timeout} + + # Allow rapid re-connection to previously connected WiFi SSID, skipping scan of all SSIDs + fast_connect: ${wifi_fast_connect} + + # Define DNS domain / suffix to add to hostname + domain: ${dns_domain} + + min_auth_mode: WPA2 + + # Reboot eventually when WiFi is down + reboot_timeout: 56h + + +#:########################################################################################:# +# CAPTIVE PORTAL: +# Fallback mechanism for changing WiFi if the configured WiFi fails +# https://esphome.io/components/captive_portal.html +#:########################################################################################:# +captive_portal: + + +#:########################################################################################:# +# OTA: +# Enable Over the Air update capability +# https://esphome.io/components/ota.html +#:########################################################################################:# +ota: + - platform: esphome + password: ${local_ota_pass} + version: 2 + + # Optional: uncomment if you want OTA uploads through the web interface + #- platform: web_server + + +#:########################################################################################:# +# SAFE MODE: +# Safe mode will detect boot loops +# https://esphome.io/components/safe_mode +#:########################################################################################:# +safe_mode: + + +#:########################################################################################:# +# NETWORK: +# Global configuration for all types of networks +# https://esphome.io/components/network.html +#:########################################################################################:# +network: + enable_ipv6: ${ipv6_enable} + + +#:########################################################################################:# +# INTERVAL: +# Optional network reconnect every x hours + random minutes +#:########################################################################################:# +#script: +# - id: random_reconnect +# mode: restart +# then: +# - lambda: |- +# // Compute total delay: base hours + random offset minutes +# uint32_t extra; +# #if defined(ESP32) +# extra = esp_random() % (${random_offset_max_minutes} + 1); +# #elif defined(ESP8266) +# extra = os_random() % (${random_offset_max_minutes} + 1); +# #else +# extra = esp_random() % (${random_offset_max_minutes} + 1); +# #endif +# uint32_t total_s = ${base_interval_hours} * 3600 + extra * 60; +# ESP_LOGI("random_reconnect", "Next reconnect in %u seconds", total_s); +# delay(total_s * 1000); +# - logger.log: "network_check: performing reconnect" +# - wifi.disable: {} +# - delay: 1s +# - wifi.enable: {} +# - script.execute: random_reconnect \ No newline at end of file