I’ve written a very basic device handler to pull Whistle presence and battery info from Whistle directly into ST, every minute. Due to my very limited programming skills, you need to do a bit of leg work to get a few ID values for the initial setup, explained below. If anyone wants to take this code and run with it, feel free, I will in no way be offended. This hasn’t been extensively tested, but that’s what the community is for.
NOTE: Whistle does not have a supported API. This may break at any time.
Download and install, and publish the device handler in the IDE.
From My Devices in the IDE, create a New Device. You will need to give the device a Name (e.g. Your Pet), pick an arbitrary hex number (e.g. 0101EE) for the Device Network ID, and set the Device Type to “Whistle Presence.”
Go into your ST app and open your new “Your Pet” device. Click the gear, enter your Whistle email and password, and you will see the two values we need to extract from your Whistle account. You can also upload a picture of Fido here if you like.
Whistle Home ID - This is a number that identifies the “Safe Zone” of your house, and where you want the pet to be marked Present by ST.
Whistle Pet ID - This is a number that identifies your pet in your Whistle account.
So how do we get this information? We need to make requests to the Whistle server and view the results.
Downloand Postman for your desktop computer at: https://www.getpostman.com/downloads/
This software enables you to make customized HTTP requests and view the results.
First we need to get an access token. We are going to do this by making a HTTP POST request to Whistle with some specific headers, and your Whistle email and password.
First, under the Headers tab, populate the code values below as seen in the following screenshot:
“Accept-Encoding”: “br, gzip, deflate”,
“User-Agent”: “Winston/2.5.3 (iPhone; iOS 12.0.1; Build:1276; Scale/2.0)”
Next, under the Body tap, enter your Whistle email and password as form data as seen in the image below:
Click Send. If done correctly the server will reply with an auth token for your account:
Copy the long auth token (the refresh one is not needed). We are going to use this to make another request to Whistle.
Now we need to get the Whistle IDs for the pet you want to track and home location you want them to be marked present at… First, de-select the email and password body. We don’t need this anymore now that we have an auth token. Go to the Authorization tab, select Bearer Token, and paste your token in.
Here we get the pet ID. Send an HTTP GET (you must change this from POST) to the address shown in the photo below. If done correctly you should get a listing of pets in the response window. Find and copy the “id:” number for the pet you want to link to the ST device. Paste this number into the device preferences in the app or IDE as described above.
Next let’s get the home ID of the Whistle “Safe Place” you want to be considered home for the pet. We need to do this since you can have multiple safe places and we only want to mark the pet present at your actual home. Update the request address to the one below in the photo. You’ll see a list of locations and “id:” number for the location. Find your home, copy the number and paste this number into the device preferences in the app or IDE as described above.
That’s it. You’re done! Enjoy.