esphome:
name: cs01
esp8266:
board: esp01_1m
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
password: "1"
wifi:
ssid: "99996"
password: ""
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "ss"
password: "12345678"
web_server:
port: 80
captive_portal:
switch:
- platform: gpio
pin: GPIO0
name: "smart-switch8"
id: relay1
restore_mode: RESTORE_DEFAULT_OFF
time:
- platform: sntp #NTP时间
id: sntp_time
servers: ntp5.aliyun.com #NTP服务器地址
timezone: UTC-8 #中国时区
on_time:
- seconds: 0
minutes: 0
hours: 17
days_of_week: MON-FRI
id: on
then:
- switch.turn_on: relay1
# Every morning on weekdays
- seconds: 0
minutes: 0
hours: 6
days_of_week: MON-FRI
id: off
then:
- switch.turn_off: relay1
on_...:
if:
condition:
time.has_time:
then:
- logger.log: Time has been set and is valid!
# Example lambda
lambda: |-
if (id(my_time).now().is_valid()) {
//do something here
}
|