Closed nderrico1223 closed 1 year ago
can you add
hatch_rest_api: debug
to your configuration.yaml under logging this log seems to be just saying the hatch library had an error but with those logs we might see better details about the cause.
@dahlb I do have that line in my configuration.yaml:
logger:
default: warning
logs:
custom_components.ha_hatch: debug
hatch_rest_api: debug
@dahlb turns out i was filtered by ha_hatch. This might have more info. Logins and tokens replaced with ***:
2022-12-18 16:54:05.353 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ha_hatch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-12-18 16:54:46.199 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/public/v1/login requestsending https://data.hatchbaby.com/public/v1/login request with {'email': '***@gmail.com', 'password': '***'}
2022-12-18 16:54:46.564 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 16:54:46 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '612', 'Connection': 'keep-alive', 'X-Hatch-Request-Id': '5wxYqlGKaX')>
2022-12-18 16:54:46.564 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Successful login', 'payload': {'id': 2185484, 'createDate': '2021-12-19 17:46:02', 'updateDate': '2021-12-19 17:46:02', 'active': True, 'email': '***@gmail.com', 'babies': [], 'defaultUnitOfMeasure': 'imperial', 'appType': 'iOS', 'firstName': '***', 'lastName': None, 'signupSource': 'rest', 'timezone': 'America/Chicago', 'timeZoneAdjust': -6, 'stage': -10000}, 'sync': 1671382481449, 'token': '***'}
2022-12-18 16:54:46.571 DEBUG (MainThread) [custom_components.ha_hatch] async setup
2022-12-18 16:54:46.574 DEBUG (MainThread) [custom_components.ha_hatch] async setup entry: {'email': '***@gmail.com', 'password': '***'}:{}
2022-12-18 16:54:46.952 DEBUG (MainThread) [custom_components.ha_hatch] updating credentials: initial setup
2022-12-18 16:54:46.953 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/public/v1/login requestsending https://data.hatchbaby.com/public/v1/login request with {'email': '***@gmail.com', 'password': '***'}
2022-12-18 16:54:47.289 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 16:54:47 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '612', 'Connection': 'keep-alive', 'X-Hatch-Request-Id': 'TOIKmRJqLq')>
2022-12-18 16:54:47.289 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Successful login', 'payload': {'id': 2185484, 'createDate': '2021-12-19 17:46:02', 'updateDate': '2021-12-19 17:46:02', 'active': True, 'email': '***@gmail.com', 'babies': [], 'defaultUnitOfMeasure': 'imperial', 'appType': 'iOS', 'firstName': '***', 'lastName': None, 'signupSource': 'rest', 'timezone': 'America/Chicago', 'timeZoneAdjust': -6, 'stage': -10000}, 'sync': 1671382482176, 'token': '***'}
2022-12-18 16:54:47.290 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/service/app/iotDevice/v2/fetch request
2022-12-18 16:54:47.356 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 16:54:47 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '116', 'Connection': 'keep-alive', 'Expires': '0', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'X-XSS-Protection': '1; mode=block', 'Pragma': 'no-cache', 'X-Frame-Options': 'DENY', 'Etag': '"02f847136dfeb16aa63b9f90ca89b5ad7"', 'X-Content-Type-Options': 'nosniff', 'X-Hatch-Request-Id': 'XzKO2nLx6n')>
2022-12-18 16:54:47.357 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Fetched list of IoT Devices', 'payload': [], 'sync': 1671382482325}
2022-12-18 16:54:47.357 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/service/app/restPlus/token/v1/fetch request
2022-12-18 16:54:47.451 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 16:54:47 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '1439', 'Connection': 'keep-alive', 'Expires': '0', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'X-XSS-Protection': '1; mode=block', 'Pragma': 'no-cache', 'X-Frame-Options': 'DENY', 'Etag': '"08ed753c4202d5c634c50a0c55f108e86"', 'X-Content-Type-Options': 'nosniff', 'X-Hatch-Request-Id': 'wLxKl5Uxwv')>
2022-12-18 16:54:47.452 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Got Cognito OpenId token', 'payload': {'endpoint': 'https://aacsjje0gbbcc-ats.iot.us-west-2.amazonaws.com', 'identityId': 'us-west-2:b1c78aed-d3a1-4cd2-aa5d-723142615afd', 'region': 'us-west-2', 'cognitoPoolId': 'us-west-2:5651fc22-f313-49d5-b379-fdab2c535d9c', 'token': '***'}, 'sync': 1671382482394}
2022-12-18 16:54:47.452 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://cognito-identity.us-west-2.amazonaws.com requestheaders: {'content-type': 'application/x-amz-json-1.1', 'X-Amz-Target': 'AWSCognitoIdentityService.GetCredentialsForIdentity'}sending https://cognito-identity.us-west-2.amazonaws.com request with {'IdentityId': 'us-west-2:b1c78aed-d3a1-4cd2-aa5d-723142615afd', 'Logins': {'cognito-identity.amazonaws.com': '***'}}
2022-12-18 16:54:47.743 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 16:54:47 GMT', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '1404', 'Connection': 'keep-alive', 'x-amzn-RequestId': '756eca46-1887-477b-b007-cea174a22861', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>
2022-12-18 16:54:47.743 DEBUG (MainThread) [hatch_rest_api.util_http] response raw: {"Credentials":{"AccessKeyId":"***","Expiration":1.671386087E9,"SecretKey":"***","SessionToken":"***"}
2022-12-18 16:54:48.217 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ***@gmail.com for ha_hatch
File "/config/custom_components/ha_hatch/__init__.py", line 135, in async_setup_entry
File "/config/custom_components/ha_hatch/__init__.py", line 111, in setup_connection
File "/usr/local/lib/python3.10/site-packages/hatch_rest_api/util_bootstrap.py", line 55, in get_rest_devices
my initial guess is you have a firewall blocking the websocket to aws, as all the http requests are successful but the websocket fails. I'll try to improve the error logging when i have time
v1.9.6 should add a little more logging if you can try again with that version (just released)
I tried disabling my pihole dns trap to set it up again. No luck. I'll update and report back with logs.
New logs below:
2022-12-18 20:16:50.444 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ha_hatch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2022-12-18 20:18:00.715 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/public/v1/login requestsending https://data.hatchbaby.com/public/v1/login request with {'email': '***@gmail.com', 'password': '***'}
2022-12-18 20:18:01.095 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 20:18:01 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '612', 'Connection': 'keep-alive', 'X-Hatch-Request-Id': 'b0Stjil5NG')>
2022-12-18 20:18:01.099 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Successful login', 'payload': {'id': 2185484, 'createDate': '2021-12-19 17:46:02', 'updateDate': '2021-12-19 17:46:02', 'active': True, 'email': '***@gmail.com', 'babies': [], 'defaultUnitOfMeasure': 'imperial', 'appType': 'iOS', 'firstName': '***', 'lastName': None, 'signupSource': 'rest', 'timezone': 'America/Chicago', 'timeZoneAdjust': -6, 'stage': -10000}, 'sync': 1671394675977, 'token': '***'}
2022-12-18 20:18:01.116 DEBUG (MainThread) [custom_components.ha_hatch] async setup
2022-12-18 20:18:01.121 DEBUG (MainThread) [custom_components.ha_hatch] async setup entry: {'email': '***@gmail.com', 'password': '***}:{}
2022-12-18 20:18:02.048 DEBUG (MainThread) [custom_components.ha_hatch] updating credentials: initial setup
2022-12-18 20:18:02.050 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/public/v1/login requestsending https://data.hatchbaby.com/public/v1/login request with {'email': '***@gmail.com', 'password': '***'}
2022-12-18 20:18:02.419 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 20:18:02 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '612', 'Connection': 'keep-alive', 'X-Hatch-Request-Id': '7bAb9g5Pj3')>
2022-12-18 20:18:02.419 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Successful login', 'payload': {'id': 2185484, 'createDate': '2021-12-19 17:46:02', 'updateDate': '2021-12-19 17:46:02', 'active': True, 'email': '***@gmail.com', 'babies': [], 'defaultUnitOfMeasure': 'imperial', 'appType': 'iOS', 'firstName': '***', 'lastName': None, 'signupSource': 'rest', 'timezone': 'America/Chicago', 'timeZoneAdjust': -6, 'stage': -10000}, 'sync': 1671394677313, 'token': '***'}
2022-12-18 20:18:02.420 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/service/app/iotDevice/v2/fetch request
2022-12-18 20:18:02.486 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 20:18:02 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '116', 'Connection': 'keep-alive', 'Expires': '0', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'X-XSS-Protection': '1; mode=block', 'Pragma': 'no-cache', 'X-Frame-Options': 'DENY', 'Etag': '"0e1a63dbe468812c50a4614a1614d3ce1"', 'X-Content-Type-Options': 'nosniff', 'X-Hatch-Request-Id': '2B730UXe27')>
2022-12-18 20:18:02.487 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Fetched list of IoT Devices', 'payload': [], 'sync': 1671394677455}
2022-12-18 20:18:02.487 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://data.hatchbaby.com/service/app/restPlus/token/v1/fetch request
2022-12-18 20:18:02.600 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 20:18:02 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '1439', 'Connection': 'keep-alive', 'Expires': '0', 'Cache-Control': 'no-cache, no-store, max-age=0, must-revalidate', 'X-XSS-Protection': '1; mode=block', 'Pragma': 'no-cache', 'X-Frame-Options': 'DENY', 'Etag': '"04481f48b73e57c3fab5756ffcb3b8221"', 'X-Content-Type-Options': 'nosniff', 'X-Hatch-Request-Id': 'zAbWwwBt1x')>
2022-12-18 20:18:02.600 DEBUG (MainThread) [hatch_rest_api.util_http] response json: {'status': 'success', 'message': 'Got Cognito OpenId token', 'payload': {'endpoint': 'https://aacsjje0gbbcc-ats.iot.us-west-2.amazonaws.com', 'identityId': 'us-west-2:b1c78aed-d3a1-4cd2-aa5d-723142615afd', 'region': 'us-west-2', 'cognitoPoolId': 'us-west-2:5651fc22-f313-49d5-b379-fdab2c535d9c', 'token': '***'}, 'sync': 1671394677544}
2022-12-18 20:18:02.601 DEBUG (MainThread) [hatch_rest_api.util_http] sending https://cognito-identity.us-west-2.amazonaws.com requestheaders: {'content-type': 'application/x-amz-json-1.1', 'X-Amz-Target': 'AWSCognitoIdentityService.GetCredentialsForIdentity'}sending https://cognito-identity.us-west-2.amazonaws.com request with {'IdentityId': 'us-west-2:b1c78aed-d3a1-4cd2-aa5d-723142615afd', 'Logins': {'cognito-identity.amazonaws.com': '***'}}
2022-12-18 20:18:02.896 DEBUG (MainThread) [hatch_rest_api.util_http] response headers:<CIMultiDict('Date': 'Sun, 18 Dec 2022 20:18:02 GMT', 'Content-Type': 'application/x-amz-json-1.1', 'Content-Length': '1404', 'Connection': 'keep-alive', 'x-amzn-RequestId': '55c53ce6-5615-4ebb-832c-e36beb482cce', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains')>
2022-12-18 20:18:02.896 DEBUG (MainThread) [hatch_rest_api.util_http] response raw: {"Credentials":{"AccessKeyId":"***","Expiration":1.671398282E9,"SecretKey":"***"}
2022-12-18 20:18:03.378 ERROR (MainThread) [hatch_rest_api.util_bootstrap] MQTT connection failed with exception AWS_ERROR_MQTT_UNEXPECTED_HANGUP: The connection was closed unexpectedly.
2022-12-18 20:18:03.380 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ***@gmail.com for ha_hatch
File "/config/custom_components/ha_hatch/__init__.py", line 135, in async_setup_entry
File "/config/custom_components/ha_hatch/__init__.py", line 111, in setup_connection
File "/usr/local/lib/python3.10/site-packages/hatch_rest_api/util_bootstrap.py", line 64, in get_rest_devices
File "/usr/local/lib/python3.10/site-packages/hatch_rest_api/util_bootstrap.py", line 60, in get_rest_devices
Thinking it may be related to my nginx reverse proxy. digging more into that now.
My config:
location / {
proxy_pass http://##.##.##.##:8123;
add_header X-Frame-Options "SAMEORIGIN";
proxy_redirect http:// https://;
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /api/websocket {
proxy_pass http://##.##.##.##:8123/api/websocket;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
I've also tried replacing
proxy_set_header Connection $connection_upgrade;
with
proxy_set_header Connection "upgrade";
New logs confirm this is a firewall issue, duplicate of #10
@dahlb I'm not sure how my firewall would be blocking anything. I am running google fiber through a Ubiquiti UDM-SE. Doesn't look like #10 has any resolution either. I don't have any unusual firewall rules, are there ports that need to be opened?
Error setting up entry for ha_hatch. Device is a Hatch Rest (1st gen).
2022-12-18 16:54:05.353 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration ha_hatch which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2022-12-18 16:54:46.571 DEBUG (MainThread) [custom_components.ha_hatch] async setup 2022-12-18 16:54:46.574 DEBUG (MainThread) [custom_components.ha_hatch] async setup entry: {'email': '@gmail.com', 'password': ''}:{} 2022-12-18 16:54:46.952 DEBUG (MainThread) [custom_components.ha_hatch] updating credentials: initial setup 2022-12-18 16:54:48.217 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry ****@gmail.com for ha_hatch File "/config/custom_components/ha_hatch/init.py", line 135, in async_setup_entry File "/config/custom_components/ha_hatch/init.py", line 111, in setup_connection