Skip to content

Instantly share code, notes, and snippets.

View awarecan's full-sized avatar

Jason Hu awarecan

View GitHub Profile
@awarecan
awarecan / lambda_function.py
Last active March 14, 2024 19:26
Alexa Smart Home Skill Adapter for Home Assistant
"""
Copyright 2019 Jason Hu <awaregit at gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@awarecan
awarecan / long_live_access_token.py
Created August 29, 2018 20:49
Get long-lived bearer token for home-assistant power user
import os
from datetime import timedelta
from homeassistant import auth, core, config as conf_util
CLIENT_ID = 'long_lived_client'
LIFE_TIME = timedelta(days=3650)
async def create_refresh_token(auth_mgr: auth.AuthManager,