Hi Folks, Was able to get 2 of these lamps running completly local with ESPhome (LibreTiny) - No Dissasembly - No Soldering - All over the air - Never had to download or log into Tuya App. Yeah!
I pretty much followed Digiblurs guide [UPDATED How To Guide - Tuya CloudCutter with ESPHome LibreTiny - No soldering | digiblurDIY] with the following things to note:
- Used a Rasberry Pi 4 (Tried first with Raspberry Pi 2 B, but the WiFi dongle I had couldnt get it into Access Point Mode. RP4 has inbuilt wifi and AP mode)
- Used the Raspberry Pi Imager with the Raspberry Pi OS Lite (32-Bit)
- When I got to the “Install ESPHome Kickstarter firmware on the Device” section, step 4, the “Manufacture/Device Name” option did not have a compatible image. So I used the “By Firmware version” process using the “2.0.0 - BK7231N / oem_bk7231n_strip_ty” version.
- I used this firmware file selection “ESPHome-Kickstart-v23.08.29_bk7231n_app.ota.ug.bin” (not the OpenBeken firmware)
- If you follow along closely, you will have to put the lamp into slow blink mode twice.
- After sucessfully cut from cloud, just connected to the Kickstart access point so I could add the correct local wifi details.
- Used the ltchiptool to generate the yaml.
- Created new ESPhome device which I called geniolamp01 and spliced in the YAML from the ltchiptool.
- Generated the UF2 firmware and flashed from the lamps Kickstart web site.
Problem:
- The YAML that was created by the ltchiptool did not enable the use of the button on the top of the lamp.
- I wanted to still be able to turn the lamp on and off from the lamp.
- I was able to determine the pin required to enable this (Pin 14), so added additioninal information to the YAML (As well as adding all the other stuff I like to add to the YAML
)
For those that are interested, here is the yaml I have used:
esphome:
name: geniolamp01
friendly_name: MCW Lamp
bk72xx:
board: cb3s
#board: generic-bk7231n-qfn32-tuya
#Beken chips, unlike ESP, do not have an RTC memory for storing data. The settings are saved in flash memory every 10 minutes, not every time you change. If you need to shorten the time, then use the code below
#https://github.com/libretiny-eu/libretiny/issues/75
#https://github.com/libretiny-eu/libretiny/issues/41
preferences:
flash_write_interval: 1min
# Enable logging
logger:
web_server:
port: 80
# Enable Home Assistant API
api:
encryption:
key: !secret enryption_key
ota:
- platform: esphome
password: !secret ota_password
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
use_address: 192.168.30.39 #required because I run the devices in a separate VLAN to my ESPHome
domain: .home
fast_connect: yes
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Geniolamp01 Fallback Hotspot"
password: !secret ap_password
captive_portal:
button:
- platform: restart
name: Restart
entity_category: diagnostic
debug:
update_interval: 30s
text_sensor:
- platform: debug
reset_reason:
name: Reset Reason
- platform: libretiny
version:
name: LibreTiny Version
entity_category: diagnostic
- platform: version
name: 'ESPHome Version'
entity_category: diagnostic
- platform: wifi_info
ip_address:
name: WiFi IP Address
entity_category: diagnostic
ssid:
name: WiFi SSID
entity_category: diagnostic
mac_address:
name: WiFi MAC Address
entity_category: diagnostic
dns_address:
name: WiFi DNS Address
entity_category: diagnostic
sensor:
- platform: wifi_signal
name: 'WiFi Signal'
entity_category: diagnostic
- platform: uptime
name: 'Uptime'
entity_category: diagnostic
unit_of_measurement: s
binary_sensor:
- platform: gpio
name: Button Press
pin: P14
on_press:
then:
- light.toggle: light_rgbw
output:
- platform: libretiny_pwm
id: output_red
pin: P8
- platform: libretiny_pwm
id: output_green
pin: P24
- platform: libretiny_pwm
id: output_blue
pin: P26
- platform: libretiny_pwm
id: output_cold
pin: P7
light:
- platform: rgbw
id: light_rgbw
name: Light
red: output_red
green: output_green
blue: output_blue
white: output_cold
restore_mode: RESTORE_DEFAULT_OFF
Anyway - I hope this is valuable for someone out there.
Pop a comment in if it helped you out.