example-custom-config/custom_components/example_load_platform/__init__.py

20 lines
516 B
Python

"""Example Load Platform integration."""
from __future__ import annotations
from homeassistant.core import HomeAssistant
from homeassistant.helpers.typing import ConfigType
DOMAIN = 'example_load_platform'
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Your controller/hub specific code."""
# Data that you want to share with your platforms
hass.data[DOMAIN] = {
'temperature': 23
}
hass.helpers.discovery.load_platform('sensor', DOMAIN, {}, config)
return True