How to use the home-assistant-js-websocket.genClientId function in home-assistant-js-websocket

To help you get started, we’ve selected a few home-assistant-js-websocket examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github home-assistant / home-assistant-polymer / src / onboarding / onboarding-create-user.ts View on Github external
    if (!this._name || !this._username || !this._password) {
      this._errorMsg = "required_fields";

    if (this._password !== this._passwordConfirm) {
      this._errorMsg = "password_not_match";

    this._loading = true;
    this._errorMsg = "";

    try {
      const clientId = genClientId();

      const result = await onboardUserStep({
        client_id: clientId,
        name: this._name,
        username: this._username,
        password: this._password,
        language: this.language,

      fireEvent(this, "onboarding-step", {
        type: "user",
    } catch (err) {
      // tslint:disable-next-line
github home-assistant / home-assistant-polymer / src / onboarding / ha-onboarding.ts View on Github external
// If we don't close the connection manually, the connection will be
      // closed when we navigate away from the page. Firefox allows JS to
      // continue to execute, and so HAWS will automatically reconnect once
      // the connection is closed. However, since we revoke our token below,
      // HAWS will reload the page, since that will trigger the auth flow.
      // In Firefox, triggering a reload will overrule the navigation that
      // was in progress.

      // Revoke current auth token.
      await this.hass!.auth.revoke();

      const state = btoa(
          hassUrl: `${location.protocol}//${}`,
          clientId: genClientId(),
github home-assistant / home-assistant-polymer / src / onboarding / onboarding-integrations.ts View on Github external
private async _finish() {
    const result = await onboardIntegrationStep(this.hass, {
      client_id: genClientId(),
    fireEvent(this, "onboarding-step", {
      type: "integration",