As per the ST architecture that would be in a device (using a custom device handler) and that device would be used by a SmartApp like the one above.
Have you seen the Smart Weather station tile in SmartThings? It uses a public weather service to report the temperature to SmartThings and many folks use the Smart Weather device in the app to control the switch over when the external temperature rises/falls above a certain threshold.