def connect(self, api):
        with self._lock:
            if len(self._targets) == 0:
                # First target we get, setup listener for events
                self.hass.bus.listen(ha.MATCH_ALL, self._event_listener)

            key = (api.host, api.port)

            self._targets[key] = api
Attach to a Home Assistant instance and forward events.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/remote.py/EventForwarder.connect