many changes
This commit is contained in:
@@ -1,29 +1,43 @@
|
||||
substitutions:
|
||||
device_name: "livingroom-bulb-1"
|
||||
name: "livingroom-bulb-1"
|
||||
friendly_name: "Living Room Bulb 1"
|
||||
room: "Living Room"
|
||||
device_description: "athom 7w rgbcw light bulb"
|
||||
project_name: "Athom Technology.Athom RGBCW Bulb"
|
||||
dns_domain: ".cloonar.smart"
|
||||
timezone: ""
|
||||
sntp_update_interval: 6h
|
||||
sntp_server_1: "0.pool.ntp.org"
|
||||
sntp_server_2: "1.pool.ntp.org"
|
||||
sntp_server_3: "2.pool.ntp.org"
|
||||
log_level: "WARN"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
comment: ${friendly_name}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "${device_description}"
|
||||
area: "${room}"
|
||||
name_add_mac_suffix: false
|
||||
min_version: 2024.6.0
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
interval:
|
||||
- interval: 15s
|
||||
then:
|
||||
@@ -32,16 +46,25 @@ interval:
|
||||
api.connected: # check if api connected
|
||||
else:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
id: rgbww_light
|
||||
brightness: 100%
|
||||
|
||||
# Enable Home Assistant API
|
||||
esp8266:
|
||||
board: esp8285
|
||||
restore_from_flash: true
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
mdns:
|
||||
disabled: false
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -49,32 +72,158 @@ wifi:
|
||||
fast_connect: True
|
||||
domain: .cloonar.smart
|
||||
|
||||
light:
|
||||
- platform: rgbw
|
||||
id: my_light
|
||||
name: ${friendly_name}
|
||||
red: pwm_r
|
||||
green: pwm_g
|
||||
blue: pwm_b
|
||||
white: pwm_w
|
||||
captive_portal:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://athom-tech/athom-configs/athom-rgbww-light.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Status"
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: "Uptime Sensor"
|
||||
id: uptime_sensor
|
||||
entity_category: diagnostic
|
||||
internal: true
|
||||
|
||||
- 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: esp8266_pwm
|
||||
pin: GPIO13
|
||||
frequency: 1000 Hz
|
||||
id: pwm_r
|
||||
|
||||
id: red_output
|
||||
pin: GPIO4
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: green_output
|
||||
pin: GPIO12
|
||||
frequency: 1000 Hz
|
||||
id: pwm_g
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: blue_output
|
||||
pin: GPIO14
|
||||
frequency: 1000 Hz
|
||||
id: pwm_b
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: warm_white_output
|
||||
pin: GPIO13
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
- platform: esp8266_pwm
|
||||
id: white_output
|
||||
pin: GPIO5
|
||||
frequency: 1000 Hz
|
||||
id: pwm_w
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
|
||||
light:
|
||||
- platform: rgbww
|
||||
id: rgbww_light
|
||||
name: "RGBCW_Bulb"
|
||||
red: red_output
|
||||
green: green_output
|
||||
blue: blue_output
|
||||
warm_white: warm_white_output
|
||||
cold_white: white_output
|
||||
cold_white_color_temperature: 6000 K
|
||||
warm_white_color_temperature: 3000 K
|
||||
color_interlock: true
|
||||
|
||||
text_sensor:
|
||||
- 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
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
icon: mdi:clock-start
|
||||
|
||||
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");'
|
||||
@@ -1,29 +1,43 @@
|
||||
substitutions:
|
||||
device_name: "livingroom-bulb-2"
|
||||
name: "livingroom-bulb-2"
|
||||
friendly_name: "Living Room Bulb 2"
|
||||
room: "Living Room"
|
||||
device_description: "athom 7w rgbcw light bulb"
|
||||
project_name: "Athom Technology.Athom RGBCW Bulb"
|
||||
dns_domain: ".cloonar.smart"
|
||||
timezone: ""
|
||||
sntp_update_interval: 6h
|
||||
sntp_server_1: "0.pool.ntp.org"
|
||||
sntp_server_2: "1.pool.ntp.org"
|
||||
sntp_server_3: "2.pool.ntp.org"
|
||||
log_level: "WARN"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
comment: ${friendly_name}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "${device_description}"
|
||||
area: "${room}"
|
||||
name_add_mac_suffix: false
|
||||
min_version: 2024.6.0
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
interval:
|
||||
- interval: 15s
|
||||
then:
|
||||
@@ -32,16 +46,25 @@ interval:
|
||||
api.connected: # check if api connected
|
||||
else:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
id: rgbww_light
|
||||
brightness: 100%
|
||||
|
||||
# Enable Home Assistant API
|
||||
esp8266:
|
||||
board: esp8285
|
||||
restore_from_flash: true
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
mdns:
|
||||
disabled: false
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -49,32 +72,158 @@ wifi:
|
||||
fast_connect: True
|
||||
domain: .cloonar.smart
|
||||
|
||||
light:
|
||||
- platform: rgbw
|
||||
id: my_light
|
||||
name: ${friendly_name}
|
||||
red: pwm_r
|
||||
green: pwm_g
|
||||
blue: pwm_b
|
||||
white: pwm_w
|
||||
captive_portal:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://athom-tech/athom-configs/athom-rgbww-light.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Status"
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: "Uptime Sensor"
|
||||
id: uptime_sensor
|
||||
entity_category: diagnostic
|
||||
internal: true
|
||||
|
||||
- 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: esp8266_pwm
|
||||
pin: GPIO13
|
||||
frequency: 1000 Hz
|
||||
id: pwm_r
|
||||
|
||||
id: red_output
|
||||
pin: GPIO4
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: green_output
|
||||
pin: GPIO12
|
||||
frequency: 1000 Hz
|
||||
id: pwm_g
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: blue_output
|
||||
pin: GPIO14
|
||||
frequency: 1000 Hz
|
||||
id: pwm_b
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: warm_white_output
|
||||
pin: GPIO13
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
- platform: esp8266_pwm
|
||||
id: white_output
|
||||
pin: GPIO5
|
||||
frequency: 1000 Hz
|
||||
id: pwm_w
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
|
||||
light:
|
||||
- platform: rgbww
|
||||
id: rgbww_light
|
||||
name: "RGBCW_Bulb"
|
||||
red: red_output
|
||||
green: green_output
|
||||
blue: blue_output
|
||||
warm_white: warm_white_output
|
||||
cold_white: white_output
|
||||
cold_white_color_temperature: 6000 K
|
||||
warm_white_color_temperature: 3000 K
|
||||
color_interlock: true
|
||||
|
||||
text_sensor:
|
||||
- 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
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
icon: mdi:clock-start
|
||||
|
||||
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");'
|
||||
@@ -1,29 +1,54 @@
|
||||
substitutions:
|
||||
device_name: "livingroom-bulb-3"
|
||||
name: "livingroom-bulb-3"
|
||||
friendly_name: "Living Room Bulb 3"
|
||||
room: "Living Room"
|
||||
device_description: "athom 7w rgbcw light bulb"
|
||||
project_name: "Athom Technology.Athom RGBCW Bulb"
|
||||
dns_domain: ".cloonar.smart"
|
||||
timezone: ""
|
||||
sntp_update_interval: 6h
|
||||
sntp_server_1: "0.pool.ntp.org"
|
||||
sntp_server_2: "1.pool.ntp.org"
|
||||
sntp_server_3: "2.pool.ntp.org"
|
||||
log_level: "WARN"
|
||||
|
||||
globals:
|
||||
- id: fast_boot
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: '0'
|
||||
|
||||
- id: restore_mode
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: "1"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
comment: ${friendly_name}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "${device_description}"
|
||||
area: "${room}"
|
||||
name_add_mac_suffix: false
|
||||
min_version: 2024.6.0
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
interval:
|
||||
- interval: 15s
|
||||
then:
|
||||
@@ -32,16 +57,25 @@ interval:
|
||||
api.connected: # check if api connected
|
||||
else:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
id: rgbww_light
|
||||
brightness: 100%
|
||||
|
||||
# Enable Home Assistant API
|
||||
|
||||
esp8266:
|
||||
board: esp8285
|
||||
restore_from_flash: true
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
mdns:
|
||||
disabled: false
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -49,32 +83,158 @@ wifi:
|
||||
fast_connect: True
|
||||
domain: .cloonar.smart
|
||||
|
||||
light:
|
||||
- platform: rgbw
|
||||
id: my_light
|
||||
name: ${friendly_name}
|
||||
red: pwm_r
|
||||
green: pwm_g
|
||||
blue: pwm_b
|
||||
white: pwm_w
|
||||
captive_portal:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://athom-tech/athom-configs/athom-rgbww-light.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Status"
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: "Uptime Sensor"
|
||||
id: uptime_sensor
|
||||
entity_category: diagnostic
|
||||
internal: true
|
||||
|
||||
- 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: esp8266_pwm
|
||||
pin: GPIO13
|
||||
frequency: 1000 Hz
|
||||
id: pwm_r
|
||||
|
||||
id: red_output
|
||||
pin: GPIO4
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: green_output
|
||||
pin: GPIO12
|
||||
frequency: 1000 Hz
|
||||
id: pwm_g
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: blue_output
|
||||
pin: GPIO14
|
||||
frequency: 1000 Hz
|
||||
id: pwm_b
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: warm_white_output
|
||||
pin: GPIO13
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
- platform: esp8266_pwm
|
||||
id: white_output
|
||||
pin: GPIO5
|
||||
frequency: 1000 Hz
|
||||
id: pwm_w
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
|
||||
light:
|
||||
- platform: rgbww
|
||||
id: rgbww_light
|
||||
name: "RGBCW_Bulb"
|
||||
red: red_output
|
||||
green: green_output
|
||||
blue: blue_output
|
||||
warm_white: warm_white_output
|
||||
cold_white: white_output
|
||||
cold_white_color_temperature: 6000 K
|
||||
warm_white_color_temperature: 3000 K
|
||||
color_interlock: true
|
||||
|
||||
text_sensor:
|
||||
- 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
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
icon: mdi:clock-start
|
||||
|
||||
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");'
|
||||
@@ -1,29 +1,54 @@
|
||||
substitutions:
|
||||
device_name: "livingroom-bulb-4"
|
||||
name: "livingroom-bulb-4"
|
||||
friendly_name: "Living Room Bulb 4"
|
||||
room: "Living Room"
|
||||
device_description: "athom 7w rgbcw light bulb"
|
||||
project_name: "Athom Technology.Athom RGBCW Bulb"
|
||||
dns_domain: ".cloonar.smart"
|
||||
timezone: ""
|
||||
sntp_update_interval: 6h
|
||||
sntp_server_1: "0.pool.ntp.org"
|
||||
sntp_server_2: "1.pool.ntp.org"
|
||||
sntp_server_3: "2.pool.ntp.org"
|
||||
log_level: "WARN"
|
||||
|
||||
globals:
|
||||
- id: fast_boot
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: '0'
|
||||
|
||||
- id: restore_mode
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: "1"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
comment: ${friendly_name}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "${device_description}"
|
||||
area: "${room}"
|
||||
name_add_mac_suffix: false
|
||||
min_version: 2024.6.0
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
interval:
|
||||
- interval: 15s
|
||||
then:
|
||||
@@ -32,16 +57,25 @@ interval:
|
||||
api.connected: # check if api connected
|
||||
else:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
id: rgbww_light
|
||||
brightness: 100%
|
||||
|
||||
# Enable Home Assistant API
|
||||
esp8266:
|
||||
board: esp8285
|
||||
restore_from_flash: true
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
mdns:
|
||||
disabled: false
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -49,32 +83,158 @@ wifi:
|
||||
fast_connect: True
|
||||
domain: .cloonar.smart
|
||||
|
||||
light:
|
||||
- platform: rgbw
|
||||
id: my_light
|
||||
name: ${friendly_name}
|
||||
red: pwm_r
|
||||
green: pwm_g
|
||||
blue: pwm_b
|
||||
white: pwm_w
|
||||
captive_portal:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://athom-tech/athom-configs/athom-rgbww-light.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Status"
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: "Uptime Sensor"
|
||||
id: uptime_sensor
|
||||
entity_category: diagnostic
|
||||
internal: true
|
||||
|
||||
- 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: esp8266_pwm
|
||||
pin: GPIO13
|
||||
frequency: 1000 Hz
|
||||
id: pwm_r
|
||||
|
||||
id: red_output
|
||||
pin: GPIO4
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: green_output
|
||||
pin: GPIO12
|
||||
frequency: 1000 Hz
|
||||
id: pwm_g
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: blue_output
|
||||
pin: GPIO14
|
||||
frequency: 1000 Hz
|
||||
id: pwm_b
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: warm_white_output
|
||||
pin: GPIO13
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
- platform: esp8266_pwm
|
||||
id: white_output
|
||||
pin: GPIO5
|
||||
frequency: 1000 Hz
|
||||
id: pwm_w
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
|
||||
light:
|
||||
- platform: rgbww
|
||||
id: rgbww_light
|
||||
name: "RGBCW_Bulb"
|
||||
red: red_output
|
||||
green: green_output
|
||||
blue: blue_output
|
||||
warm_white: warm_white_output
|
||||
cold_white: white_output
|
||||
cold_white_color_temperature: 6000 K
|
||||
warm_white_color_temperature: 3000 K
|
||||
color_interlock: true
|
||||
|
||||
text_sensor:
|
||||
- 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
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
icon: mdi:clock-start
|
||||
|
||||
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");'
|
||||
@@ -1,29 +1,54 @@
|
||||
substitutions:
|
||||
device_name: "livingroom-bulb-5"
|
||||
name: "livingroom-bulb-5"
|
||||
friendly_name: "Living Room Bulb 5"
|
||||
room: "Living Room"
|
||||
device_description: "athom 7w rgbcw light bulb"
|
||||
project_name: "Athom Technology.Athom RGBCW Bulb"
|
||||
dns_domain: ".cloonar.smart"
|
||||
timezone: ""
|
||||
sntp_update_interval: 6h
|
||||
sntp_server_1: "0.pool.ntp.org"
|
||||
sntp_server_2: "1.pool.ntp.org"
|
||||
sntp_server_3: "2.pool.ntp.org"
|
||||
log_level: "WARN"
|
||||
|
||||
globals:
|
||||
- id: fast_boot
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: '0'
|
||||
|
||||
- id: restore_mode
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: "1"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
comment: ${friendly_name}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "${device_description}"
|
||||
area: "${room}"
|
||||
name_add_mac_suffix: false
|
||||
min_version: 2024.6.0
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
interval:
|
||||
- interval: 15s
|
||||
then:
|
||||
@@ -32,16 +57,25 @@ interval:
|
||||
api.connected: # check if api connected
|
||||
else:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
id: rgbww_light
|
||||
brightness: 100%
|
||||
|
||||
# Enable Home Assistant API
|
||||
esp8266:
|
||||
board: esp8285
|
||||
restore_from_flash: true
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
mdns:
|
||||
disabled: false
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -49,32 +83,158 @@ wifi:
|
||||
fast_connect: True
|
||||
domain: .cloonar.smart
|
||||
|
||||
light:
|
||||
- platform: rgbw
|
||||
id: my_light
|
||||
name: ${friendly_name}
|
||||
red: pwm_r
|
||||
green: pwm_g
|
||||
blue: pwm_b
|
||||
white: pwm_w
|
||||
captive_portal:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://athom-tech/athom-configs/athom-rgbww-light.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Status"
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: "Uptime Sensor"
|
||||
id: uptime_sensor
|
||||
entity_category: diagnostic
|
||||
internal: true
|
||||
|
||||
- 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: esp8266_pwm
|
||||
pin: GPIO13
|
||||
frequency: 1000 Hz
|
||||
id: pwm_r
|
||||
|
||||
id: red_output
|
||||
pin: GPIO4
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: green_output
|
||||
pin: GPIO12
|
||||
frequency: 1000 Hz
|
||||
id: pwm_g
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: blue_output
|
||||
pin: GPIO14
|
||||
frequency: 1000 Hz
|
||||
id: pwm_b
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: warm_white_output
|
||||
pin: GPIO13
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
- platform: esp8266_pwm
|
||||
id: white_output
|
||||
pin: GPIO5
|
||||
frequency: 1000 Hz
|
||||
id: pwm_w
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
|
||||
light:
|
||||
- platform: rgbww
|
||||
id: rgbww_light
|
||||
name: "RGBCW_Bulb"
|
||||
red: red_output
|
||||
green: green_output
|
||||
blue: blue_output
|
||||
warm_white: warm_white_output
|
||||
cold_white: white_output
|
||||
cold_white_color_temperature: 6000 K
|
||||
warm_white_color_temperature: 3000 K
|
||||
color_interlock: true
|
||||
|
||||
text_sensor:
|
||||
- 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
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
icon: mdi:clock-start
|
||||
|
||||
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");'
|
||||
@@ -1,29 +1,54 @@
|
||||
substitutions:
|
||||
device_name: "livingroom-bulb-6"
|
||||
name: "livingroom-bulb-6"
|
||||
friendly_name: "Living Room Bulb 6"
|
||||
room: "Living Room"
|
||||
device_description: "athom 7w rgbcw light bulb"
|
||||
project_name: "Athom Technology.Athom RGBCW Bulb"
|
||||
dns_domain: ".cloonar.smart"
|
||||
timezone: ""
|
||||
sntp_update_interval: 6h
|
||||
sntp_server_1: "0.pool.ntp.org"
|
||||
sntp_server_2: "1.pool.ntp.org"
|
||||
sntp_server_3: "2.pool.ntp.org"
|
||||
log_level: "WARN"
|
||||
|
||||
globals:
|
||||
- id: fast_boot
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: '0'
|
||||
|
||||
- id: restore_mode
|
||||
type: int
|
||||
restore_value: yes
|
||||
initial_value: "1"
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
comment: ${friendly_name}
|
||||
platform: ESP8266
|
||||
board: esp01_1m
|
||||
name: "${name}"
|
||||
friendly_name: "${friendly_name}"
|
||||
comment: "${device_description}"
|
||||
area: "${room}"
|
||||
name_add_mac_suffix: false
|
||||
min_version: 2024.6.0
|
||||
project:
|
||||
name: "${project_name}"
|
||||
version: "${project_version}"
|
||||
on_boot:
|
||||
priority: 300
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
then:
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
brightness: 20%
|
||||
- delay: 100ms
|
||||
- light.turn_on:
|
||||
id: rgbww_light
|
||||
red: 100%
|
||||
green: 50%
|
||||
blue: 0%
|
||||
white: 100%
|
||||
|
||||
interval:
|
||||
- interval: 15s
|
||||
then:
|
||||
@@ -32,16 +57,25 @@ interval:
|
||||
api.connected: # check if api connected
|
||||
else:
|
||||
- light.turn_on:
|
||||
id: my_light
|
||||
id: rgbww_light
|
||||
brightness: 100%
|
||||
|
||||
# Enable Home Assistant API
|
||||
esp8266:
|
||||
board: esp8285
|
||||
restore_from_flash: true
|
||||
|
||||
preferences:
|
||||
flash_write_interval: 1min
|
||||
|
||||
api:
|
||||
|
||||
ota:
|
||||
- platform: esphome
|
||||
|
||||
logger:
|
||||
|
||||
ota:
|
||||
platform: esphome
|
||||
mdns:
|
||||
disabled: false
|
||||
|
||||
wifi:
|
||||
ssid: !secret wifi_ssid
|
||||
@@ -49,32 +83,158 @@ wifi:
|
||||
fast_connect: True
|
||||
domain: .cloonar.smart
|
||||
|
||||
light:
|
||||
- platform: rgbw
|
||||
id: my_light
|
||||
name: ${friendly_name}
|
||||
red: pwm_r
|
||||
green: pwm_g
|
||||
blue: pwm_b
|
||||
white: pwm_w
|
||||
captive_portal:
|
||||
|
||||
dashboard_import:
|
||||
package_import_url: github://athom-tech/athom-configs/athom-rgbww-light.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: status
|
||||
name: "Status"
|
||||
entity_category: diagnostic
|
||||
|
||||
sensor:
|
||||
- platform: uptime
|
||||
name: "Uptime Sensor"
|
||||
id: uptime_sensor
|
||||
entity_category: diagnostic
|
||||
internal: true
|
||||
|
||||
- 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: esp8266_pwm
|
||||
pin: GPIO13
|
||||
frequency: 1000 Hz
|
||||
id: pwm_r
|
||||
|
||||
id: red_output
|
||||
pin: GPIO4
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: green_output
|
||||
pin: GPIO12
|
||||
frequency: 1000 Hz
|
||||
id: pwm_g
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: blue_output
|
||||
pin: GPIO14
|
||||
frequency: 1000 Hz
|
||||
id: pwm_b
|
||||
|
||||
min_power: 0.000499
|
||||
max_power: 1
|
||||
- platform: esp8266_pwm
|
||||
id: warm_white_output
|
||||
pin: GPIO13
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
- platform: esp8266_pwm
|
||||
id: white_output
|
||||
pin: GPIO5
|
||||
frequency: 1000 Hz
|
||||
id: pwm_w
|
||||
min_power: 0.000499
|
||||
max_power: 0.9
|
||||
|
||||
light:
|
||||
- platform: rgbww
|
||||
id: rgbww_light
|
||||
name: "RGBCW_Bulb"
|
||||
red: red_output
|
||||
green: green_output
|
||||
blue: blue_output
|
||||
warm_white: warm_white_output
|
||||
cold_white: white_output
|
||||
cold_white_color_temperature: 6000 K
|
||||
warm_white_color_temperature: 3000 K
|
||||
color_interlock: true
|
||||
|
||||
text_sensor:
|
||||
- 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
|
||||
|
||||
# Creates a sensor of the uptime of the device, in formatted days, hours, minutes and seconds
|
||||
- platform: template
|
||||
name: "Uptime"
|
||||
entity_category: diagnostic
|
||||
lambda: |-
|
||||
int seconds = (id(uptime_sensor).state);
|
||||
int days = seconds / (24 * 3600);
|
||||
seconds = seconds % (24 * 3600);
|
||||
int hours = seconds / 3600;
|
||||
seconds = seconds % 3600;
|
||||
int minutes = seconds / 60;
|
||||
seconds = seconds % 60;
|
||||
if ( days > 3650 ) {
|
||||
return { "Starting up" };
|
||||
} else if ( days ) {
|
||||
return { (String(days) +"d " + String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( hours ) {
|
||||
return { (String(hours) +"h " + String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else if ( minutes ) {
|
||||
return { (String(minutes) +"m "+ String(seconds) +"s").c_str() };
|
||||
} else {
|
||||
return { (String(seconds) +"s").c_str() };
|
||||
}
|
||||
icon: mdi:clock-start
|
||||
|
||||
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");'
|
||||
Reference in New Issue
Block a user