Creating a new component, but failing

Hi everyone!

I’m sorry if I’m asking a noob question, but I’m stuck. I am trying to write an own component, but I’m always failing at the startup stage. I could boil the problem down to a minimum example.

The path of my example is custom-components/simplex/. It contains three files:

from homeassistant.helpers.discovery import async_load_platform

DOMAIN = 'simplex'

async def async_setup(hass, config):
    hass.async_create_task(async_load_platform(hass, "fooby", DOMAIN, {}, config))
    return True

from homeassistant.helpers.entity import Entity

from . import DOMAIN

async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
    if discovery_info is None:
    async_add_entities([ FoobyEntity(name="snafoo") ])

class FoobyEntity(Entity):
    def __init__(self, name):
        self._name = name

    def name(self):
        return self._name


  "domain": "simplex",
  "name": "Simple Example",
  "documentation": "",
  "requirements": [],
  "codeowners": []

In my configuration.yaml, I added this line:


When I start my home-assistant now, I always get this error:

homeassistant | 2020-07-11 17:53:13 ERROR (MainThread) [homeassistant.setup] Setup failed for fooby: Integration not found.

I couldn’t find good examples about setting up an asynchronous component, so I looked at some components in the home-assistant source code, but I can’t find any reason why is not found on startup.

Can you point me to the obvious error I made? :slight_smile:

Thank you in advance!

I assume you need to have a fooby integration if you want to create a platform for it. In your skeleton, you are proposing a generic integration fooby and an integration simplex that creates an entity though a fooby platform. But, there is no fooby integration.

Thanks, Matthew!

Where do I have to add the fooby integration?

It is unclear whether you even need it. Can it simply be a sensor?

What I’m actually trying to do is to extend a CoverEntity, and then use pyduofern for controlling roller shutters.

Lacking of an example, I have used the existing spc implementation to see how it is made. There I have seen that discovery.async_load_platform(hass, "alarm_control_panel", DOMAIN, {}, config) seems to be used to load the file. I have used this spc component as base for my minimum example.

You should have a and extend CoverEntity there. The cover integration already exists. In your example, the alarm_control_panel integration already exists.

I renamed the CoverEntity file to, used async_load_platform(..., "cover", ...), and it’s being loaded now. Thank you! :grinning: