People talk about the covid weight gain, I fear that mine has been well before covid even started. So to keep an eye on my weight, we had purchased a Withings (now Nokia) weight scale and in all good things it connects to the internet.

With the dashboard setup and me used to keeping an eye on it daily. I got the bright idea of why not set up the code in such a way, that whenever I step onto the weight machine it logs my weight on the dashboard and tells me if I gained or lost any weight.

First things first, needed to make sure that the weighting machine can sync with my ecosystem, which it did not so that was not a good thing. Did a second check with IFTTT and it was there.. So came up with the following flow:

  • Get weight machine to sync with IFTTT
  • Make IFTTT send a REST call to my dashboard with the weight
  • Make the dashboard remember my last weight, compare it with the new weight and then show the weight and change in either Red for gain or Green for loss

Connecting the weighting machine to IFTTT was easy, now for the tricky part to get IFTTT to send a REST call everytime I weighted in.

Now that that was setup, wrote up the following code which would read the incoming value from IFTTT and then compare it with my previously logged weight. Do the different and if it is greater than 0, i.e. I have put on weight show it in red else show it in green. For an extra degree of shame if I have increased my weight then the lights would flash three times.

Good thing I don’t have a speaker setup in the en suite such that I yells “SHAME! SHAME!” every time my weight increased.

Image result for GOT shame
Ref: https://www.pinterest.ca/pin/6473993192654292/