Update SNTP

This commit is contained in:
Aiden
2024-08-16 20:14:29 +08:00
parent b6f4082099
commit 56b4a71be6
9 changed files with 178 additions and 21 deletions
+28
View File
@@ -0,0 +1,28 @@
name: CI
on:
pull_request:
jobs:
ci:
name: Building ${{ matrix.file }}
runs-on: ubuntu-latest
strategy:
matrix:
file:
- athom-2ch-relay-board.yaml
- athom-4ch-relay-board.yaml
- athom-8ch-relay-board.yaml
- athom-energy-monitor-x2.yaml
- athom-energy-monitor-x6.yaml
- athom-garage-door.yaml
- athom-mini-relay-v2.yaml
- athom-smart-plug.yaml
- athom-zigbee-gateway.yaml
steps:
- name: Checkout source code
uses: actions/checkout@v4.1.7
- name: Build ESPHome firmware to verify configuration
uses: esphome/build-action@v3.2.0
with:
yaml_file: ${{ matrix.file }}
+24
View File
@@ -0,0 +1,24 @@
name: Build and Publish ESPHome firmware and website
on:
push:
branches:
- main
jobs:
build:
uses: esphome/workflows/.github/workflows/publish.yml@main
with:
# CHANGEME: Set the filenames of your config files here:
files:
athom-2ch-relay-board.yaml,
athom-4ch-relay-board.yaml,
athom-8ch-relay-board.yaml,
athom-energy-monitor-x2.yaml,
athom-energy-monitor-x6.yaml,
athom-garage-door.yaml,
athom-mini-relay-v2.yaml,
athom-smart-plug.yaml,
athom-zigbee-gateway.yaml
# CHANGEME: Set the name of your project here:
name: Template Project
+23 -4
View File
@@ -4,15 +4,24 @@ substitutions:
room: ""
device_description: "athom esp32 2ch relay board"
project_name: "Athom Technology.ESP32 2CH Relay Board"
project_version: "v2.0.1"
project_version: "v2.0.2"
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: "DEBUG"
# Enable or disable the use of IPv6 networking on the device
ipv6_enable: "false"
relay1_restore_mode: RESTORE_DEFAULT_OFF
relay2_restore_mode: RESTORE_DEFAULT_OFF
@@ -39,6 +48,8 @@ preferences:
# Enable logging
logger:
baud_rate: 115200
level: ${log_level}
mdns:
disabled: false
@@ -52,6 +63,9 @@ 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: {}
@@ -223,8 +237,13 @@ time:
id: sntp_time
# Define the timezone of the device
timezone: "${timezone}"
# Change sync interval from default 5min to 6 hours
update_interval: 360min
# 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:
+23 -4
View File
@@ -4,15 +4,24 @@ substitutions:
room: ""
device_description: "athom esp32 4ch relay board"
project_name: "Athom Technology.ESP32 4CH Relay Board"
project_version: "v2.0.1"
project_version: "v2.0.2"
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: "DEBUG"
# Enable or disable the use of IPv6 networking on the device
ipv6_enable: "false"
relay1_restore_mode: RESTORE_DEFAULT_OFF
relay2_restore_mode: RESTORE_DEFAULT_OFF
relay3_restore_mode: RESTORE_DEFAULT_OFF
@@ -41,6 +50,8 @@ preferences:
# Enable logging
logger:
baud_rate: 115200
level: ${log_level}
mdns:
disabled: false
@@ -54,6 +65,9 @@ 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: {}
@@ -273,8 +287,13 @@ time:
id: sntp_time
# Define the timezone of the device
timezone: "${timezone}"
# Change sync interval from default 5min to 6 hours
update_interval: 360min
# 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:
+23 -4
View File
@@ -4,15 +4,24 @@ substitutions:
room: ""
device_description: "athom esp32 8ch relay board"
project_name: "Athom Technology.ESP32 8CH Relay Board"
project_version: "v2.0.1"
project_version: "v2.0.2"
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: "DEBUG"
# Enable or disable the use of IPv6 networking on the device
ipv6_enable: "false"
relay1_restore_mode: RESTORE_DEFAULT_OFF
relay2_restore_mode: RESTORE_DEFAULT_OFF
relay3_restore_mode: RESTORE_DEFAULT_OFF
@@ -45,6 +54,8 @@ preferences:
# Enable logging
logger:
baud_rate: 115200
level: ${log_level}
mdns:
disabled: false
@@ -58,6 +69,9 @@ 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: {}
@@ -372,8 +386,13 @@ time:
id: sntp_time
# Define the timezone of the device
timezone: "${timezone}"
# Change sync interval from default 5min to 6 hours
update_interval: 360min
# 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:
+25 -3
View File
@@ -5,14 +5,24 @@ substitutions:
room: ""
device_description: "athom bl0906 energy monitor (2 channels)"
project_name: "Athom Technology.Athom Energy Monitor(2 Channels)"
project_version: "2.0.1"
project_version: "2.0.2"
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: ""
# 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###########################
bl0906_tx_pin: GPIO7
@@ -56,7 +66,7 @@ ota:
logger:
baud_rate: 115200
# level: VERY_VERBOSE
level: ${log_level}
hardware_uart: UART0
mdns:
@@ -65,6 +75,9 @@ mdns:
web_server:
port: 80
network:
enable_ipv6: ${ipv6_enable}
wifi:
ap: {}
fast_connect: "${wifi_fast_connect}"
@@ -338,10 +351,19 @@ text_sensor:
time:
- platform: sntp
id: sntp_time
# Define the timezone of the device
timezone: "${timezone}"
update_interval: 360min
# 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 == "";'
+25 -3
View File
@@ -5,14 +5,24 @@ substitutions:
room: ""
device_description: "athom bl0906 energy monitor (6 channels)"
project_name: "Athom Technology.Athom Energy Monitor(6 Channels)"
project_version: "2.0.1"
project_version: "2.0.2"
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: ""
# 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###########################
bl0906_tx_pin: GPIO7
@@ -76,7 +86,7 @@ ota:
logger:
baud_rate: 115200
# level: VERY_VERBOSE
level: ${log_level}
hardware_uart: UART0
mdns:
@@ -85,6 +95,9 @@ mdns:
web_server:
port: 80
network:
enable_ipv6: ${ipv6_enable}
wifi:
ap: {}
fast_connect: "${wifi_fast_connect}"
@@ -526,10 +539,19 @@ text_sensor:
time:
- platform: sntp
id: sntp_time
# Define the timezone of the device
timezone: "${timezone}"
update_interval: 360min
# 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 == "";'
+3 -2
View File
@@ -24,7 +24,7 @@ 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 logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
log_level: "INFO"
log_level: "DEBUG"
# Enable or disable the use of IPv6 networking on the device
ipv6_enable: "false"
@@ -57,8 +57,9 @@ ota:
- platform: esphome
logger:
baud_rate: 115200
level: ${log_level}
baud_rate: 0
hardware_uart: UART0
mdns:
disabled: false
+4 -1
View File
@@ -7,6 +7,8 @@ substitutions:
project_version: "v2.0.1"
dns_domain: ""
timezone: ""
# Define logging level: NONE, ERROR, WARN, INFO, DEBUG (Default), VERBOSE, VERY_VERBOSE
log_level: "DEBUG"
# wifi_fast_connect: "false"
esphome:
@@ -63,7 +65,8 @@ ethernet:
# Enable logging
logger:
level: DEBUG
baud_rate: 115200
level: ${log_level}
# Enable Home Assistant API
api: