Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
add async setup method
Browse files Browse the repository at this point in the history
  • Loading branch information
bbo76 committed Dec 29, 2021
1 parent 02aae1f commit 3e33829
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions custom_components/beewi_light/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
_LOGGER.debug(f"Adding light {name} with mac:{mac}")
add_entities([BeewiLight(name, mac)])

async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the platform from config_entry."""
_LOGGER.debug(
f"async_setup_entry:setting up the config entry {config_entry.title} "
f"with data:{config_entry.data}"
)
name = config_entry.data.get(CONF_NAME) or DOMAIN
mac = config_entry.data.get(CONF_ADDRESS)
entity = BeewiLight(name, mac)
async_add_entities([entity])

class BeewiLight(LightEntity):
def __init__(self, name, mac):
"""Initialize"""
Expand Down

0 comments on commit 3e33829

Please sign in to comment.