Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Weather on Clock Face

I'm in the process of adding weather to my clock face, and I got it working with OpenWeatherMap. However, I'm trying to figure out how to save the values of the temperature and condition. Currently, when I open an app, or do anything to cause the clock face to stop, both values are erased. I have it calling to update the weather when the minute is 0, 15, 30, or 45. However, if it is not one of those minutes, it is not updated. I would like to save the last registered temperature and last registered condition code and render it. I am able to get those, but only at the aforementioned times. I tried using localStorage, but I couldn't figure out how to get that to the app from the companion.

Best Answer
0 Votes
4 REPLIES 4

Use fs API on watch (device).

You could do it using localStorage, but then you'd need to communicate the values to the watch, which introduces more latency (especially if there is no bluetooth connection).

Peter McLennan
Gondwana Software
Best Answer

How would I go about doing that?

Best Answer
0 Votes

@hellomynameisbe  -  normal procedure for any clock or app is to load and save it's parameter on start and exit.

 

A simple read and save to a file works easily to maintain current values, however

 

Depending on how long the clock or app was not active it could mean the saved data is very old. An alternative is to also check the weather at startup [which avoids the load/save logic] in addition to every 15 minutes.

 

Having the weather in a clock face means an Internet connection - if you are going to make your clock face public some people might not grant that permission for reasons of security and performance which could cause problems. For personal use it doesn't matter as you know what is happening.

 

For the newer watches it is somewhat redundant as a swipe up gets you current weather and in more detail.

Author | ch, passion for improvement.

Best Answer

What would the code look like for that?

Best Answer
0 Votes