PitDroid: An Android app for your HeaterMeter

I dunno, I'm pretty sure I was on the current firmware, but just to be safe I flashed mine to v13 (from Feb 2016) and I can still auth fine. Are you on the release version or the beta of PitDroid?
I am running the release version of PitDroid (from the google play store). I am also running the snapshot firmware on the HM. Tried again last night and same issue.
Tried it with the beta and still no joy. Running Samsung S7 Edge. Tried uninstalling then reinstall, no dice. Cleared cache and data, nope. I didn't have this problem in my 4.2 version, so I think it must have something to do with the snapshot firmware. Just a guess.
It comes down to the login not working properly with the new luci backend. Previously you could just send the username and password at any time and login AND complete the requested action (change setpoint). However, now it will only complete the login OR perform the action. There's a new REST API in the snapshot, but I'm looking into maybe doing a hack for just this release only to allow the old method to work. I actually spent all of yesterday working on this and finding other bugs which then needed to be fixed along the way.

The good news is that I can fix it but the bad news is that linkmeter it is going to require any changes be sent as a POST request instead of a GET. This is backward compatible on previous releases of linkmeter, but you'll have to change your code. I can make any needed changes and submit a pull request if you like.
This code works on both v13 release and snapshot firmwares. It does not implement the new API-based authentication so it will be broken by future future (sic) releases, but this will keep it working in the mean time and doesn't require any significant refactoring.

-- Always use POST on set command
-- Do not require stok, only sysauth is needed
-- Do not follow the 302 redirect on login (snapshot), the cookie is only set by the first HTTP response so it needs to be pulled from there. In v13 release the response is 200 with the requested page, snapshot responds with 302 and the cookie, pointing you to the requested page.
-- Do not use chunked transfer encoding. Theoretically, you could use setFixedLengthStreamingMode() with the length of the POST body for authentication but we're only forcing Android to buffer like 30 bytes so I feel like that's not a big deal.

diff --git a/app/src/main/java/com/bonstead/pitdroid/HeaterMeter.java b/app/src/main/java/com/bonstead/pitdroid/HeaterMeter.java
index 5ee37e2..bb5172b 100644
--- a/app/src/main/java/com/bonstead/pitdroid/HeaterMeter.java
+++ b/app/src/main/java/com/bonstead/pitdroid/HeaterMeter.java
@@ -718,8 +718,9 @@ public class HeaterMeter
                if (!isAuthenticated())

-               String setAddr = mServerAddress[mCurrentServer] + "/luci/;stok=" + mAuthToken + "/admin/lm/set?";
-               setAddr += "sp=" + newTemp;
+               String setAddr = mServerAddress[mCurrentServer] + "/luci";
+               if (mAuthToken != null) setAddr += "/;stok=" + mAuthToken;
+               setAddr += "/admin/lm/set?sp=" + newTemp;

                HttpURLConnection urlConnection = null;

@@ -728,7 +729,7 @@ public class HeaterMeter
                        URL url = new URL(setAddr);
                        urlConnection = (HttpURLConnection) url.openConnection();
-                       urlConnection.setChunkedStreamingMode(0);
+                       urlConnection.setRequestMethod("POST");
                        urlConnection.setRequestProperty("Cookie", "sysauth=" + mAuthCookie);

@@ -753,7 +754,7 @@ public class HeaterMeter

        private boolean isAuthenticated()
-               return mAuthCookie != null && mAuthToken != null;
+               return mAuthCookie != null;

        private void authenticate()
@@ -770,10 +771,10 @@ public class HeaterMeter
                        URL url = new URL(mServerAddress[mCurrentServer] + kAuthURL);
                        urlConnection = (HttpURLConnection) url.openConnection();
-                       urlConnection.setChunkedStreamingMode(0);

+                       urlConnection.setInstanceFollowRedirects(false);

                        DataOutputStream out = new DataOutputStream(urlConnection.getOutputStream());
Sorry, I missed the forum notification for this since I didn't login after a previous response. Thanks for the patch Bryan, I'll get it integrated in.
I'm having some problems with my Heatermeter (it hasn't been the same since it got doused by rain), so I'm having to roll this out blind. I integrated Bryan's changes and created a new build, so please give it a try and let me know if it works. This is only in the beta channel.
Oh, and I noticed people submitted some crashes, thank you for doing that. When you do though, please add a description of what you were doing, so it's easier for me to dupe the crash. Sometimes I can figure it out from the callstack, but more info always helps.
I didn't actually make the iOS app, that's a totally separate thing. You'll have to ask the guy that made it, but I don't think it's updated anymore.
Ok, I got my HeaterMeter working again and flashed the snapshot and it looks like the auth is working again, thanks Bryan. And Jesse, guy who gave me a 1 star review on the Play Store for the auth not working, it's time to update that review!
Haha...will do!:)

Edit: In case anyone else is looking for the update I had to join the beta to find it. Thanks for the quick fix Colin!
Last edited:
Expand the notification in the notification center and tap the "X". Also, you can turn off all alarms in the "Dash" and then force close it.
If you have the 'alarm on lost connection' set and a pit temp alarm or meat alarm set, you can't close the app when there is a lost connection. eg open the app when you have your heatermeter unplugged, and you can't close the app. The close button in the notification area just keeps reopening the app.

This won't be a problem when I am actually using the heatermeter, just a problem when I was re-setting up the app when I switched phones.
I finally got around to adding a popup for tweaking/confirming changes to the set temp, and pushed out version 2.0 to everyone, not just beta testers. If you opted into the beta you can opt out now if you want (although it's currently the same thing as the release).
I had the beta and uninstalled it to get back to the original in order to be able to turn off PitDroid. Today Google pushed the new releases - same as beta, no way to shut off. Please restore this functionality.
Hmm, dunno, works for me. If I have an alarm set there's a close button beneath the status notification, and if I press it I get a dialog asking if I want to exit even though alarms are set. If I pick yes, it closes the status notification. The app is still open, but if I navigate away the notification doesn't come back. What version of Android are you on?