Created
March 21, 2023 22:03
-
-
Save hnykda/2bd085fc90bc2c679ca6166eb92ff0da to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
substitutions: | |
device_name: bottommirror | |
esphome: | |
name: ${device_name} | |
platform: ESP8266 | |
board: esp01_1m | |
logger: | |
api: | |
ota: | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
manual_ip: | |
static_ip: 192.168.0.29 | |
gateway: 192.168.0.1 | |
subnet: 255.255.255.0 | |
#light: | |
light: | |
- platform: monochromatic | |
name: ${device_name}_ch1 | |
id: ${device_name}_ch1 | |
output: ${device_name}_out_ch1 | |
- platform: monochromatic | |
name: ${device_name}_ch2 | |
id: ${device_name}_ch2 | |
output: ${device_name}_out_ch2 | |
- platform: monochromatic | |
name: ${device_name}_ch3 | |
id: ${device_name}_ch3 | |
output: ${device_name}_out_ch3 | |
- platform: monochromatic | |
name: ${device_name}_ch4 | |
id: ${device_name}_ch4 | |
output: ${device_name}_out_ch4 | |
# If it has 1000 Hz, when more than a single channel are switched | |
# on, then it starts flickering on lower brightness | |
# flickering is worse when some other LEDs are switched on | |
# that are connected to the same power supply | |
# higher values here mean higher minimum brightness | |
# using cwww somehow makes everything worse (doesn't work | |
# very reliably with higher frequencies, apparently) | |
output: | |
- platform: esp8266_pwm | |
id: ${device_name}_out_ch1 | |
pin: GPIO12 | |
frequency: 10000 Hz | |
- platform: esp8266_pwm | |
id: ${device_name}_out_ch2 | |
pin: GPIO15 | |
frequency: 10000 Hz | |
- platform: esp8266_pwm | |
id: ${device_name}_out_ch3 | |
pin: GPIO14 | |
frequency: 10000 Hz | |
- platform: esp8266_pwm | |
id: ${device_name}_out_ch4 | |
pin: GPIO4 | |
frequency: 10000 Hz | |
sensor: | |
- platform: wifi_signal | |
name: "${device_name} - WiFi Signal" | |
update_interval: 60s | |
- platform: uptime | |
name: "${device_name} - Uptime" | |
icon: mdi:clock-outline | |
update_interval: 60s | |
- platform: uptime | |
name: "${device_name} - Uptime Seconds" | |
id: uptime_sensor | |
update_interval: 60s | |
on_raw_value: | |
then: | |
- text_sensor.template.publish: | |
id: uptime_human | |
state: !lambda |- | |
int seconds = round(id(uptime_sensor).raw_state); | |
int days = seconds / (24 * 3600); | |
seconds = seconds % (24 * 3600); | |
int hours = seconds / 3600; | |
seconds = seconds % 3600; | |
int minutes = seconds / 60; | |
seconds = seconds % 60; | |
return ( | |
(days ? String(days) + "d " : "") + | |
(hours ? String(hours) + "h " : "") + | |
(minutes ? String(minutes) + "m " : "") + | |
(String(seconds) + "s") | |
).c_str(); | |
- platform: adc | |
pin: A0 | |
name: "${device_name} - adc" | |
update_interval: 5s | |
accuracy_decimals: 4 | |
id: current_raw | |
internal: true | |
- platform: template | |
name: "${device_name} - Power" | |
unit_of_measurement: W | |
accuracy_decimals: 1 | |
device_class: power | |
update_interval: 5s | |
id: my_power | |
lambda: return id(current_raw).state; | |
filters: | |
- calibrate_linear: | |
- 0.39551 -> 0.0 | |
- 0.43750 -> 1.5834 | |
- multiply: 24 # 24V strips | |
- platform: total_daily_energy | |
name: "${device_name} - Total Daily Energy" | |
power_id: my_power | |
filters: | |
- multiply: 0.001 | |
unit_of_measurement: kW | |
# Enable time component to reset energy at midnight | |
time: | |
- platform: sntp | |
id: my_time | |
text_sensor: | |
- platform: template | |
name: "${device_name} - Uptime" | |
id: uptime_human | |
icon: mdi:clock-start | |
update_interval: 60s | |
switch: | |
- platform: restart | |
name: "${device_name} - Restart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment