From a38d64f648a25f2c162146d6cd65bb8a2a6f1c2a Mon Sep 17 00:00:00 2001 From: Aiden Date: Wed, 22 Oct 2025 11:18:03 +0800 Subject: [PATCH] --- athom-rgbcw-bulb.yaml | 320 -------------------------------------- athom-rgbcw-light.yaml | 15 +- athom-zigbee-gateway.yaml | 4 +- 3 files changed, 15 insertions(+), 324 deletions(-) delete mode 100644 athom-rgbcw-bulb.yaml diff --git a/athom-rgbcw-bulb.yaml b/athom-rgbcw-bulb.yaml deleted file mode 100644 index 9697a97..0000000 --- a/athom-rgbcw-bulb.yaml +++ /dev/null @@ -1,320 +0,0 @@ -substitutions: - # Default name - name: "athom-rgbcw-bulb" - # Default friendly name - friendly_name: "Athom RGBCW Bulb" - # Allows ESP device to be automatically linked to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc - room: "" - # Description as appears in ESPHome & top of webserver page - device_description: "athom esp32c3 12w rgbcw bulb" - # Project Name - project_name: "China Athom Technology.Athom 12W RGBCW Bulb" - # Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version - project_version: "v3.1.0" - # Restore the light (GPO switch) upon reboot to state: - light_restore_mode: RESTORE_DEFAULT_ON - # 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) - dns_domain: ".local" - # Set timezone of the smart plug. Useful if the plug is in a location different to the HA server. Can be entered in unix Country/Area format (i.e. "Australia/Sydney") - timezone: "" - # Set the duration between the sntp service polling ntp.org servers for an update - sntp_update_interval: 6h - # Network time servers for your region, enter from lowest to highest priority. To use local servers update as per zones or countries at: https://www.ntppool.org/zone/@ - sntp_server_1: "0.pool.ntp.org" - sntp_server_2: "1.pool.ntp.org" - sntp_server_3: "2.pool.ntp.org" - # Enables faster network connections, with last connected SSID being connected to and no full scan for SSID being undertaken - wifi_fast_connect: "false" - # Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE - log_level: "DEBUG" - # Enable or disable the use of IPv6 networking on the device - ipv6_enable: "false" - color_interlock: "true" - -globals: - - id: fast_boot - type: int - restore_value: yes - initial_value: '0' - - - id: restore_mode - type: int - restore_value: yes - initial_value: "1" - -select: - - platform: template - name: "Power On State" - id: "power_mode" - optimistic: true - options: - - Always Off - - Always On - - Restore Power Off State - on_value: - then: - - lambda: |- - id(restore_mode)=i+1; - -esphome: - name: "${name}" - friendly_name: "${friendly_name}" - comment: "${device_description}" - area: "${room}" - name_add_mac_suffix: true - min_version: 2025.8.0 - project: - name: "${project_name}" - version: "${project_version}" - platformio_options: - board_build.flash_mode: dio - on_boot: - - priority: 600 - then: - - script.execute: fast_boot_script - - select.set_index: - id: power_mode - index: !lambda |- - return id(restore_mode)-1; - - lambda: |- - switch(id(restore_mode)) - { - case 1:{ - auto call = id(rgbww_light).turn_off(); - call.perform(); - break; - } - case 2:{ - auto call = id(rgbww_light).turn_on(); - call.set_color_mode(ColorMode::WHITE); - call.set_brightness(1.0); - call.perform(); - break; - } - default:{ - break; - } - } - - priority: -100 - then: - - if: - condition: - not: - wifi.connected: - then: - - logger.log: "No Wi-Fi connection, starting factory aging test..." - - script.execute: factory_test - else: - - logger.log: "Wi-Fi connected, normal operation mode." - -esp32: - board: esp32-c3-devkitm-1 - flash_size: 4MB - variant: ESP32C3 - framework: - type: esp-idf - version: recommended - -preferences: - flash_write_interval: 1min - -api: - -ota: - - platform: esphome - -logger: - -mdns: - disabled: false - -web_server: - port: 80 - -network: - enable_ipv6: ${ipv6_enable} - -wifi: - # This spawns an AP with the device name and mac address with no password. - ap: {} - # Allow rapid re-connection to previously connect WiFi SSID, skipping scan of all SSID - fast_connect: "${wifi_fast_connect}" - # Define dns domain / suffix to add to hostname - domain: "${dns_domain}" - - -captive_portal: - -esp32_improv: - authorizer: none - -dashboard_import: - package_import_url: github://athom-tech/esp32-configs/athom-rgbcw-light.yaml - -binary_sensor: - - platform: status - name: "Status" - entity_category: diagnostic - -sensor: - - platform: uptime - name: "Uptime Sensor" - id: uptime_sensor - type: - timestamp - entity_category: "diagnostic" - - - platform: wifi_signal - name: "WiFi Signal dB" - id: wifi_signal_db - update_interval: 60s - entity_category: "diagnostic" - - - platform: copy - source_id: wifi_signal_db - name: "WiFi Signal Percent" - filters: - - lambda: return min(max(2 * (x + 100.0), 0.0), 100.0); - unit_of_measurement: "Signal %" - entity_category: "diagnostic" - device_class: "" - -button: - - platform: restart - name: "Restart" - entity_category: config - - - platform: factory_reset - name: "Factory Reset" - id: Reset - entity_category: config - - - platform: safe_mode - name: "Safe Mode" - internal: false - entity_category: config - -output: - - platform: ledc - id: red_output - frequency: 9765 - pin: GPIO6 - min_power: 0 - max_power: 1 - - platform: ledc - id: green_output - frequency: 9765 - pin: GPIO7 - min_power: 0 - max_power: 1 - - platform: ledc - id: blue_output - frequency: 9765 - pin: GPIO5 - min_power: 0 - max_power: 1 - - platform: ledc - id: white_output - frequency: 9765 - pin: GPIO3 - min_power: 0 - max_power: 0.9 - - platform: ledc - id: warm_white_output - frequency: 9765 - pin: GPIO4 - min_power: 0 - max_power: 0.9 - -light: - - platform: rgbww - id: rgbww_light - name: "RGBCW_Bulb" - restore_mode: ${light_restore_mode} - red: red_output - green: green_output - blue: blue_output - cold_white: white_output - warm_white: warm_white_output - cold_white_color_temperature: 6500 K - warm_white_color_temperature: 3000 K - color_interlock: ${color_interlock} - constant_brightness: True - -text_sensor: - - platform: wifi_info - ip_address: - name: "IP Address" - id: ip_address - entity_category: diagnostic - ssid: - name: "Connected SSID" - id: ssid - entity_category: diagnostic - mac_address: - name: "Mac Address" - id: mac_address - entity_category: diagnostic - - - platform: template - name: "Last Restart" - id: device_last_restart - icon: mdi:clock - entity_category: diagnostic - device_class: timestamp - -time: - - platform: sntp - id: sntp_time - # Define the timezone of the device - timezone: "${timezone}" - # Change sync interval from default 5min to 6 hours (or as set in substitutions) - update_interval: ${sntp_update_interval} - # Set specific sntp servers to use - servers: - - "${sntp_server_1}" - - "${sntp_server_2}" - - "${sntp_server_3}" - # Publish the time the device was last restarted - on_time_sync: - then: - # Update last restart time, but only once. - - if: - condition: - lambda: 'return id(device_last_restart).state == "";' - then: - - text_sensor.template.publish: - id: device_last_restart - state: !lambda 'return id(sntp_time).now().strftime("%a %d %b %Y - %I:%M:%S %p");' - -script: - - id: fast_boot_script - then: - - if: - condition: - lambda: return ( id(fast_boot) >= 3 ); - then: - - lambda: |- - ESP_LOGD("athom-rgbww-light.yaml", "Now the counter is greater than or equal to 3, perform reset device and reboot"); - id(fast_boot) = 0; - fast_boot->loop(); - global_preferences->sync(); - auto call = id(rgbww_light).turn_on(); - call.set_transition_length(500); - call.set_brightness(1.0); - call.set_color_mode(ColorMode::RGB); - call.set_rgb(0.0, 0.0, 1.0); - call.perform(); - - delay: 5s - - button.press: Reset - - lambda: |- - id(fast_boot) += 1; - fast_boot->loop(); - global_preferences->sync(); - ESP_LOGD("athom-rgbww-light.yaml", "Now the counter is %d. Reset the device when the counter is greater than or equal to 3", id(fast_boot)); - - delay: 10s - - lambda: |- - ESP_LOGD("athom-rgbww-light.yaml", "Reset counter"); - id(fast_boot) = 0; - fast_boot->loop(); - global_preferences->sync(); \ No newline at end of file diff --git a/athom-rgbcw-light.yaml b/athom-rgbcw-light.yaml index ce12029..038fd69 100644 --- a/athom-rgbcw-light.yaml +++ b/athom-rgbcw-light.yaml @@ -10,7 +10,7 @@ substitutions: # Project Name project_name: "China Athom Technology.Athom 12W RGBCW Bulb" # Projection version denotes the release version of the yaml file, allowing checking of deployed vs latest version - project_version: "v3.1.0" + project_version: "v3.1.1" # Restore the light (GPO switch) upon reboot to state: light_restore_mode: RESTORE_DEFAULT_ON # 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) @@ -95,6 +95,17 @@ esphome: break; } } + - priority: -100 + then: + - if: + condition: + not: + wifi.connected: + then: + - logger.log: "No Wi-Fi connection, starting factory aging test..." + - script.execute: factory_test + else: + - logger.log: "Wi-Fi connected, normal operation mode." esp32: board: esp32-c3-devkitm-1 @@ -108,7 +119,6 @@ preferences: flash_write_interval: 1min api: - reboot_timeout: 0s ota: - platform: esphome @@ -132,6 +142,7 @@ wifi: # Define dns domain / suffix to add to hostname domain: "${dns_domain}" + captive_portal: esp32_improv: diff --git a/athom-zigbee-gateway.yaml b/athom-zigbee-gateway.yaml index 213f800..0466a99 100644 --- a/athom-zigbee-gateway.yaml +++ b/athom-zigbee-gateway.yaml @@ -48,8 +48,8 @@ dashboard_import: esp32_ble_tracker: scan_parameters: - interval: 1100ms - window: 1100ms + interval: 320ms + window: 320ms active: true bluetooth_proxy: