def start(self): """Start the instance.""" # Ensure a local API exists to connect with remote if 'api' not in self.config.components: if not bootstrap.setup_component(self, 'api'): raise HomeAssistantError( 'Unable to setup local API to receive events') self.state = ha.CoreState.starting ha.create_timer(self) self.bus.fire(ha.EVENT_HOMEASSISTANT_START, origin=ha.EventOrigin.remote) # Ensure local HTTP is started self.pool.block_till_done() self.state = ha.CoreState.running time.sleep(0.05) # Setup that events from remote_api get forwarded to local_api # Do this after we are running, otherwise HTTP is not started # or requests are blocked if not connect_remote_events(self.remote_api, self.config.api): raise HomeAssistantError(( 'Could not setup event forwarding from api {} to ' 'local api {}').format(self.remote_api, self.config.api))
def start(self): # Ensure a local API exists to connect with remote if self.config.api is None: if not bootstrap.setup_component(self, 'api'): raise ha.HomeAssistantError( 'Unable to setup local API to receive events') ha.create_timer(self) self.bus.fire(ha.EVENT_HOMEASSISTANT_START, origin=ha.EventOrigin.remote) # Setup that events from remote_api get forwarded to local_api # Do this after we fire START, otherwise HTTP is not started if not connect_remote_events(self.remote_api, self.config.api): raise ha.HomeAssistantError( ('Could not setup event forwarding from api {} to ' 'local api {}').format(self.remote_api, self.config.api))
def start(self): # Ensure a local API exists to connect with remote if self.config.api is None: if not bootstrap.setup_component(self, 'api'): raise HomeAssistantError( 'Unable to setup local API to receive events') ha.create_timer(self) self.bus.fire(ha.EVENT_HOMEASSISTANT_START, origin=ha.EventOrigin.remote) # Setup that events from remote_api get forwarded to local_api # Do this after we fire START, otherwise HTTP is not started if not connect_remote_events(self.remote_api, self.config.api): raise HomeAssistantError(( 'Could not setup event forwarding from api {} to ' 'local api {}').format(self.remote_api, self.config.api))
def start(self): """Start the instance.""" # Ensure a local API exists to connect with remote if "api" not in self.config.components: if not bootstrap.setup_component(self, "api"): raise HomeAssistantError("Unable to setup local API to receive events") ha.create_timer(self) self.bus.fire(ha.EVENT_HOMEASSISTANT_START, origin=ha.EventOrigin.remote) # Give eventlet time to startup import eventlet eventlet.sleep(0.1) # Setup that events from remote_api get forwarded to local_api # Do this after we fire START, otherwise HTTP is not started if not connect_remote_events(self.remote_api, self.config.api): raise HomeAssistantError( ("Could not setup event forwarding from api {} to " "local api {}").format( self.remote_api, self.config.api ) )