ForEx is a cute little desktop widget designed by Stefan for displaying major foreign exchange rates and the time of different locations using ESP8266.
The time zone references are fetched a bit complicated but this method works and deliver accurate results. Further it allows using the effective name of the city which makes easier to use. In a first step the coordinates of the desired city are evaluated using the API of openweathermap.org. This works by sending the name of the city in a format like “Sydney,au” to the API which will response with its coordinates. In the second step the momentary offset to UTC of this coordinates is calculated. This can be done by sending those coordinates to the worldweatheronline.com API.
With this UTC offset information the time at the current location and the time on the defined cities is calculated and displayed. The advantage of this slightly complicated method is the always respected day light saving state at any place including the actual location.
For the evaluation of the currency exchange rate the fixer.io API is used. There are forex API’s offering much more currencies with a shorter update cycle. But this API is simple to use, doesn’t require an API Key and can easily provide the exchange rate to a chosen reference currency.