Sonntag, 21. Mai 2023

ESPhome on Obi smart plug WFG-3-B with Libretiny and Tuya Cloudcutter

 Hello,

today I want to share with you a device yaml file for a smart plug I converted from Tuya / Smartlife to ESPhome. You can follow this tutorial from the maker of the libretiny project to convert your device into an ESPhome compatible device. 

https://www.youtube.com/watch?v=sSj8f-HCHQ0

Also Digiblur made a good video about it. I used his video to set-up the Tuya Cloudcutter. The ESPhome part can be done on your home assistant installation like it is done in the first video. You don´t need to build the firmware, use the kickstart firmware from kuba2k2 (first video).

https://digiblur.com/2023/04/10/tuya-cloudcutter-with-esphome-how-to-guide/


I used a smart plug from my local German DIY store, OBI. 

https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko-weiss/p/5274899


In my case the used chip inside was a BK7231T chip with WB2S module, running MCU 1.1.2. In Tuya Cloudcutter I wass successful with the following device profile: 

1.1.2 - BK7231T / oem_bk7231s_rnd_switch

The MCU version can be checked when adding the device to your Tuya App, see video. To find the specific chip used, I had to open my device and check on the board the printed name. I don´t think it is necessary again now for the next plug I will re-flash. To open the device, you need to destroy the scres as it is impossible to open them with a tool. I drilled them out.

The part I want to contribute to this is the created device file for the Obi smart plug as it was not easy to figure out the pins for the LED and the relay. 

This is not the full config, the WiFi part and so on is left out. This is something you need to make for your specific device. 

esphome:
  name: obiwifiplug
  name_add_mac_suffix: true
  comment: WFG-3-B, Wifi-Stecker Schuko Weiß von OBI, Artikelnummer 5274899 bei OBI, https://www.obi.de/hausfunksteuerung/wifi-stecker-schuko-weiss/p/5274899, Euromate GmbH & Co. KG, Art.-Nr. 210308

libretiny:
  board: generic-bk7231t-qfn32-tuya
  framework:
    version: dev

binary_sensor:
- platform: gpio
  id: button_1
  pin:
    number: P26
    inverted: true
    mode: INPUT_PULLUP
  on_press:
    then:
    - switch.toggle: switch_1

switch:
- platform: gpio
  id: switch_1
  name: Relay 1
  pin:
    number: P24
  on_turn_on:
    - output.turn_on: led
  on_turn_off:
    - output.turn_off: led

output:
- platform: gpio
  id: led
  pin: 
    number: P6
    inverted: true





Keine Kommentare:

Kommentar veröffentlichen