Add New Device

This commit is contained in:
Aiden committed 2025-07-23 17:56:25 +08:00
1 parent 2616de21dd
commit 7d3e4ff788
5 files changed
+980 -5

No files matched your search

+3 -5
View File
@@ -32,6 +32,9 @@ jobs:
- athom-smart-plug
- athom-zigbee-gateway
- athom-presence-sensor-v3
- athom-scd40-sensor
- athom-sht40-sensor
- athom-ld2450-sensor
#### Modify above here to match your project ####
esphome-version:
@@ -46,8 +49,3 @@ jobs:
with:
yaml-file: ${{ matrix.file }}.yaml
version: ${{ matrix.esphome-version }}
- name: ESPHome ${{ matrix.esphome-version }} Factory
uses: esphome/build-action@v7
with:
yaml-file: ${{ matrix.file }}.factory.yaml
version: ${{ matrix.esphome-version }}
+3
View File
@@ -24,6 +24,9 @@ jobs:
athom-smart-plug.yaml
athom-zigbee-gateway.yaml
athom-presence-sensor-v3.yaml
athom-scd40-sensor.yaml
athom-sht40-sensor.yaml
athom-ld2450-sensor.yaml
esphome-version: 2025.7.0
combined-name: Athom-ESP32-Device
#### Modify above here to match your project ####
+378
View File
@@ -0,0 +1,378 @@
substitutions:
name: "athom-ps02c3mz-sensor"
friendly_name: "PS02C3MZ Sensor"
room: ""
device_description: "athom esp32c3 ld2450 motion target tracking sensor"
project_name: "Athom Technology.PS02C3MZ LD2450"
project_version: "v2.0.0"
update_interval: 60s
# 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: ""
# 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: "NONE"
# Enable or disable the use of IPv6 networking on the device
ipv6_enable: "false"
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
area: "${room}"
name_add_mac_suffix: true
min_version: 2025.7.0
project:
name: "${project_name}"
version: "${project_version}"
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32-c3-devkitm-1
flash_size: 4MB
framework:
type: esp-idf
version: recommended
# Enable logging
logger:
baud_rate: 115200
hardware_uart: UART0
level: ${log_level}
mdns:
disabled: false
web_server:
port: 80
# Enable Home Assistant API
api:
ota:
- platform: esphome
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-ld2450-sensor.yaml
light:
- platform: status_led
name: "Status LED"
id: led
pin: GPIO2
disabled_by_default: true
entity_category: config
i2c:
sda: GPIO18
scl: GPIO19
scan: true
uart:
id: uart_ld2450
tx_pin: GPIO8
rx_pin: GPIO5
baud_rate: 256000
parity: NONE
stop_bits: 1
ld2450:
id: ld2450_radar
uart_id: uart_ld2450
throttle: 1000ms
button:
- platform: ld2450
ld2450_id: ld2450_radar
factory_reset:
name: "LD2450 Factory Reset"
entity_category: "config"
restart:
name: "LD2450 Restart"
entity_category: "config"
- platform: factory_reset
name: Restart with Factory Default Settings
id: Reset
entity_category: config
- platform: restart
name: Restart_esp
id: restart_esp
entity_category: config
- platform: safe_mode
name: "Safe Mode"
internal: false
entity_category: config
sensor:
- platform: ld2450
ld2450_id: ld2450_radar
target_count:
name: Presence Target Count
still_target_count:
name: Still Target Count
moving_target_count:
name: Moving Target Count
target_1:
x:
name: Target-1 X
y:
name: Target-1 Y
speed:
name: Target-1 Speed
angle:
name: Target-1 Angle
distance:
name: Target-1 Distance
resolution:
name: Target-1 Resolution
target_2:
x:
name: Target-2 X
y:
name: Target-2 Y
speed:
name: Target-2 Speed
angle:
name: Target-2 Angle
distance:
name: Target-2 Distance
resolution:
name: Target-2 Resolution
target_3:
x:
name: Target-3 X
y:
name: Target-3 Y
speed:
name: Target-3 Speed
angle:
name: Target-3 Angle
distance:
name: Target-3 Distance
resolution:
name: Target-3 Resolution
zone_1:
target_count:
name: Zone-1 All Target Count
still_target_count:
name: Zone-1 Still Target Count
moving_target_count:
name: Zone-1 Moving Target Count
zone_2:
target_count:
name: Zone-2 All Target Count
still_target_count:
name: Zone-2 Still Target Count
moving_target_count:
name: Zone-2 Moving Target Count
zone_3:
target_count:
name: Zone-3 All Target Count
still_target_count:
name: Zone-3 Still Target Count
moving_target_count:
name: Zone-3 Moving Target Count
- 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: ""
- platform: bh1750
name: "Light Sensor"
id: "bh1750_sensor"
address: 0x23
update_interval: 5s
binary_sensor:
- platform: ld2450
ld2450_id: ld2450_radar
has_target:
name: Presence
has_moving_target:
name: Moving Target
has_still_target:
name: Still Target
- platform: status
name: "Status"
entity_category: diagnostic
- platform: gpio
pin:
number: GPIO9
mode: INPUT_PULLUP
inverted: true
name: "Button"
disabled_by_default: true
on_multi_click:
- timing:
- ON for at least 4s
then:
- button.press: Reset
- platform: gpio
pin:
number: GPIO3
mode:
input: true
pullup: true
name: "Pir Sensor"
id: pir
filters:
- delayed_on: 50ms
- delayed_off: 10s
device_class: motion
switch:
- platform: ld2450
ld2450_id: ld2450_radar
bluetooth:
name: "Bluetooth"
multi_target:
name: "Multi Target Tracking"
text_sensor:
- platform: ld2450
ld2450_id: ld2450_radar
version:
name: "LD2450 Firmware"
mac_address:
name: "LD2450 BT MAC"
target_1:
direction:
name: "Target-1 Direction"
target_2:
direction:
name: "Target-2 Direction"
target_3:
direction:
name: "Target-3 Direction"
- platform: wifi_info
ip_address:
name: "IP Address"
entity_category: diagnostic
ssid:
name: "Connected SSID"
entity_category: diagnostic
mac_address:
name: "Mac Address"
entity_category: diagnostic
# Creates a sensor showing when the device was last restarted
- platform: template
name: 'Last Restart'
id: device_last_restart
icon: mdi:clock
entity_category: diagnostic
# device_class: timestamp
number:
- platform: ld2450
ld2450_id: ld2450_radar
presence_timeout:
name: "Timeout"
zone_1:
x1:
name: Zone-1 X1
y1:
name: Zone-1 Y1
x2:
name: Zone-1 X2
y2:
name: Zone-1 Y2
zone_2:
x1:
name: Zone-2 X1
y1:
name: Zone-2 Y1
x2:
name: Zone-2 X2
y2:
name: Zone-2 Y2
zone_3:
x1:
name: Zone-3 X1
y1:
name: Zone-3 Y1
x2:
name: Zone-3 X2
y2:
name: Zone-3 Y2
select:
- platform: ld2450
ld2450_id: ld2450_radar
baud_rate:
name: "Baud rate"
zone_type:
name: "Zone Type"
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");'
+275
View File
@@ -0,0 +1,275 @@
substitutions:
name: "athom-co2-sensor"
friendly_name: "Athom C02 Sensor"
# Allows ESP device to be automatically lined to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc
room: ""
device_description: "athom scd40 CO₂ sensor"
project_name: "China Athom Technology.CO₂ Sensor"
project_version: "1.0.5"
update_interval: 5s
# 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"
#############################ESP32C3###########################
sht40_sda_pin: GPIO10
sht40_scl_pin: GPIO8
button_pin: GPIO9
led_pin: GPIO21
#############################ESP32C3###########################
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
area: "${room}"
name_add_mac_suffix: true
min_version: 2025.7.0
project:
name: "${project_name}"
version: "${project_version}"
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32-c3-devkitm-1
flash_size: 4MB
framework:
type: esp-idf
version: recommended
api:
# reboot_timeout: 0s
ota:
- platform: esphome
logger:
baud_rate: 115200
level: ${log_level}
mdns:
disabled: false
web_server:
port: 80
network:
enable_ipv6: ${ipv6_enable}
wifi:
ap: {}
fast_connect: "${wifi_fast_connect}"
domain: "${dns_domain}"
captive_portal:
improv_serial:
esp32_improv:
authorizer: none
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
dashboard_import:
package_import_url: github://athom-tech/esp32-configs/athom-scd40-sensor.yaml
i2c:
sda: "$sht40_sda_pin"
scl: "$sht40_scl_pin"
scan: true
id: bus_a
# Example configuration entry
sensor:
- platform: scd4x
update_interval: ${update_interval}
co2:
name: "CO2"
id: "co2"
on_value:
then:
- script.execute: update_aqi
- 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: ""
binary_sensor:
- platform: status
name: "Status"
entity_category: diagnostic
- platform: gpio
pin:
number: "$button_pin"
mode: INPUT_PULLUP
inverted: true
name: "Power Button"
disabled_by_default: true
on_multi_click:
- timing:
- ON for at least 4s
then:
- button.press: Reset
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
light:
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: "$led_pin"
num_leds: 1
chipset: ws2812
restore_mode: RESTORE_DEFAULT_OFF
name: "Light"
id: "led"
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
- platform: template
name: "Air Quality Index"
id: aqi
icon: mdi:air-filter
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: update_aqi
mode: restart
then:
- if:
condition:
or:
- sensor.in_range:
id: co2
above: 1500
then:
- text_sensor.template.publish:
id: aqi
state: Bad
- light.turn_on:
id: led
brightness: 100%
red: 100%
green: 0%
blue: 0%
else:
- if:
condition:
or:
- sensor.in_range:
id: co2
above: 800
below: 1500
then:
- text_sensor.template.publish:
id: aqi
state: Acceptable
- light.turn_on:
id: led
brightness: 50%
red: 100%
green: 100%
blue: 0%
else:
- text_sensor.template.publish:
id: aqi
state: Good
- light.turn_on:
id: led
brightness: 50%
red: 0%
green: 100%
blue: 0%
+321
View File
@@ -0,0 +1,321 @@
substitutions:
name: "athom-tem-hum-sensor"
friendly_name: "Athom Temperature Humidity Sensor"
# Allows ESP device to be automatically lined to an 'Area' in Home Assistant. Typically used for areas such as 'Lounge Room', 'Kitchen' etc
room: ""
device_description: "athom sht40 temperature and humidity sensor"
project_name: "China Athom Technology.Temperature Humidity Sensor"
project_version: "1.0.5"
update_interval: 5s
# 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"
temperature_offset: "-1"
humidity_offset: "5"
#############################ESP32C3###########################
sht40_sda_pin: GPIO10
sht40_scl_pin: GPIO8
button_pin: GPIO9
led_pin: GPIO21
#############################ESP32C3###########################
esphome:
name: "${name}"
friendly_name: "${friendly_name}"
area: "${room}"
name_add_mac_suffix: true
min_version: 2025.7.0
project:
name: "${project_name}"
version: "${project_version}"
platformio_options:
board_build.flash_mode: dio
on_boot:
priority: 800
then:
- if:
condition:
wifi.connected:
then:
- light.turn_off: led
else:
- script.execute: wifi_rgb_loop
esp32:
board: esp32-c3-devkitm-1
flash_size: 4MB
framework:
type: esp-idf
version: recommended
preferences:
flash_write_interval: 1min
api:
# reboot_timeout: 0s
ota:
- platform: esphome
logger:
baud_rate: 115200
level: ${log_level}
mdns:
disabled: false
web_server:
port: 80
network:
enable_ipv6: ${ipv6_enable}
wifi:
ap: {}
fast_connect: "${wifi_fast_connect}"
domain: "${dns_domain}"
on_connect:
then:
- script.stop: wifi_rgb_loop
- light.turn_off: led
on_disconnect:
then:
- script.execute: wifi_rgb_loop
captive_portal:
improv_serial:
esp32_improv:
authorizer: none
esp32_ble_tracker:
scan_parameters:
interval: 1100ms
window: 1100ms
active: true
bluetooth_proxy:
active: true
dashboard_import:
package_import_url: github://athom-tech/esp32-configs/athom-sht40-sensor.yaml
i2c:
sda: "$sht40_sda_pin"
scl: "$sht40_scl_pin"
scan: true
id: bus_a
sensor:
- platform: sht4x
i2c_id: bus_a
id: sht40_sensor
temperature:
name: Temperature
id: temperature_sensor
filters:
- offset: ${temperature_offset}
- lambda: "return x + id(temperature_offset_selection).state;"
humidity:
name: Humidity
id: humidity_sensor
filters:
- offset: ${humidity_offset}
- lambda: "return x + id(humidity_offset_selection).state;"
update_interval: ${update_interval}
- 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: ""
number:
- platform: template
name: "Temperature Offset"
id: temperature_offset_selection
unit_of_measurement: "°C"
min_value: -10
max_value: 10
step: 0.1
mode: box
update_interval: never
optimistic: true
restore_value: true
initial_value: 0
icon: "mdi:thermometer"
entity_category: config
on_value:
- lambda: 'id(sht40_sensor).update();'
- platform: template
name: "Humidity Offset"
id: humidity_offset_selection
unit_of_measurement: "%"
min_value: -30
max_value: 30
step: 0.1
mode: box
update_interval: never
optimistic: true
restore_value: true
initial_value: 0
icon: "mdi:water-percent"
entity_category: config
on_value:
- lambda: 'id(sht40_sensor).update();'
binary_sensor:
- platform: status
name: "Status"
entity_category: diagnostic
- platform: gpio
pin:
number: "$button_pin"
mode: INPUT_PULLUP
inverted: true
name: "Power Button"
disabled_by_default: true
on_multi_click:
- timing:
- ON for at least 4s
then:
- button.press: Reset
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
light:
- platform: esp32_rmt_led_strip
rgb_order: GRB
pin: "$led_pin"
num_leds: 1
chipset: ws2812
restore_mode: RESTORE_DEFAULT_OFF
name: "Light"
id: "led"
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: wifi_rgb_loop
mode: restart
then:
- logger.log: "Wi-Fi disconnected. RGB loop started"
- while:
condition:
not:
wifi.connected:
then:
- light.turn_on:
id: led
red: 100%
green: 0%
blue: 0%
brightness: 100%
- delay: 1s
- light.turn_on:
id: led
red: 0%
green: 100%
blue: 0%
brightness: 100%
- delay: 1s
- light.turn_on:
id: led
red: 0%
green: 0%
blue: 100%
brightness: 100%
- delay: 1s
- light.turn_off: led
- delay: 100ms