Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Sign In - Timeout Error and Invalid Authentication #35

Open
chriseivert opened this issue Mar 8, 2022 · 8 comments
Open

Cannot Sign In - Timeout Error and Invalid Authentication #35

chriseivert opened this issue Mar 8, 2022 · 8 comments

Comments

@chriseivert
Copy link

chriseivert commented Mar 8, 2022

Hey guys! Super excited to use this integration but it seems like it's not working for me. I got it to add to the integrations table, but when I go to add my credentials and click submit, it returns invalid, but I can sign in on both the traeger app as well as the account page on the desktop so that's odd. It also throws a Timeout error talking to cognito, and that NoneType Object error as well, as related to #20. My logs are here:

2022-03-08 11:41:25 ERROR (MainThread) [custom_components.traeger] Timeout error fetching information from https://cognito-idp.us-west-2.amazonaws.com/ -
2022-03-08 11:41:25 ERROR (MainThread) [custom_components.traeger] Failed to login 'NoneType' object is not subscriptable

[{"name":"custom_components.traeger","message":["Failed to login 'NoneType' object is not subscriptable"],"level":"ERROR","source":["custom_components/traeger/config_flow.py",83],"timestamp":1646768485.4657848,"exception":"","count":1,"first_occurred":1646768485.4657848},{"name":"custom_components.traeger","message":["Timeout error fetching information from https://cognito-idp.us-west-2.amazonaws.com/ - "],"level":"ERROR","source":["custom_components/traeger/traeger.py",334],"timestamp":1646768485.4652963,"exception":"","count":1,"first_occurred":1646768485.4652963},{"name":"homeassistant","message":["Error doing job: Unclosed client session"],"level":"ERROR","source":

It seems like there's an unclosed client? Strange because it's the only one there.

Besides that, I'm running, 0.0.7 for Traeger Integration, added through HACS.

HACS 1.2.0, core-2022.3.3 and OS 7.4 for Host Operating system.

@chriseivert chriseivert changed the title Timeout Error and invalid Authentication Timeout Error and Invalid Authentication Mar 8, 2022
@chriseivert
Copy link
Author

Update; the integration somehow works. It kept on saying invalid authentication for the first couple of days but I just tried it and it seem to login so I will close this for now and in the event it does do the invalid authentication again I will re-open the issue.

@chriseivert chriseivert reopened this Mar 30, 2022
@chriseivert
Copy link
Author

This is happening again with the same logs as last time. I verified I can log in with the app, and I changed my password for good measure, according to the fix listed here: #36. Still nothing. I'm going to dig into the code tonight and see if I can get some answers. Any help would be appreciated!

@chriseivert chriseivert changed the title Timeout Error and Invalid Authentication Cannot Sign In - Timeout Error and Invalid Authentication Mar 30, 2022
@chriseivert
Copy link
Author

@sebirdman @njobrien1006 any ideas by chance?

@njobrien1006
Copy link
Contributor

Given some of the timeouts that have been seen previously, what continent are you on?

Failed to login seems to be from config_flow.py line 84.
Said code is using self.hass not to be confused with traeger.hass (self.hass).

There are some differences in init.py where it uses:

session = async_get_clientsession(hass)
client = traeger(username, password, hass, session)

Where hass has been defined by:

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

I still don't understand where self.hass is defined (or coming from) within config_flow.py.

Based on the limited logging provided, I'd guess you don't have the logging enabled for the custom component. Add this to your configuration.yaml if you haven't already and see if it says anything else and provide.

logger:
logs: #debug/info/warning/error/critical
custom_components.traeger: debug

@chriseivert
Copy link
Author

chriseivert commented Apr 1, 2022

Given some of the timeouts that have been seen previously, what continent are you on?

USA Texas so AWS West should be fine to contact.

Failed to login seems to be from config_flow.py line 84. Said code is using self.hass not to be confused with traeger.hass (self.hass).

There are some differences in init.py where it uses:

session = async_get_clientsession(hass)
client = traeger(username, password, hass, session)

Where hass has been defined by:

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

I still don't understand where self.hass is defined (or coming from) within config_flow.py.

I was looking at that as well and saw no link from self.hass anywhere else. The odd thing is it worked before and I got one cook in just fine and all the data was mapped out.

Based on the limited logging provided, I'd guess you don't have the logging enabled for the custom component. Add this to your configuration.yaml if you haven't already and see if it says anything else and provide.

logger:
logs: #debug/info/warning/error/critical
custom_components.traeger: debug

Already done my guy. That's all the logs that are available. I'll do a restart right now and upload the logs in a sec. Edited for clarity

@chriseivert
Copy link
Author

chriseivert commented Apr 1, 2022

And like a charm, it works just fine. The inconsistency is so weird! It times out at some points, returns NoneType at others, (typically together though), and fails to contact AWS west. Its so odd. I'll throw a couple of restarts at it and see what comes out the other side. Maybe uninstall and reinstall to get it to fail again, but on the other hand, it works lol. Maybe I should just let it be. It's a poor excuse and realistically I shouldn't want to, I just don't wanna lose it ya know?

@njobrien1006
Copy link
Contributor

njobrien1006 commented Apr 1, 2022

USA Texas so AWS West should be fine to contact.

All Auth comes from West-2. So yes.

I just don't wanna lose it ya know?

O I get it.

Already done my guy. That's all the logs that are available.

Yeah, I see there isn't any logging triggered from the config_flow.

Couple additional (far-fetched) questions:

  • Any non-typical firewall?
  • Any other HA isolation from the www?
  • Any Ad-Blocker?
  • Is datetime.datetime.utcnow() returning the correct time?

Maybe add this to Cognito to see if it is all populated:
_LOGGER.info(f"do_cognito t:{t}")
_LOGGER.info(f"do_cognito amzdate:{amzdate}")
_LOGGER.info(f"do_cognito self.password:{self.password}")
_LOGGER.info(f"do_cognito self.username:{self.username}")
_LOGGER.info(f"do_cognito CLIENT_ID:{CLIENT_ID}")

@njobrien1006
Copy link
Contributor

For reference this is what to expect in the logs on initial adding of integration:

2022-04-01 13:34:55 INFO (MainThread) [custom_components.traeger] do_cognito t:2022-04-01 18:34:55.914404
2022-04-01 13:34:55 INFO (MainThread) [custom_components.traeger] do_cognito amzdate:20220401T183455Z
2022-04-01 13:34:55 INFO (MainThread) [custom_components.traeger] do_cognito self.username:myemail@myemail.com
2022-04-01 13:34:55 INFO (MainThread) [custom_components.traeger] do_cognito CLIENT_ID:2fuohjtqv1e63dckp5v84rau0j

And then after it succesfully adds:

2022-04-01 13:34:59 INFO (MainThread) [custom_components.traeger]
2022-04-01 13:34:59 INFO (MainThread) [custom_components.traeger] do_cognito t:2022-04-01 18:34:59.210246
2022-04-01 13:34:59 INFO (MainThread) [custom_components.traeger] do_cognito amzdate:20220401T183459Z
2022-04-01 13:34:59 INFO (MainThread) [custom_components.traeger] do_cognito self.username:myemail@myemail.com
2022-04-01 13:34:59 INFO (MainThread) [custom_components.traeger] do_cognito CLIENT_ID:2fuohjtqv1e63dckp5v84rau0j
2022-04-01 13:35:00 INFO (MainThread) [custom_components.traeger] Call_Later in: 30 seconds.
2022-04-01 13:35:30 DEBUG (MainThread) [custom_components.traeger] @Call_Later SyncMain CreatingTask for async Main.
2022-04-01 13:35:30 DEBUG (MainThread) [custom_components.traeger] Current Main Loop Time: 1648838130.0998466
2022-04-01 13:35:30 DEBUG (MainThread) [custom_components.traeger] MQTT Logger Token Time Remaining:3569.1102678775787 MQTT Time Remaining:-30.889804363250732
2022-04-01 13:35:30 DEBUG (MainThread) [custom_components.traeger] MQTT URL:wss://aqmix2am7g1w-ats.iot.us-west-2.amazonaws.com/mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aaaabbbbccccdddddFus-west-2**ReallyLongHash Expires @:1648841799.1001499
2022-04-01 13:35:30 INFO (MainThread) [custom_components.traeger] Thread Active Count:13
2022-04-01 13:35:31 DEBUG (MainThread) [custom_components.traeger] Sending CONNECT (u0, p0, wr0, wq0, wf0, c1, k987) client_id=b''
2022-04-01 13:35:31 DEBUG (Thread-4) [custom_components.traeger] Start MQTT Loop Forever
2022-04-01 13:35:31 DEBUG (MainThread) [custom_components.traeger] Call_Later @: 1648841730.1001499
2022-04-01 13:35:31 DEBUG (Thread-4) [custom_components.traeger] Received CONNACK (0, 0)
2022-04-01 13:35:31 INFO (Thread-4) [custom_components.traeger] Grill Connected
2022-04-01 13:35:31 DEBUG (Thread-4) [custom_components.traeger] Sending SUBSCRIBE (d0, m1) [(b'prod/thing/update/123abcdefg', 1)]
2022-04-01 13:35:31 DEBUG (Thread-4) [custom_components.traeger] Received SUBACK
2022-04-01 13:35:31 DEBUG (MainThread) [custom_components.traeger] Send Command Topic: 123abcdefg, Send Command: 90
2022-04-01 13:35:31 DEBUG (Thread-4) [custom_components.traeger] Received PUBLISH (d0, q0, r0, m0), 'prod/thing/update/123abcdefg', ... (2121 bytes)
2022-04-01 13:35:31 DEBUG (Thread-4) [custom_components.traeger] grill_message: message.topic = prod/thing/update/123abcdefg, message.payload = b'{"thingName":"123abcdefg","jobs":[{"jobId":"Link_Combined_TimberlineXYZ","thingName":"123abcdefg","currentStatus":{"status":"SUCCEEDED","timestamp":1648510663},"isFinished":true,"isInProgress":false}],"status":{"ambient":61,"connected":true,"cook_id":"","cook_timer_complete":0,"cook_timer_end":0,"cook_timer_start":0,"current_cycle":0,"current_step":0,"errors":0,"grill":39,"in_custom":0,"keepwarm":0,"pellet_level":40,"probe":0,"probe_alarm_fired":0,"probe_con":0,"probe_set":0,"real_time":0,"server_status":0,"set":165,"smoke":0,"sys_timer_complete":1,"sys_timer_end":0,"sys_timer_start":0,"system_status":2,"time":1648838048,"units":1,"acc":[{"uuid":"p0","channel":"p0","type":"probe","con":0,"probe":{"get_temp":0,"set_temp":0,"alarm_fired":0}}]},"features":{"cold_smoke_enabled":0,"grill_mode_enabled":0,"open_loop_mode_enabled":0,"pellet_sensor_connected":1,"pellet_sensor_enabled":1,"super_smoke_enabled":1,"time":1648793056},"limits":{"max_grill_temp":500},"settings":{"config_version":"08.005","device_type_id":2108,"feature":0,"fw_build_num":"20220223.142429","fw_version":"T2.01.02","language":0,"rssi":-55,"speaker":1,"ssid":"Guest","time":1648793056,"units":1},"usage":{},"custom_cook":{"cook_cycles":[{"cycle_name":"Chicken Challenge","populated":1,"num_steps":1,"units":1,"slot_num":0,"steps":[{"probe_set_temp":170,"time_set":0,"keepwarm":0,"smoke":0,"step_num":1,"set_temp":425,"use_timer":0}]},{"cycle_name":"Beginner's Brisket","populated":1,"num_steps":2,"units":1,"slot_num":1,"steps":[{"probe_set_temp":0,"time_set":12600,"keepwarm":0,"smoke":1,"step_num":1,"set_temp":165,"use_timer":1},{"probe_set_temp":190,"time_set":0,"keepwarm":0,"smoke":0,"step_num":2,"set_temp":225,"use_timer":0}]},{"slot_num":2,"populated":0},{"slot_num":3,"populated":0},{"slot_num":4,"populated":0}]},"details":{"thingName":"123abcdefg","userId":"uuid","lastConnectedOn":1648793055,"thingNameLower":"123abcdefg","friendlyName":"@MyTraeger","lat":0.00,"long":-0.00,"deviceType":"2108"},"stateIndex":45894,"schemaVersion":"1.0"}'

tmack8001 pushed a commit to tmack8001/hass_traeger that referenced this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants