Home Assistant Custom Component Upgrade Guide for v0.93

Home Assistant introduced major breaking changes in release 0.93, with the addition of manifest files and a restructured folder layout. This caused some of my components to break very badly and I spent too much time attempting to fix them.

Directory Layout Change (before migration)

custom_components/
mycomp/
__init__.py
myplatform.py


Directory Layout Change (after migration)

custom_components/
mycomp/
__init__.py
manifest.json     (new file)
myplatform/
__init__.py       (new empty file containing doc string)
processor.py      (myplatform.py renamed)


The second item that caused problems for me is the fact my component uses loader.get_component to load the mqtt component (in order to subscribe to topics). The correct way to use other components from within your own component is to simply import it. loader.get_component was removed in 0.92. Cheeky.

Using other components from your custom component (before migration)

import homeassistant.loader as loader


Using other components from your custom component (after migration)

from homeassistant.components import mqtt
# This line can be removed completely.