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:
__init__.py
:
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
fooby.py
:
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:
return
async_add_entities([ FoobyEntity(name="snafoo") ])
class FoobyEntity(Entity):
def __init__(self, name):
self._name = name
@property
def name(self):
return self._name
manifest.json
:
{
"domain": "simplex",
"name": "Simple Example",
"documentation": "http://example.com",
"requirements": [],
"codeowners": []
}
In my configuration.yaml
, I added this line:
simplex:
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 fooby.py
is not found on startup.
Can you point me to the obvious error I made?
Thank you in advance!