Beat The Meat

For the thermometer build here [1], I had the urge to create an app which is actually downloading the temperatures in a regular basis, notifying me when a specific temperature was reached or the temperature left a defined range. This app is only implemented for Android as I'm not using any iOS or Windows Phone. But based on the descriptions here, you may re-implement the app for your device class.

Thermometer Settings

Let's talk about the most important Thermometer settings. There is the Thermometer web service which has to be configured as well as the Thermometer Settings web service.

Thermometer web service

As described in [1], the thermometer is nothing else than a REST server which is providing the current temperatures of all thermometers in JSON format. Therefor the user is asked to enter a Thermometer web service URL and if applicable also an alternative URL.

The alternative URL was introduced as there might be an issue if you switch from your local LAN to WAN, for example when you leave your house to run some errands. As going with the LAN IP to your Arduino will not work you have to use your public IP which is pathing you through to your Arduino, but with some routers (like a Fritzbox) you can't use your public IP when you're in the local LAN. So either, you have to switch of your WiFi and go all over public IP or use the alternative approach. The app is going to try all available connections until one succeds, if all fail it will give you a notification.

  • In my case the web service url points directly to my Arduino (IP: 10.0.0.22)
  • The alternative web service url points to my public IP address
  • My router forwards all public requests coming to a specific port to my Arduino

Thermometer Settings web service

The Thermometer Settings web service is providing a predefined set of thermometer settings like target temperatures and ranges. The app calls this service at boot stage and will hold these information until termination.

It is a REST service which returns a JSON with following schema:

    
{
  "$id": "http://example.com/example.json",
  "type": "object",
  "definitions": {},
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "catalogs": {
      "$id": "/properties/catalogs",
      "type": "array",
      "items": {
        "$id": "/properties/catalogs/items",
        "type": "object",
        "properties": {
          "name": {
            "$id": "/properties/catalogs/items/properties/name",
            "type": "string",
            "title": "Name of the Catalog",
            "default": "",
            "examples": [
              "Custom"
            ]
          },
          "categories": {
            "$id": "/properties/catalogs/items/properties/categories",
            "type": "array",
            "items": {
              "$id": "/properties/catalogs/items/properties/categories/items",
              "type": "object",
              "properties": {
                "name": {
                  "$id": "/properties/catalogs/items/properties/categories/items/properties/name",
                  "type": "string",
                  "title": "Name of the Category",
                  "default": "",
                  "examples": [
                    "Smoker"
                  ]
                },
                "styles": {
                  "$id": "/properties/catalogs/items/properties/categories/items/properties/styles",
                  "type": "array",
                  "items": {
                    "$id": "/properties/catalogs/items/properties/categories/items/properties/styles/items",
                    "type": "object",
                    "properties": {
                      "name": {
                        "$id": "/properties/catalogs/items/properties/categories/items/properties/styles/items/properties/name",
                        "type": "string",
                        "title": "Name of the Style",
                        "default": "",
                        "examples": [
                          "Smoking"
                        ]
                      },
                      "temperatureMin": {
                        "$id": "/properties/catalogs/items/properties/categories/items/properties/styles/items/properties/temperatureMin",
                        "type": "integer",
                        "title": "Minimal Temperature (if range == false -> this is the target temperature)",
                        "default": 0,
                        "examples": [
                          60
                        ]
                      },
                      "temperatureMax": {
                        "$id": "/properties/catalogs/items/properties/categories/items/properties/styles/items/properties/temperatureMax",
                        "type": "integer",
                        "title": "Maximal Temperature",
                        "default": 0,
                        "examples": [
                          90
                        ]
                      },
                      "temperatureIsRange": {
                        "$id": "/properties/catalogs/items/properties/categories/items/properties/styles/items/properties/temperatureIsRange",
                        "type": "boolean",
                        "title": "Is Temperature a range",
                        "default": false,
                        "examples": [
                          true
                        ]
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
    

For better understanding an example of the JSON:

    
{  
   "catalogs":[  
      {  
         "name":"Custom",
         "categories":[  
            {  
               "name":"Smoker",
               "styles":[  
                  {  
                     "name":"Smoking",
                     "temperatureMin":60,
                     "temperatureMax":90,
                     "temperatureIsRange":true
                  },
                  {  
                     "name":"Barbecue",
                     "temperatureMin":90,
                     "temperatureMax":150,
                     "temperatureIsRange":true
                  },
                  {  
                     "name":"Baking & Grilling",
                     "temperatureMin":150,
                     "temperatureMax":240,
                     "temperatureIsRange":true
                  },
                  {  
                     "name":"Pulled Pork Smoking",
                     "temperatureMin":90,
                     "temperatureMax":110,
                     "temperatureIsRange":true
                  }
               ]
            },
            {  
               "name":"Pulled Pork",
               "styles":[  
                  {  
                     "name":"Well Done",
                     "temperatureMin":90,
                     "temperatureMax":95,
                     "temperatureIsRange":false
                  }
               ]
            }
         ]
      }
   ]
}
    
For explanation:
  • The JSON can have multiple catalogs (for example a catalog for all beef preparations)
  • Each catalog can have multiple categories (there is filet, sirloin, rumpsteak, brisket, etc)
  • Each category can have multiple styles (rare, medium-rare, medium, medium-well, well, etc)
  • Each style consists of:
    • temperatureMin: target temperature or minimum temperature of a range 
    • temperatureMax: maximum temperature of a range
    • temperatureIsRange: decides if the thermometer should ping if minimum temperature is reached or the temperature leaves the defined range

References

[1]: Thermometer