ESPHome custom component for Linptech G6L-WIFI

ESPHome custom component for Linptech G6L-WIFI (linp-doorbell-g04)

Background

The Linptech G6L-WIFI is a wifi doorbell with a self-powered button. It's part of the Mijia (Xiaomi smart home) ecosystem, but it unfortunately doesn't seem to announce events (such as the button being pressed) on the local network. As such, this project aims to provide replacement firmware to enable full local control via ESPHome - which provides for simple integration with Home Assistant.

As of early 2022, the latest version is the linp-doorbell-g04, which no longer contains a secondary microcontroller to handle the basic doorbell functionality; the ESP32 is now connected directly to the RF receiver and the doorbell chime chip. If you have the earlier linp-doorbell-g03 version with an STM8S005K6 microcontroller, see the linp-doorbell-g03 repository for a custom component for your device.

Hardware

The doorbell's base unit is pressed/clipped together - there are no screws or other fasteners holding it together. The seam between the two halves can be found running around the perimeter of the device.

With the device unplugged, carefully pry / pull the two halves apart.

Once you've got it open, you'll see an ESP32 module (which handles the wifi/network/cloud control, but not the basic doorbell functionality) with a row of test points beside it, marked (from top to bottom):

  • RXD0
  • TXD0
  • IO0
  • GND
  • 3.3V

These pads can be used to communicate with the ESP32 via UART serial in order to initially flash ESPHome on to the ESP32.

If you lift the main circuit board out of the plastic case, you'll find "3.3V" and "GND" pads near the top on the back/bottom, which can be used to power the entire unit instead of the mains. You can also power it from the 3.3V and GND pads next to the ESP32, but using these back pads can make it easier to use the other pads for flashing the ESP32. I highly recommend that you power it via one of these sets of pads while working on the doorbell, as it's much safer to use an isolated 3.3V DC supply (I use a 3.3V regulator on the end of a USB cable plugged into a USB charger or battery pack) than to try powering it from the mains while reflashing the ESP32. I desoldered the mains input wires from the circuit board, which allows the circuit board to be completely removed from the plastic case (if you unplug the speaker or remove it from the plastic case).

ESP32 quirks

The ESP32 module used in this device is a single-core variant. Additionally, the MAC address CRC written to the EFUSE at the factory seems to be incorrect, so a modification to the core libraries is required to disable the reset on MAC CRC check failure. Recent versions of ESPHome provide configuration options to handle both of these quirks when using the ESP-IDF framework; see doorbell.yaml for the appropriate configuration.

Requirements for flashing

  • ESPHome
  • A serial-to-USB adapter

Configuration

  • Set your own WiFi credentials in the wifi: section of the YAML file, so that it knows how to connect to your network. The example config uses the !secret directive; see the ESPHome docs for information if you're not familiar with this.
  • If you haven't already used a serial logger to get your button IDs from the stock firmware, ensure that you have the dumper enabled (dump: linptech_g6l in the remote_receiver configuration).

Flashing the ESP32

In order to boot the ESP32 into flash mode (so that you can write ESPHome to it), you'll need to pull the two pins closest the bottom right corner of the ESP32 module to ground; I did this by soldering fine wires to the rightmost pin on the bottom edge, the IO0 and GND test point beside the ESP32, but if you have an easier way to reliably short the two corner pads to ground temporarily, anything which is easy to undo should work fine.

  1. Connect GND, TXD0, RXD0 to a serial-to-USB adapter (making sure to connect the ESP's RXD0 to your adapter's TX (or TXD) pin and the ESP's TXD0 to your adapter's RX (or RXD) pin)
  2. Connect your serial-to-USB adapter to your computer, making note of the port which it shows up on (depending on your OS, this could be something along the lines of COM0 or /dev/ttyUSB0)
  3. Short the corner pads (mentioned above) to GND
  4. Power up the doorbell using the 3.3V and GND pads on the back of the board
  5. Run esphome doorbell.yaml run (replacing "doorbell.yaml" with whatever your YAML file is called, if you've called it something else)
  6. Once the compilation is complete, you'll be prompted to choose how to perform the update; choose your serial-to-USB adapter
  7. Once the flashing is complete, unplug the doorbell from the 5V power supply, remove the short from the corner pads to GND, then power it back up to boot normally
  8. The ESP32 should start up and connect to your WiFi network as configured in the yaml file; you can then add it to your Home Assistant and start integrating it into your home automation!

Configuring your buttons

Once you've flashed ESPHome (with the dumper enabled), use esphome logs doorbell.yaml to connect (via serial or wifi) to the ESP32 and view the log output. Pressing one of the buttons should result in a log message such as the following:

[remote.linptech_g6l:068]: Received Linptech G6L: address=0x123456

You can then use the part after address= (including the 0x prefix) in a remote_receiver binary sensor configuration block (see doorbell.yaml).

Home Assistant

Once you have your doorbell flashed with ESPHome and connected to Home Assistant, you should see the following services appear (if you included them in your configuration):

Service name Description Parameter 1 Parameter 2 Parameter 3
esphome.doorbell_play_tune Play a tune/chime tune [int, 1-40] volume [int, 1-8] mode [int, 1-4]
esphome.doorbell_stop_playing Stop the tune/chime, if one is currently playing

For a list of the available "tunes", see the table in the SZY8039B datasheet. Your online translation service of choice might provide more meaningful English names for some of the options.

The mode parameter isn't especially useful, as in the G6L-WIFI, the LEDs are connected to the ESP32 and not the SZY8039B. As such, modes 1, 2 and 4 play the music and mode 3 doesn't (which isn't much use).

Note that the doorbell prefix on all service names is the name of your ESPHome node, as defined in the esphome: block of your yaml file.

If these services don't appear in Home Assistant, try power cycling the doorbell so that it reconnects to Home Assistant. I've found that the services don't seem to appear on first connect, but do on the second.

Similar Resources

ESPHome component for Ikea Idasen desk control

ESPHome component for Ikea Idasen desk control

This component creates a bluetooth bridge for an Ikea Idasen desk that uses a Linak controller with ESPHome and an ESP32 device. Cover integration Lin

Dec 22, 2022

ESPHome component to send and receive HDMI-CEC messages.

HDMI-CEC ESPHome Component An ESPHome component that supports receiving and transmitting HDMI-CEC messages to connected HDMI devices. The ultimate goa

Dec 16, 2022

Stream server (serial-to-wifi bridge) for ESPHome

Stream server for ESPHome Custom component for ESPHome to expose a UART stream over WiFi or Ethernet. Can be used as a serial-to-wifi bridge as known

Jan 7, 2023

This API uses both composition and inheritance to provide a generic way to set up a custom server with a custom communication protocol and custom middlewares

This API uses both composition and inheritance to provide a generic way to set up a custom server with a custom communication protocol and custom middlewares

Ziapi Summary Introduction Installation Introduction This API uses both composition and inheritance to provide a generic way to set up a custom server

Apr 22, 2022

WiFi Attack + Recon Suite for the ESP8266 WiFi Nugget

Nugget-Invader Welcome to the Nugget Invader repository! The Invader is a WiFi attack suite developed for the WiFi Nugget, an ESP8266 based platform d

Nov 28, 2022

ESPHome integration for the Xiaomi Mijia Bedside Lamp v2.

esphome-xiaomi_bslamp2 Warning: this code is still under development This code might not yet be production-ready. At this point, it is declared beta-q

Dec 27, 2022

SmartShunt ve.direct to ESPHOME node

VictronSmartShunt-ESPHOME SmartShunt ve.direct to ESPHOME node A configured uart component is required. Example: victron: uart_id: the_uart sensor:

Dec 11, 2022

A collection of my ESPHome components.

ESPHome components A collection of my ESPHome components. To use this repository you should confugure it inside your yaml-configuration: external_comp

Jan 4, 2023

ESPHome BLE Keyboard

ESPHome BLE Keyboard The firmware implements the ability to connect your esp32 device as a BLE keyboard and send keystrokes via Home Assistant Table o

Dec 29, 2022

Projects related to sync'ing esphome devices with other protocols: DDP, E131, etc...

esphome sync This project is due to a desire to leverage WLED's new virtual strip (via DDP) feature or software like xLights or LEDFx to controls ESP

Dec 24, 2022

EspHoMaTriX - A simple DIY status display with an 8x32 RGB LED panel implemented with esphome.io

EspHoMaTriX (ehmtx) A simple DIY status display with an 8x32 RGB LED panel implemented with esphome.io Introduction There are some status displays out

Dec 29, 2022

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

EnTT is a header-only, tiny and easy to use library for game programming and much more written in modern C++. Among others, it's used in Minecraft by

Jan 4, 2023

A fast entity component system (ECS) for C & C++

A fast entity component system (ECS) for C & C++

Flecs is a fast and lightweight Entity Component System with a focus on high performance game development (join the Discord!). Highlights of the frame

Jan 8, 2023

A fast entity component system (ECS) for C & C++

A fast entity component system (ECS) for C & C++

Flecs is a fast and lightweight Entity Component System with a focus on high performance game development (join the Discord!). Highlights of the frame

Dec 31, 2022

Yet another component system

Yet another component system Header-only c++11 entity component system Depends on Parallel hashmap for fast pointer container Compile time type name a

Jul 30, 2022

A foobar2000 component which allows you to load and play ncm files directly.

A foobar2000 component which allows you to load and play ncm files directly.

Play NCM files directly with our favourite How to setup and build project Download foobar2000 SDK and extract into vendor/sdk Download WTL from source

Nov 25, 2022

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

Gaming meets modern C++ - a fast and reliable entity component system (ECS) and much more

EnTT is a header-only, tiny and easy to use library for game programming and much more written in modern C++. Among others, it's used in Minecraft by

Dec 30, 2022

Mars is a cross-platform network component developed by WeChat.

Mars is a cross-platform network component  developed by WeChat.

Mars is a cross-platform infrastructure component developed by WeChat Mobile Team

Jan 3, 2023

The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management ("init") system.

The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management (

InitWare isn't ready to use yet!! Unless you are doing so for fun, to experiment, or to contribute, you most likely do not want to try to install Init

Dec 21, 2022
Comments
  • Contacts for flash mode

    Contacts for flash mode

    I can not understand which contacts to close for transfer to flash in the new version. How below? The description says "In order to boot the ESP32 into flash mode (so that you can write ESPHome to it), you'll need to pull the two pins closest the bottom right corner of the ESP32 module to ground" 20220124_134832

  • Receiver doeasn't always react to the button

    Receiver doeasn't always react to the button

    I have 2 receivers. One still has the original firmware - and is further away from the transmitter button (in another room on another floor) - and it reacts to the button press (this is desired). Yet the esphome-flashed receiver which is in the same room as the button does not always react - there's nothing in the esphome logs either when it ignores the button press.

    I was wondering if what filters the RF was made less sensitive on this esphome firmware?

    I do not care much about repeated presses and stuff like that, I'll have that handled in HASS. I just want the stock-like reliability if it's possible.

    P.S.: I was wondering, how did you @pauln open up the casing? I used a drill and pried open mine through the drilled holes. I tried not to destroy it but then wrecked the casing anyway. I will be flashing the other receiver and I want to try to not wreck it.

  • Cant compile with default doorbell.yaml

    Cant compile with default doorbell.yaml

    I try compile default doorbell.yaml with esphome 2022.1.1

    Error

      variables:
        tune: int
        volume: int
        mode: int
      then:  [source doorbell.yaml:30]
        - [source doorbell.yaml:30]
    
          Unable to find action with the name 'remote_transmitter.transmit_szy8039b'.
          remote_transmitter.transmit_szy8039b:  [source doorbell.yaml:31]
    

    In gl03 in yaml was section external_componets, may be this should have it too?

  • New G6L board (TUYA compatible version)

    New G6L board (TUYA compatible version)

    Just bought the only available G6L doorbell in Poland. IMG_20221108_100300 IMG_20221108_100241 IMG_20221108_100250

    It seems that it has CBU TUYA-compatible MCU. Does ESPHome support CBU chips?

    Cheers, Szymon

Library code for Adafruit's CC3000 WiFi breakouts &c

Adafruit CC3000 Library This is a library for the Adafruit CC3000 WiFi Breakouts etc Designed specifically to work with the Adafruit CC3000 Breakout -

Sep 9, 2022
Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.

Adafruit IO Arduino Library This library provides a simple device independent interface for interacting with Adafruit IO using Arduino. It allows you

Dec 23, 2022
♾ The All-New AllThingsTalk Arduino SDK for WiFi Devices
♾ The All-New AllThingsTalk Arduino SDK for WiFi Devices

AllThingsTalk Arduino WiFi SDK AllThingsTalk Arduino Library for WiFi Devices - makes connecting your devices with your AllThingsTalk Maker a breeze.

Jul 21, 2022
The Approximate Library is a WiFi Arduino library for building proximate interactions between your Internet of Things and the ESP8266 or ESP32
The Approximate Library is a WiFi Arduino library for building proximate interactions between your Internet of Things and the ESP8266 or ESP32

The Approximate Library The Approximate library is a WiFi Arduino Library for building proximate interactions between your Internet of Things and the

Dec 7, 2022
ESP32 Temp Alarm using DS18B20, wifi manager, Email alert Threshold
ESP32 Temp Alarm using DS18B20, wifi manager, Email alert Threshold

ESP32-Freezer-Alarm ESP32 Temp Alarm using DS18B20, wifi manager, Email alert Threshold. I made this alarm using several tutorials from https://random

Oct 7, 2022
Library for Arduino UNO WiFi Developer Edition

Note: This library will no longer be maintained by Arduino. Uno WiFi Developer Edition Library Library for Arduino Uno WiFi Developer Edition For more

Feb 7, 2022
Simple application log library. supporting multiple log levels, custom output & flash memory support.
Simple application log library. supporting multiple log levels, custom output  & flash memory support.

ArduinoLog - C++ Log library for Arduino devices An minimalistic Logging framework for Arduino-compatible embedded systems. ArduinoLog is a minimalist

Nov 12, 2022
Simple ESPHome Wiegand custom component

esphome-wiegand Simple ESPHome Wiegand custom component Based on this code: https://github.com/Luisiado/wiegand_esphome_module To use: Drop wiegand_de

Dec 26, 2022
Custom ESPHome Component for generic Sit-Stand-Desks
Custom ESPHome Component for generic  Sit-Stand-Desks

ESPHomeGenericSitStandDesk I have one of those generic relatively cheap Sit Stand Desks. In an effort to monitor my desk usage I developed this overki

Dec 27, 2022
ESPHome Wordclock - based on esphome
ESPHome Wordclock - based on esphome

ha-wordclock-esphome General This project is just for documentation purposes and our attempt (together with a friend) to build an Wordclock, which is

Dec 26, 2022