Skip to content

Commit

Permalink
Merge pull request #201 from chishm/multiple-config
Browse files Browse the repository at this point in the history
fix: Apply all EC configurations in HA config packages
  • Loading branch information
danobot authored Oct 11, 2020
2 parents 18d8fd8 + 91fe835 commit 455023d
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions custom_components/entity_controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,11 @@ async def async_setup(hass, config):

component = EntityComponent(_LOGGER, DOMAIN, hass)

myconfig = config[DOMAIN][0]

_LOGGER.info(
"If you have ANY issues with EntityController (v"
+ VERSION
+ "), please enable DEBUG logging under the logger component and kindly report the issue on Github. https://github.com/danobot/entity-controller/issues"
)
_LOGGER.info("Domain Configuration: " + str(myconfig))

async_setup_entity_services(component)

Expand Down Expand Up @@ -330,17 +327,19 @@ async def async_setup(hass, config):
# Enter blocked state when component is enabled and entity is on
machine.add_transition(trigger="blocked", source="constrained", dest="blocked")

for key, config in myconfig.items():
if not config:
config = {}

# _LOGGER.info("Config Item %s: %s", str(key), str(config))
config["name"] = key
m = None
m = EntityController(hass, config, machine)
# machine.add_model(m.model)
# m.model.after_model(config)
devices.append(m)
for myconfig in config[DOMAIN]:
_LOGGER.info("Domain Configuration: " + str(myconfig))
for key, config in myconfig.items():
if not config:
config = {}

# _LOGGER.info("Config Item %s: %s", str(key), str(config))
config["name"] = key
m = None
m = EntityController(hass, config, machine)
# machine.add_model(m.model)
# m.model.after_model(config)
devices.append(m)

await component.async_add_entities(devices)

Expand Down

0 comments on commit 455023d

Please sign in to comment.