Skip to content

Instantly share code, notes, and snippets.

@LeoDJ
Last active December 1, 2023 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LeoDJ/5f3f622d98eaeb5bd664f2ddcd790152 to your computer and use it in GitHub Desktop.
Save LeoDJ/5f3f622d98eaeb5bd664f2ddcd790152 to your computer and use it in GitHub Desktop.
Tuya AP-Future-RGBW ESPHome Device Config (https://s.click.aliexpress.com/e/_De97s2j)
# ESPHome Configuration for Tuya Smart Life RGBW Controller (AP-Future) by LeoDJ
# https://s.click.aliexpress.com/e/_De97s2j
# Implemented using ESPHome package feature, for semi-easy configuration of multiple devices
packages:
common: !include common/tuya-ap-future-rgbw.yaml
substitutions:
node_name: "rgbw-example-device"
node_friendly_name: "RGBW Example Device"
api_key: !secret generic_api_key
ap_password: !secret generic_ap_password
# workaround for the following PWM bug: https://github.com/libretiny-eu/libretiny/issues/200
- platform: template
id: ${id}
type: float
write_action:
- if:
condition:
light.is_on: ${light}
then:
output.set_level:
id: ${output}
level: !lambda return state + 0.0005;
else:
output.set_level:
id: ${output}
level: 0
esphome:
name: ${node_name}
friendly_name: ${node_friendly_name}
bk72xx:
board: generic-bk7231n-qfn32-tuya
logger:
# Enable Home Assistant API
api:
encryption:
key: ${api_key}
ota:
password: ${ota_password}
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "${node_name} Fallback"
password: ${ap_password}
captive_portal:
debug:
text_sensor:
- platform: debug
reset_reason:
name: Reset Reason
- platform: libretiny
version:
name: LibreTiny Version
output:
- platform: libretiny_pwm
id: output_red
pin: P8
- platform: libretiny_pwm
id: output_green
pin: P24
zero_means_zero: true
- platform: libretiny_pwm
id: output_blue
pin: P26
- platform: libretiny_pwm
id: output_white
pin: P7
# workaround for the following PWM bug: https://github.com/libretiny-eu/libretiny/issues/200
- <<: !include
file: "min-pwm-workaround.yaml"
vars:
id: output_red_
output: output_red
light: light_rgb
- <<: !include
file: "min-pwm-workaround.yaml"
vars:
id: output_green_
output: output_green
light: light_rgb
- <<: !include
file: "min-pwm-workaround.yaml"
vars:
id: output_blue_
output: output_blue
light: light_rgb
light:
- platform: rgb
id: light_rgb
name: "RGB"
red: output_red_
green: output_green_
blue: output_blue_
#white: output_white
#color_interlock: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment