@Override
        public void run() {
          try {
            if (isAwake()) {
              if (!isEstablished
                  || (!isInMotion()
                      && (System.currentTimeMillis() - lastEventSystemTime
                          > EVENT_RETRY_INTERVAL))) {

                if (!establishEventStream()) {
                  if ((System.currentTimeMillis() - lastEventSystemTime
                      > EVENT_RECOVERY_INTERVAL)) {
                    logger.warn("Event Stream : Resetting the vehicle connection");
                    connect();
                  }
                }
              }

              try {
                if (isEstablished) {
                  String line = null;
                  try {
                    line = eventBufferedReader.readLine();
                  } catch (Exception e) {
                    // we just move on. If we are here, then is most
                    // probably due to Premature EOF exceptions
                  }
                  if (line != null) {
                    lastEventSystemTime = System.currentTimeMillis();
                    logger.debug("Received an event: '{}'", line);
                    String vals[] = line.split(",");
                    if (!vals[0].equals(lastEventTimeStamp)) {
                      lastEventTimeStamp = vals[0];
                      for (int i = 0; i < EventKeys.values().length; i++) {
                        try {
                          TeslaChannelSelector selector =
                              TeslaChannelSelector.getValueSelectorFromRESTID(
                                  (EventKeys.values()[i]).toString());
                          if (!selector.isProperty()) {
                            State newState =
                                teslaChannelSelectorProxy.getState(
                                    vals[i], selector, editProperties());
                            if (newState != null && !vals[i].equals("")) {
                              updateState(selector.getChannelID(), newState);
                            } else {
                              updateState(selector.getChannelID(), UnDefType.UNDEF);
                            }
                          } else {
                            Map<String, String> properties = editProperties();
                            properties.put(
                                selector.getChannelID(), (selector.getState(vals[i])).toString());
                            updateProperties(properties);
                          }
                        } catch (Exception e) {
                          logger.warn(
                              "An exception occurred while processing an event received from the vehicle; '{}'",
                              e.getMessage());
                        }
                      }
                    }
                  }
                }
              } catch (Exception e) {
                logger.error(
                    "An exception occurred while reading event inputs from vehicle '{}' : {}",
                    vehicle.vin,
                    e.getMessage());
                isEstablished = false;
              }
            } else {
              logger.debug("Event stream : The vehicle is not awake");
              if (vehicle != null) {
                // wake up the vehicle until streaming token <> 0
                logger.debug("Event stream : Wake up vehicle");
                sendCommand(TESLA_COMMAND_WAKE_UP);
              } else {
                logger.debug("Event stream : Querying the vehicle");
                vehicle = queryVehicle();
              }
            }
          } catch (Exception t) {
            logger.error("An exception ocurred in the event stream thread: '{}'", t.getMessage());
          }
        }