Report state (#27759)
* Add report state config * Add initial steps for local report state * Use owner of system as user_id * First working prototype * Only report state if requested * Add some good logging and adjust constant name * Move jwt generation out to non member * Move cache out to caller * Remove todo about cache * Move getting token out of class * Add timeout on calls * Validate config dependency * Support using service key to do sync call when api_key is not set * Make sure timezone is fixed for datetime dummy * Use exact expire_in time * Support renewing token on 401 * Test retry on 401 * No need to declare dummy key twice * Correct some docs on functions * Add test for token expiry
This commit is contained in:
parent
6303117354
commit
2bd9f5680d
4 changed files with 328 additions and 2 deletions
|
@ -32,6 +32,10 @@ CONF_API_KEY = "api_key"
|
|||
CONF_ROOM_HINT = "room"
|
||||
CONF_ALLOW_UNLOCK = "allow_unlock"
|
||||
CONF_SECURE_DEVICES_PIN = "secure_devices_pin"
|
||||
CONF_REPORT_STATE = "report_state"
|
||||
CONF_SERVICE_ACCOUNT = "service_account"
|
||||
CONF_CLIENT_EMAIL = "client_email"
|
||||
CONF_PRIVATE_KEY = "private_key"
|
||||
|
||||
DEFAULT_EXPOSE_BY_DEFAULT = True
|
||||
DEFAULT_EXPOSED_DOMAINS = [
|
||||
|
@ -72,7 +76,10 @@ TYPE_ALARM = PREFIX_TYPES + "SECURITYSYSTEM"
|
|||
|
||||
SERVICE_REQUEST_SYNC = "request_sync"
|
||||
HOMEGRAPH_URL = "https://homegraph.googleapis.com/"
|
||||
HOMEGRAPH_SCOPE = "https://www.googleapis.com/auth/homegraph"
|
||||
HOMEGRAPH_TOKEN_URL = "https://accounts.google.com/o/oauth2/token"
|
||||
REQUEST_SYNC_BASE_URL = HOMEGRAPH_URL + "v1/devices:requestSync"
|
||||
REPORT_STATE_BASE_URL = HOMEGRAPH_URL + "v1/devices:reportStateAndNotification"
|
||||
|
||||
# Error codes used for SmartHomeError class
|
||||
# https://developers.google.com/actions/reference/smarthome/errors-exceptions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue