Convert Tasmota Templates to ESPHome

Hi there,

I just started with Tasmota and ESPHome. I have a power plug that I flashed with Tasmota using TuyaConvert, configured with this template: https://templates.blakadder.com/aisirer_AWP07L.html

It’s working great, but I tried to experiment a bit with ESPHome, so I wanted to convert the above template to a YAML for ESPHome and I was asking myself some questions:

  1. Is there a similar database for ESPHome configurations?
  2. How do I convert any Tasmota template to an ESPHome configuration. Is there any convenient way, since a database for Tasmota already exists?

Besides the common settings (like wifi, logger, api, ota) I need to configure the correct switches and binary sensors and I have no idea how to use the information from the Tasmota database to create a working ESPHome configuration.

Do you have any ideas?

The information on converting templates to gpio is here: https://github.com/arendst/Tasmota/wiki/Templates#explanation-of-template-properties

And here https://github.com/arendst/Tasmota/wiki/Components#components-list

Also, all of that information is decoded in the table on the top right of the page you linked to.

2 Likes

I just went through this.

There is a similar database for esphome, it is at esphome-configs.io moved to https://www.esphome-devices.com/ but it is not yet as comprehensive as the tasmota one. Keep adding stuff!

In the one you linked to:

GPIO # Component explain
GPIO00 Led1i This means gpio0 is linked to led1, but the signal is inverted (ie when the gpio is low, the led is on. config as a light in esphome.
GPIO01 None
GPIO02 Led2i Similar to gpio0
GPIO03 None
GPIO04 None
GPIO05 HLW8012 CF
GPIO09 None
GPIO10 None
GPIO12 HLWBL SELi
GPIO13 Button1 self explanatory. config in esphome as a binary_sensor
GPIO14 HLWBL CF1
GPIO15 Relay1 this turns the output on/off. config in esphome as a switch
GPIO16 None
FLAG None

I don’t really know what the HLW is all about, it is the power monitoring, see HLW8012 Power Sensor — ESPHome

2 Likes

This is one I use for a similar plug and seems to have the same GPIOs:

    
binary_sensor:
  - platform: gpio
    pin:
      number: GPIO13
    name: "Button"
    
status_led:
  pin:
    number: GPIO0
    inverted: True

sensor:
  - platform: hlw8012
    cf_pin: GPIO05
    cf1_pin: GPIO14 
    sel_pin: GPIO12 
    power:
      name: "Power"
      unit_of_measurement: W
      icon: mdi:flash-circle
      accuracy_decimals: 0
      filters:
      - lambda: if (x < (2 + 1)) return 0; else return (x - 1);
    update_interval: 10s

switch:
  - platform: gpio
    name: "Relay"
    pin: GPIO15

2 Likes

Thanks to all 3. Every information was helpful and I managed to set this switch up. Also, I now understand how to create the ESPHome config based on the Tasmota template. Thank you!

1 Like