Skip to content

Instantly share code, notes, and snippets.

@WolfwithSword
Last active March 27, 2023 00:05
Show Gist options
  • Save WolfwithSword/a9f2421cf90b2d67b0abfd3a94039156 to your computer and use it in GitHub Desktop.
Save WolfwithSword/a9f2421cf90b2d67b0abfd3a94039156 to your computer and use it in GitHub Desktop.
ESPHome YAML for Bambu-Accessories Smart Control Box
substitutions:
device_name: "bambu-accessories"
friendly_name: "Bambu Accessories"
project_name: "bambu.accessories"
project_version: "1.0"
relay_restore_mode: RESTORE_DEFAULT_OFF
esphome:
name: "${device_name}"
name_add_mac_suffix: true
project:
name: "${project_name}"
version: "${project_version}"
#api:
# encryption:
# key: !secret ha_encryption_key
mqtt:
broker: !secret mqtt_broker
username: !secret mqtt_user
password: !secret mqtt_password
esp8266:
board: d1_mini
restore_from_flash: true
# Enable logging
logger:
ota:
password: !secret ota_password
wifi:
networks:
- ssid: !secret wifi_ssid
password: !secret wifi_password
priority: 10
- ssid: !secret bkp_wifi_ssid
password: !secret bkp_wifi_password
priority: 1
power_save_mode: none
#output_power: 10
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Bambu-Accessories Hotspot"
password: !secret ap_password
captive_portal:
text_sensor:
- platform: wifi_info
ip_address:
name: ${friendly_name} IP Address
ssid:
name: ${friendly_name} Connected SSID
bssid:
name: ${friendly_name} Connected BSSID
disabled_by_default: true
mac_address:
name: ${friendly_name} Mac Wifi Address
scan_results:
name: ${friendly_name} Latest Scan Results
disabled_by_default: true
time:
- platform: sntp
id: my_time
binary_sensor:
- platform: status
name: "${friendly_name} Status"
output:
- platform: esp8266_pwm
pin: D5
frequency: 1000 Hz
id: _1_pwm_output
- platform: esp8266_pwm
pin: D6
frequency: 1000 Hz
id: _2_pwm_output
- platform: esp8266_pwm
pin: D7
frequency: 1000 Hz
id: _3_pwm_output
- platform: esp8266_pwm
pin: D8
frequency: 1000 Hz
id: _4_pwm_output
light:
- platform: monochromatic
id: top_light
output: _1_pwm_output
name: "Bambu Top Lighting"
fan:
- platform: speed
id: bento_fans
output: _2_pwm_output
name: "BentoBox Fans"
sensor:
- platform: uptime
name: "${friendly_name} Uptime"
- platform: total_daily_energy
name: "${friendly_name} Light Daily Usage"
accuracy_decimals: 3
power_id: light_power_consumption_watt
filters:
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:calendar-clock
- platform: template
name: "${friendly_name} Light Power Usage"
id: light_power_consumption_watt
device_class: power
state_class: measurement
unit_of_measurement: W
accuracy_decimals: 2
lambda: |-
if (id(top_light).current_values.is_on()) {
return (17.0 * (id(top_light).current_values.get_brightness() *1.0));
} else {
return 0;
}
update_interval: 30s
- platform: total_daily_energy
name: "${friendly_name} Bento Fans Daily Usage"
accuracy_decimals: 3
power_id: fans_power_consumption_watt
filters:
- multiply: 0.001
unit_of_measurement: kWh
icon: mdi:calendar-clock
- platform: template
name: "${friendly_name} Bento Fans Power Usage"
id: fans_power_consumption_watt
device_class: power
state_class: measurement
unit_of_measurement: W
accuracy_decimals: 2
lambda: |-
if (id(bento_fans).state) {
return (4.6 * ((id(bento_fans).speed * 1.0) / 100.0));
} else {
return 0;
}
update_interval: 30s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment