Traeger WiFire Unofficial API Help Needed!

Hi there!

Out of the desire to tinker, the sickness of cramming everything I possibly can into Home Assistant, and my love for cooking I decided to try to reverse engineer the Traeger WiFire API after getting the inspiration from this reddit post. I am not an expert at this, and have never done this before therefore I am looking for help as this unofficial API is far from done.

Here is what I have accomplished thus far. After doing some noodling with Charles to see what the iOS traeger app sends out in requests I was able to sniff out the following API endpoints:

  • https://1ywgyc65d1.execute-api.us-west-2.amazonaws.com/prod/mqtt-connections
    • This endpoint is responsible for establishing the token. Using Insomnia (similar to Postman) I was able to make a POST request to this endpoint with the following headers, while copying the Authorization token from my app. Keep in mind the response mentioned that the token will expire, and it does. I tried to require the Token using AWS documentation for Signature Version 4, but only made it past Task 1, and not sure it is right

Request Headers:

POST /prod/mqtt-connections HTTP/1.1

Host: 1ywgyc65d1.execute-api.us-west-2.amazonaws.com

Content-Type: application/json

Content-Length: 0

Connection: keep-alive

Accept: */*

User-Agent: Traeger/2 CFNetwork/1125.2 Darwin/19.4.0

Authorization: eyJraWQiOiI2Y0dhUVRibHhBVzc2NCtQT2pWUGxmbjJqREtyNkc2R2hMZkc3dGhOUTVNPSIsImFsZyI6IlJTMjU2In0.eyJzdWIiOiJiOGE2MThhNC1hNTQ4LTQ4MTgtYTFjOC05ZjcwZjM0ODQ0M2IiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiY3VzdG9tOnYyX3VzZXJfaWQiOiJlMDIyYzY2Zi0wNzFlLTQ5OWMtYjg1ZS02Zjc2ZjJkNmZiZGQiLCJpc3MiOiJodHRwczpcL1wvY29nbml0by1pZHAudXMtd2VzdC0yLmFtYXpvbmF3cy5jb21cL3VzLXdlc3QtMl8xRkMzYUp1QzMiLCJjb2duaXRvOnVzZXJuYW1lIjoibWlndWVsQG1pZ3VlbGFyaW9zLmNvbSIsImdpdmVuX25hbWUiOiJNaWd1ZWwiLCJhdWQiOiIyZnVvaGp0cXYxZTYzZGNrcDV2ODRyYXUwaiIsImV2ZW50X2lkIjoiYWIzZDUxOTctYThmMS00MDU5LTlkMjQtM2JlOGQyNWE1ZDdjIiwiY3VzdG9tOnYyX3VyYmFuX2FpcnNoaXBfaWQiOiJhNzIxMDE5OC02ZjI2LTQ2NjMtODQ0Mi1iMDM3OWU4ZWJhYWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTU4NzQxMTE4OSwiY3VzdG9tOnYyX2N1c3RvbWVyX2lkIjoiYWJ1d1pxVkFQNEZnTXdRZ3NzMDlxbnpHVVgiLCJleHAiOjE1ODk1MDc2MTMsImlhdCI6MTU4OTUwNDAxMywiZmFtaWx5X25hbWUiOiJSaW9zIiwiZW1haWwiOiJtaWd1ZWxAbWlndWVsYXJpb3MuY29tIn0.cfbg4f8PpVCkIN2CUfkGze5ZCAbFc9q4GtBlniC6Wr5EiRYM1fDe9XGfyxoht6DxDo2iDvVGIBHk3peOTn3EGI-o5U2rNnrNnKpsQ9QJw3OpHfMHOHpF8W-xz4E7xktQd8xNaQGquK5ssGGi8O01IbQ1YHIraEOt_K9TDGEsvFuMeD5iSVFJ78cSbaB162js8eqxmJ4-I99fuZ9YEuLqr8fR-yMbtMXWxBYvkGRnMWYePzJltTsomHGq6ILp08Faqg-m6eZJEXeqDmPDvhaJOCpBfNX5CVGAuToYti3KkIobht5nuhVsWv3yU1-RMJNUWwB6v_XCcWZnI47yntGQMg

Accept-Language: en-us

Accept-Encoding: gzip, deflate, br

Empty Request Body

Response Body

{

 "expirationSeconds": 3600,

 "expiresAt": 1589507945,

 "signedUrl": "wss://aqmix2am7g1w-ats.iot.us-west-2.amazonaws.com/mqtt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAYCV2Q4WGIHLZMUVY%2F20200515%2Fus-west-2%2Fiotdevicegateway%2Faws4_request&X-Amz-Date=20200515T005905Z&X-Amz-SignedHeaders=host&X-Amz-Signature=b171c0356e15cdf773c2346bee1fe5ebdfec4e8eef4900926f07659d4531593e&X-Amz-Security-Token=FwoGZXIvYXdzEEoaDNdMzOZvol%2Fr4aahOSLAA1GqpglpkWnZ5EjOOtSm9w%2BCMo9mnU9IbcxN4rriTo%2FiLBFkCrYqHh0ZqXhMX%2BktGwBARVLUauyEhzC2BtoCWm8cq6ViOwtPMHJR0fNyfLWKACKPS1RGdQnQwepKXzapGvYpOPSlsR39rmEOKt3TUqC%2FbKAKFo%2F2lIC0pAOof4n3kOPZMikN%2BcKy0swwDWJkbJQuJcm3%2BwbtCUA37LRERf1E4Z2ViXa%2BY8fpOiT8VnsFlNIjQM%2FGpvyUPzHxSgBUj0DSraOFVVndb0%2F6z%2BqTj9ymaCmsaSjMTSsbOaODoAWOApb0PiErYISxn1KNaohDv6P6Q8VM2wrbPEEl55qoQ72K%2FiUwHP8J7J0uWW6NAlltBhlUhRCOXkOI88z0OXmUXrDdMnEAFBmz6GVXEXTBl0W2Pr%2FkcFRXp2FQpVIVHWKsZiXnCxAjNxeTIfnDzNRjCTaKJarbdn2ULf8B8QgdfXZGLaByv4dYNXTzrz7O%2BMtLwvwu3Ea4N0sHsR%2BrPwbbrmVFObn9mx0lGO7E2cTA%2F0PKHt4ScmpWIMKoYB7Daqr1ooFqSonW9%2FPmx%2BiWr%2Be7nCY6hfDvy08HGRnhaBi9cBYo2dL39QUyLfHtgzkzPOFaGdKiu8sVvuaz8ws46Ebh1Gr7LETdE5enDOnVC19wxcyvtqIyYA%3D%3D"

}

  • i tried making a basic REST binary_sensor, but it didn’t work.

  • i tried using cURL instead of insomnia from HA CLI with the Authorization token but got a response that i was missing a Signature header, and a few other headers. Need to do this cURL command again to figure out what exactly was sent back and update this post.

  • https://1ywgyc65d1.execute-api.us-west-2.amazonaws.com/prod/things/801F12C87E2B/commands

    • If I just copy the authorization token, and I can actually send POST request to this endpoint using Insomnia to control the Traeger app and it works! Still need to figure out more of the commands.
    • Found out the following commands

// This command simply keeps the connection alive, but haven’t tried to make a REST sensor of this.

{

“command”: “90”

}

// This command will change the temperature of the grill to 170 degrees F

{

“command”: “11,170”

}

// This command will shutdown the grill

{

“Command”: “17”

}

// This command set a timer

{

“Command”: “12,00000” // 00000 will be the time in seconds for the timer. When you want to reset the time just send all 0’s.

}

Currently i am unable to READ any of the temperature data from the grill which sucks, and I desperately need help with this. I tried to use wireshark to get the traffic going from my grill out to the internet, but was unsuccessful mostly because I am not experienced with using wireshark, so if someone can help me with this that would be great! To me reading the temperature is probably the most important part of this exercise.

1 Like

I’m not sure if it helps, but I found this article on the recent changes to AWS:

Perhaps there is some generic API that they’re now using?

Thanks! Through my reverse engineering i was able to find the endpoints and indeed they use AWS IoT platform. However, the difficult for me has been the authentication. I think they are using Signature Version 4 from AWS which is a complex, for me at least, algorithm to generate a token and it requires a secrete token which I can’t find out which one it is.

https://docs.aws.amazon.com/iot/latest/apireference/CommonParameters.html

I wish I knew enough to be able to help you because this has been one of my biggest things I’ve wanted for a long time. I’ve even called in to Traeger a couple of times to try and find someone on their team that would be willing to work with people from this group. :frowning:

Yea same here. I wanted to be able to read the temp of the grill AND the meat probe, not just control it. I still have plans to use wireshark to see if there is a way to read the temp data straight from the traeger as I am assuming that the reason why I can’t see any traffic coming to and from the ios app for temp is because the grill itself is sending that data to the cloud, and the app is just in charge of displaying that information so i am guessing the way it is showing up in the app is via some other method that I can’t see or I am missing something. Controlling the grill is what I did figure out, just didn’t figure out how to keep the connection alive, even after extracting the token. I may try again in the future. However, reading the temp data is far more important to me than controlling the grill. I would rather be able to do automations based on the temp than control the grill given that I can always log into the app and control the grill. I know i can read the temp data from the grill but to me i would like to have a more contextual automation through home assistant of when my steak has reached temp as I can mute the TV, send a TTS via Alexa, and flicker lights. Controlling the grill is not as good to me if I am blind to knowing what the temp is.

Another approach I am thinking entirely separate is just taking an ESP32 or Pi zero and building a meat and grill probe thermometer to accomplish the same thing and it would be better as it would be a device that can be paired with any type of grill. There are already a lot of those projects on instructables and similar sites that do this, but I’d rather build my own to learn and adapt it to my needs, and maybe I can publish it if I am offering something unique compared to what is out there. If i do this I will come back to this thread and publish what I do.

If you decide to go down the DIY route, please let me know. I’m currently looking at making an ESP32-based board that does this. I read somewhere that the WiFIRE controller is based on an ESP8266, though I haven’t been able to confirm it. As such, an ESP32 DIY option should work a treat.

Since (like you) I have an insatiable desire to “Home Assistant All The Things!”, I’m actually looking at using ESPHome as the backend for this project. Using a “Native API Custom Component”, it should allow for custom on/off switches, grill/meat set points, and temp probe measures. In theory, you could also program in auto-restart capability. And you could have front-panel controls with a display by using the built-in display and pin components.

If you can go without the local control, ESPHome basically does all the interface heavy lifting for you, though I’m definitely going to make a custom Lovelace card for the grill when I get it done.

In my opinion, the hardest part of the DIY route is tuning the PID controller, though values can definitely be stolen from other similar projects.

Hmm can we talk more about this? Not sure I follow how it would work. I’m in discord we can chat.

I got some work done on this a while ago and stalled out so its very rough around the edges but I’m pretty sure it might unblock someone. It broke after running for a while and I didn’t have time to investigate… enjoy :slight_smile:

It is only a thin library and a tool to push the data to graphite but can be made into a home assistant integration.

1 Like

Need to read this some more! Currently I put this project on hold given I had other homelab todo items in front of my “backlog” of stuff. But will come back and update on this thread.

So reading this back are you still working on this? Let me know if you want to pair up. I think you are building a controller to replace what is inside the traeger?

Read your repo thanks! I was only ever able to read the endpoints to send control commands using the AWS IoT but keeping the auth connection alive was the biggest hurdle. I don’t know if that is what happened to you and why it stopped working. I see you have some refresh token function available not sure if it worked well for you.

I got distracted by some other projects, so I haven’t done much with the Traeger recently.

You’re correct, my goal is to replace the controller inside the Traeger. I have a Tailgater, and in my opinion, the Traeger controller is pretty terrible. It can’t keep the temperature well regulated to save its life, and it regularly gets to a “Too Low” temperature state when it’s cold outside. The fact that I can cook with it at all is pretty amazing.

In a perfect world, I’d be looking at a controller like the Smoke Daddy PID controller: https://smokedaddyinc.com/product/pellet-pro-exclusive-pid-controller-pellet-grill-upgrade/

The advantage of a controller like that is that you get a proper interface control for the front of the grill. You could probably DIY a panel if you wanted controls in front of the grill. I’d use a continuous rotary encoder as my temperature setter, and probably three momentary buttons: On/Off, Temp Select, and Set. I’m currently not going down this path, and will use Home Assistant as my interface.

(However, as a side note, I realized from experience last night that this may not be the best approach. Power went out about 2 hours into a 6 hour smoke. I was able to use a portable generator to keep the Traeger going, but it would have been beyond inconvenient to try and run my hypervisor and all my network infrastructure from the same generator.)

When I sit down to start working this project, I’m torn between three approaches: directly coding the new controller on as ESP32, using ESPHome, or using a Raspberry Pi. I know very little C/C++, so coding it directly on the ESP32 would require some learning. Using ESPHome is probably the easiest, but I’m hesitant to depend on ESPHome given how complex it is (I also hate having that as a dependency if something ever happens to that project). A Raspberry Pi is the most straightforward: I could program the controller in Python, and I’d have the full power of Linux to do all my troubleshooting.

Well this is awesome! I didn’t know it was a thing to replace your grill controller. Feels like this is almost going into the idea of just building your own grill. Isn’t a pellet grill just like the grill, the auger, the induction fan, the hopper, and the fire pot? Feels like you can almost make one probably still really hard to do but seems like it is component based.

In all projects I get torn on which platform to use. I personally would go with Arduino / C++ because it feels more appropriate than using Linux entirely. I still don’t fully understand ESPHome since even though it tries to abstract programming using YAML is a way it makes me confused because I’m use to functions and how code gets executed. I’m very inadequate when it comes to C++ and Python or any language but I prefer using languages than easier abstracted platforms because they are reusable.

I would love to help figure out this project with y’all - I have the new D2 and the older versions as well.

Looks like the traeger.py script that @Nick2253 made is working for me to at least get my basic grill status! Ill see about getting temperature control and whatnots going shortly.

Digging further into what we’ll need to implement on the HA side, it seems like there’s a proposal for a cooker entity It doesn’t seem to have much traction at the moment, but i bet we could start implementing parts of the proposal and get some custom components going for eventually merging into HA

Edit: Looks like it’s not very obvious how the control side works yet.

Edit 2: Using the work that @HA_fanatic did early on, i’ve now managed to send the commands with the generated token from the auth flow. i’ll start cleaning this up and will post the code for that soon.

Edit 3: I’ve forked the initial repo and started work on a library we can use for HA https://github.com/sebirdman/traeger

Hacking together that traeger python library along with a WaterHeaterEntity i’ve managed to get basic temperature controls in home assistant

most likely will need to do some work to make it actually nice and performant including:

  1. how do we handle timers?
  2. how do we handle the device only being able to be turned off remotely and not on?

I’ve pushed some changes to the component lib to improve this while working on my christmas brisket :smiley:

It’s now got support for the probe and some of the other temperature sensors. You can see when I opened the grill to look at it.

4 Likes

Just wanted to say this looks awesome. Can’t wait to try this out over the weekend. Thanks for all your work on this, thought I was the only one cooking a Christmas brisket!

1 Like

Installed and working! Really great work! You should make a merge request to have this added to core.

Dude! Not sure how I didn’t long back into this. This is amazing. Glad I helped in a tiny bit with what I discovered. Let me check out your code to see how you did it!