async def get_auth(self, hass, hapid, pin): """Create a HomematicIP access point object.""" auth = AsyncAuth(hass.loop, async_get_clientsession(hass)) try: await auth.init(hapid) if pin: auth.pin = pin await auth.connectionRequest('HomeAssistant') except HmipConnectionError: return False return auth
async def get_auth(self, hass: HomeAssistantType, hapid, pin): """Create a HomematicIP access point object.""" auth = AsyncAuth(hass.loop, async_get_clientsession(hass)) try: await auth.init(hapid) if pin: auth.pin = pin await auth.connectionRequest("HomeAssistant") except HmipConnectionError: return False return auth
async def get_auth(self, opp: OpenPeerPower, hapid, pin): """Create a HomematicIP access point object.""" auth = AsyncAuth(opp.loop, async_get_clientsession(opp)) try: await auth.init(hapid) if pin: auth.pin = pin await auth.connectionRequest("OpenPeerPower") except HmipConnectionError: return None return auth
async def get_auth(self, hass, hapid, pin): """Create a HomematicIP access point object.""" from homematicip.aio.auth import AsyncAuth from homematicip.base.base_connection import HmipConnectionError auth = AsyncAuth(hass.loop, async_get_clientsession(hass)) try: await auth.init(hapid) if pin: auth.pin = pin await auth.connectionRequest('HomeAssistant') except HmipConnectionError: return False return auth
async def get_auth(self, hass, hapid, pin): """Create a HomematicIP access point object.""" from homematicip.aio.auth import AsyncAuth from homematicip.base.base_connection import HmipConnectionError auth = AsyncAuth(hass.loop, async_get_clientsession(hass)) print(auth) try: await auth.init(hapid) if pin: auth.pin = pin await auth.connectionRequest('HomeAssistant') except HmipConnectionError: return False return auth
async def no_ssl_fake_async_auth(event_loop): auth = AsyncAuth(event_loop) auth._connection._websession.post = partial( auth._connection._websession.post, ssl=False) yield auth await auth._connection._websession.close()
async def test_async_auth_challenge_no_pin(event_loop,fake_async_home:AsyncHome): with no_ssl_verification(): auth = AsyncAuth(event_loop) sgtin = "3014F711A000000BAD0C0DED" devicename = "auth_test" await auth.init(sgtin, lookup_url=fake_async_home._connection._lookup_url) result = await auth.connectionRequest(devicename) #TODO: Investigate why result is always None #assert result.status_code == 200 #assert (await auth.isRequestAcknowledged()) == False #assert (await auth.isRequestAcknowledged()) == False #fake_async_home._connection.api_call("auth/simulateBlueButton") #assert await auth.isRequestAcknowledged() == True #token = auth.requestAuthToken() #assert await token == hashlib.sha512(auth.uuid.encode('utf-8')).hexdigest().upper() #resultId = auth.confirmAuthToken(token) #assert await resultId == auth.uuid