New component for tasmota devices

Hello!

I got tasmota lights working with the mqtt platform, but I would like to simplify it and also be able to write custom logic to automate it without any limits by creating a custom component.

Is there a way to inherit mqtt light and start implementing on top of it? The first step I would like to do is to automatically set all mqtt topics based on the name that will be provided in the configuration.

This is my first try where I was able to reuse the mqtt light validation schema but I’m not sure what should I inherit and how to continue to get all mqtt light features.

Can maybe somebody share a basic example of how to do it?

import voluptuous as vol
import logging
import ptvsd

from homeassistant.const import DEVICE_DEFAULT_NAME
import homeassistant.helpers.config_validation as cv

from homeassistant.components.light import Light
import homeassistant.components.mqtt as mqtt

ptvsd.enable_attach()
ptvsd.wait_for_attach()

_LOGGER = logging.getLogger(__name__)
_CONF_INTERNAL_ID = "internal_id"

breakpoint()

PLATFORM_SCHEMA = mqtt.CONFIG_SCHEMA.extend({
    vol.Required(_CONF_INTERNAL_ID): cv.string
})

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Registering Tasmota platform"""
    _LOGGER.info("Initializing: %s" % config[_CONF_INTERNAL_ID])
    add_devices([TasmotaLight(config)])

class TasmotaLight(Light):

    def __init__(self, config):
        """Initializes a Tasmota light."""
        _LOGGER.info("Initializing %s" % config)
        self._state = None
        self._internal_id = config.get("internal_id", None)