andrewleech / ha_magiqtouch

Home Assistant (HACS) integration to control Seeley MagiQtouch heating and cooling units.
MIT License
20 stars 6 forks source link

botocore.exceptions.NoCredentialsError: Unable to locate credentials #2

Closed pastcompute closed 1 year ago

pastcompute commented 2 years ago

Hi there,

this is really awesome stuff, I have one of these aircons and I want to be able to hook it into OpenHab without having to bridge to google assistant. So I am directly using the magiqtouch class and doing my own MQTT integration.

However, I found it would not login to AWS until I gave it a fake AWS credential, without which the error botocore.exceptions.NoCredentialsError: Unable to locate credentials is returned

This can be fixed by changing the Cogito init as follows:

            cog = Cognito(
                user_pool_id=AWS_USER_POOL_ID,
                client_id=cognito_userpool_client_id,
                user_pool_region=AWS_REGION,
                username=self._user,
                access_key='AKIAIOSFODNN7EXAMPLE',
                secret_key='wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
            )

It took some rabbit holing to find this solution as I have not used Cogito before, I stumbled across this fix in https://stackoverflow.com/questions/47849702/aws-boto-warrant-library-srp-authentication-and-credentials-error