| 1 |
"""Constants for the hass-nabucasa.""" |
| 2 |
|
| 3 |
from __future__ import annotations |
| 4 |
|
| 5 |
from enum import StrEnum |
| 6 |
|
| 7 |
ACCOUNT_URL = "https://account.nabucasa.com/" |
| 8 |
|
| 9 |
CONFIG_DIR = ".cloud" |
| 10 |
|
| 11 |
REQUEST_TIMEOUT = 10 |
| 12 |
|
| 13 |
TWELVE_HOURS_IN_SECONDS = 12 * 60 * 60 |
| 14 |
ONE_HOUR_IN_SECONDS = 60 * 60 |
| 15 |
FIVE_MINUTES_IN_SECONDS = 5 * 60 |
| 16 |
|
| 17 |
MODE_PROD = "production" |
| 18 |
MODE_DEV = "development" |
| 19 |
|
| 20 |
STATE_CONNECTING = "connecting" |
| 21 |
STATE_CONNECTED = "connected" |
| 22 |
STATE_DISCONNECTED = "disconnected" |
| 23 |
|
| 24 |
DISPATCH_CERTIFICATE_STATUS = "certificate_status" |
| 25 |
DISPATCH_REMOTE_CONNECT = "remote_connect" |
| 26 |
DISPATCH_REMOTE_DISCONNECT = "remote_disconnect" |
| 27 |
DISPATCH_REMOTE_BACKEND_UP = "remote_backend_up" |
| 28 |
DISPATCH_REMOTE_BACKEND_DOWN = "remote_backend_down" |
| 29 |
|
| 30 |
DEFAULT_SERVERS: dict[str, dict[str, str]] = { |
| 31 |
"production": { |
| 32 |
"account_link": "account-link.nabucasa.com", |
| 33 |
"acme": "acme-v02.api.letsencrypt.org", |
| 34 |
"api": "api.nabucasa.com", |
| 35 |
"relayer": "cloud.nabucasa.com", |
| 36 |
"remotestate": "remotestate.nabucasa.com", |
| 37 |
}, |
| 38 |
"development": {}, |
| 39 |
} |
| 40 |
|
| 41 |
DEFAULT_VALUES: dict[str, dict[str, str]] = { |
| 42 |
"production": { |
| 43 |
"cognito_client_id": "60i2uvhvbiref2mftj7rgcrt9u", |
| 44 |
"user_pool_id": "us-east-1_87ll5WOP8", |
| 45 |
"region": "us-east-1", |
| 46 |
}, |
| 47 |
"development": {}, |
| 48 |
} |
| 49 |
|
| 50 |
MESSAGE_EXPIRATION = """ |
| 51 |
It looks like your Home Assistant Cloud subscription has expired. Please check |
| 52 |
your [account page](/config/cloud/account) to continue using the service. |
| 53 |
""" |
| 54 |
|
| 55 |
MESSAGE_AUTH_FAIL = """ |
| 56 |
You have been logged out of Home Assistant Cloud because we have been unable |
| 57 |
to verify your credentials. Please [log in](/config/cloud) again to continue |
| 58 |
using the service. |
| 59 |
""" |
| 60 |
|
| 61 |
MESSAGE_REMOTE_READY = """ |
| 62 |
Your remote access is now available. |
| 63 |
You can manage your connectivity on the |
| 64 |
[Cloud panel](/config/cloud) or with our [portal](https://account.nabucasa.com/). |
| 65 |
""" |
| 66 |
|
| 67 |
MESSAGE_REMOTE_SETUP = """ |
| 68 |
Unable to create a certificate. We will automatically |
| 69 |
retry it and notify you when it's available. |
| 70 |
""" |
| 71 |
|
| 72 |
MESSAGE_LOAD_CERTIFICATE_FAILURE = """ |
| 73 |
Unable to load the certificate. We will automatically |
| 74 |
recreate it and notify you when it's available. |
| 75 |
""" |
| 76 |
|
| 77 |
|
| 78 |
class CertificateStatus(StrEnum): |
| 79 |
"""Representation of the certificate status.""" |
| 80 |
|
| 81 |
ACME_ACCOUNT_CREATED = "acme_account_created" |
| 82 |
ACME_ACCOUNT_CREATING = "acme_account_creating" |
| 83 |
CERTIFICATE_FINALIZATION_FAILED = "certificate_finalization_failed" |
| 84 |
CERTIFICATE_FINALIZING = "certificate_finalizing" |
| 85 |
CERTIFICATE_LOAD_ERROR = "certificate_load_error" |
| 86 |
CHALLENGE_ANSWER_FAILED = "challenge_answer_failed" |
| 87 |
CHALLENGE_ANSWERED = "challenge_answered" |
| 88 |
CHALLENGE_ANSWERING = "challenge_answering" |
| 89 |
CHALLENGE_CLEANUP = "challenge_cleanup" |
| 90 |
CHALLENGE_CREATED = "challenge_created" |
| 91 |
CHALLENGE_DNS_FAILED = "challenge_dns_failed" |
| 92 |
CHALLENGE_DNS_PROPAGATING = "challenge_dns_propagating" |
| 93 |
CHALLENGE_DNS_UPDATED = "challenge_dns_updated" |
| 94 |
CHALLENGE_DNS_UPDATING = "challenge_dns_updating" |
| 95 |
CHALLENGE_PENDING = "challenge_pending" |
| 96 |
CHALLENGE_UNEXPECTED_ERROR = "challenge_unexpected_error" |
| 97 |
CSR_GENERATING = "csr_generating" |
| 98 |
DOMAIN_VALIDATION_FAILED = "domain_validation_failed" |
| 99 |
ERROR = "error" |
| 100 |
EXPIRED = "expired" |
| 101 |
EXPIRING_SOON = "expiring_soon" |
| 102 |
GENERATING = "generating" |
| 103 |
INITIAL_CERT_ERROR = "initial_cert_error" |
| 104 |
INITIAL_GENERATING = "initial_generating" |
| 105 |
INITIAL_LOADED = "initial_loaded" |
| 106 |
LOADED = "loaded" |
| 107 |
LOADING = "loading" |
| 108 |
NO_CERTIFICATE = "no_certificate" |
| 109 |
READY = "ready" |
| 110 |
RENEWAL_FAILED = "renewal_failed" |
| 111 |
RENEWAL_GENERATING = "renewal_generating" |
| 112 |
RENEWAL_LOADED = "renewal_loaded" |
| 113 |
SSL_CONTEXT_ERROR = "ssl_context_error" |
| 114 |
VALIDATING = "validating" |
| 115 |
|
| 116 |
|
| 117 |
class SubscriptionReconnectionReason(StrEnum): |
| 118 |
"""Subscription reconnection reason.""" |
| 119 |
|
| 120 |
CONNECTION_ERROR = "connection_error" |
| 121 |
NO_SUBSCRIPTION = "no_subscription" |
| 122 |
SUBSCRIPTION_EXPIRED = "subscription_expired" |